tch_appliable_core

Creator: coderz1093

Last updated:

0 purchases

tch_appliable_core Image
tch_appliable_core Images

Languages

Categories

Add to Cart

Description:

tch appliable core

tch_appliable_core #
Flutter core package used by Tomas Chyly & partners/clients. Contains common functionality to get started faster & consistently.
There are a number of useful utils for use in your projects.
This package includes example, in this example you should be able to see basic usage of features provided by this package.
If some instructions are not clear enough, then analyse usage inside the example.
Platforms notice: I have worked on projects that use Flutter on all platforms, but my focus is on Mobile and Desktop. Therefore some widgets and features may not work on Web, but should work on other platforms. Personally I do not consider Flutter ready for web dev.
Development notice: This documentation is out of date for lack of time, but the package itself continues to be maintained and developed over time.
Contents #

Installation
App Create
Router (Navigator 1.0)
Translator
Preferences
Screens, Widgets & Responsivity
MainDataProvider & DataWidgets
Hooks
Media
Utils
Roadmap

Installation #
In your project's pubspec.yaml add:
dependencies:
tch_appliable_core: ^0.33.3
copied to clipboard
App Create #
If your IDE does not autoImport, add manually:
import 'package:tch_appliable_core/tch_appliable_core.dart';
copied to clipboard
Then instead of using MaterialApp use CoreApp for you main app widget, which you run from your main.dart using runApp(App()).
...
@override
Widget build(BuildContext context) {
return CoreApp(
title: 'Core Example',
initializationUi: Container(
child: Center(
child: Text(
'This can be the same as splash\nor\ndifferent custom initialization UI',
textAlign: TextAlign.center,
),
),
),
initialScreenRoute: HomeScreen.ROUTE,
onGenerateRoute: AppRouter.onGenerateRoute,
snapshot: AppDataStateSnapshot(),
);
}
...
copied to clipboard
Now your app will run as MaterialApp, but with included features from this package.
Router (Navigator 1.0) #
Currently usage of this router is required by CoreApp. To use it you need to provide RouteFactory onGenerateRoute to CoreApp.
initialScreenRoute is route name to be launched as initial screen of your app.
...
@override
Widget build(BuildContext context) {
return CoreApp(
...
initialScreenRoute: HomeScreen.ROUTE,
onGenerateRoute: AppRouter.onGenerateRoute,
...
);
}
...
copied to clipboard
To create your own RouteFactory, create new lib/core/Router.dart or use other place that you see fit. Then create the generator which you reference to the CoreApp.
Route<dynamic> onGenerateRoute(RouteSettings settings) {
final arguments = settings.name?.routingArguments;

if (arguments != null) {
switch (arguments.route) {
case HomeScreen.ROUTE:
return createRoute((BuildContext context) => HomeScreen(), settings);
default:
throw Exception('Implement OnGenerateRoute in app');
}
}

throw Exception('Arguments not available');
}
copied to clipboard
Then to navigate around your app, do not use Navigator, but instead functions provided by this package.
Future<T?> pushNamed<T extends Object>(BuildContext context, String routeName, {Map<String, String>? arguments})

Future<T?> pushNamedNewStack<T extends Object>

void popNotDisposed<T extends Object?>(BuildContext context, bool mounted, [T? result])
copied to clipboard
To transfer parameters between screens, use RoutingArguments.
RoutingArguments info coming soon...
Translator #
Translator is an optional feature of this package. You activate it by providing TranslatorOptions to the CoreApp.
Translator works well with my JsTrions JSON translations app.
...
@override
Widget build(BuildContext context) {
return CoreApp(
...
translatorOptions: TranslatorOptions(
languages: ['en', 'sk'],
supportedLocales: [const Locale('en'), const Locale('sk')],
),
...
);
}
...
copied to clipboard
Then you need to add json transaction files into your assets with path assets/translations/<code>.json e.g. assets/translations/en.json.
The Translator uses your OS language automatically & if it is part of supportedLocales.
You can also change language during runtime.
Translator.instance!.changeLanguage('sk');
copied to clipboard
Then to see your new language immediately you can invalidate CoreApp.
CoreAppState.instance.invalidateApp();
copied to clipboard
To use the Translator for string translations, you just write text with short tt function.
tt('home.screen.title');
copied to clipboard
Preferences #
Coming soon...
Screens, Widgets & Responsivity #
All your stateful screens/widgets have to extend CoreApp abstract classes instead of Flutter.
See the example for resposive app implementation.
Screens #
First you should decide if you want to support resposivity or not. Then it is a good idea to create your app's main AbstractAppScreen & AbstractAppScreenState where you will be then able to setup defaults for your app.
It is better to support resposivity, for this your app's AbstractAppScreen extends AbstractResposiveScreen & AbstractAppScreenState extends AbstractResposiveScreenState.
CoreApp's responsity is divided into several screen sizes inspired by Bootstrap used on the web.
For non resposive screens/apps you extend AbstractScreen & AbstractScreenState.
CoreApp screens currently support creation of AppBar, Drawer and BottomBar. Check the example for details.
Widgets #
Just like screens, widgets can be resposive too extending AbstractResponsiveWidget & AbstractResponsiveWidgetState.
Or non resposive extending AbstractStatefulWidget & AbstractStatefulWidgetState.
Useful methods #
The reason for using CoreApp abstract classes are some useful methods that you should use.
E.g. you should not use setState but instead always use setStateNotDisposed.
Use firstBuildOnly for initialization on first build with BuildContext available.
MainDataProvider & DataWidgets #
Coming soon...
Hooks #
Coming soon...
Media #
Coming soon...
Utils #
This package includes a number of utils, methods and extensions. Check the code for useful features that you can use.

Boundary
Color
List
Numbers
Text

Roadmap #
Until version 1.0.0 there will not be predictable roadmap. Instead development is dependant on requirements of projects where this package is used.
Core pillars of this package are however already implemented.

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.