Configuration & Customization
Follow below steps to Customize your application.
How to Change App Constant?
For changing App Name, App background image and others need to change value from folowing location
lib\core\constants\app_const.dart
How to Change App Theme value Constant?
For Changing App theme defult value you need to change from the following location
lib\theme\settings\controllers\settings.dart
For more details please check flex_color_scheme plugin
How to add new Screen?
For Add new screen StatefulWidget/StateLessWidget with annotation
@RoutePage <String>()
. Then
run the following command into the terminal
flutter pub run build_runner build --delete-conflicting-outputs
. After that add the router
inside the lib\app\router\app_router.dart
file
For more details please check auto_route plugin
How to Navigating Between Screens?
AutoRouter offers the same known push, pop and friends methods to manipulate the pages stack using both the generated PageRouteInfo objects and paths.
First declear a variable final router = getIt<AppRouter>();
then you can use any of the
router
// adds a new entry to the pages stack
router.push(const BooksListRoute())
router.replace(const BooksListRoute())
// pops until provided route, if it already exists in stack
// else adds it to the stack (good for web Apps).
router.navigate(const BooksListRoute())
// on Web it calls window.history.back();
// on Native it navigates you back
// to the previous location
router.navigateBack();
// adds a list of routes to the pages stack at once
router.pushAll([
BooksListRoute(),
BookDetailsRoute(id:1),
]);
// This's like providing a completely new stack as it rebuilds the stack
// with the list of passed routes
// entires might just update if already exist
router.replaceAll([
LoginRoute()
]);
// pops the last page unless stack has 1 entry
router.pop();
// keeps poping routes until predicate is satisfied
router.popUntil((route) => route.settings.name == 'HomeRoute');
// a simplifed version of the above line
context.router.popUntilRouteWithName('HomeRoute');
// keeps poping routes until route with provided path is found
router.popUntilRouteWithPath('/some-path');
// pops all routes down to the root
router.popUntilRoot();
// removes the top most page in stack even if it's the last
// remove != pop, it doesn't respect WillPopScopes it just
// removes the entry.
router.removeLast();
// removes any route in stack that satisfis the predicate
// this works exactly like removing items from a regualar List
// [...].removeWhere((r)=>)
router.removeWhere((route) => );
How to change App Icon?
For changing App Icons for all platform please change the value from the following file
flutter_launcher_icons.yaml
# flutter pub run flutter_launcher_icons
flutter_launcher_icons:
#image_path: "assets/icon/icon.png"
image_path_android: "assets/icon/icon-710x599-android.png"
image_path_ios: "assets/icon/icon-1024x1024.png"
android: "launcher_icon"
ios: true # can specify file name here e.g. "My-Launcher-Icon"
adaptive_icon_background: "assets/icon/background.png" # only available for Android 8.0 devices and above
adaptive_icon_foreground: "assets/icon/icon-foreground-432x432.png" # only available for Android 8.0 devices and above
min_sdk_android: 21 # android min sdk min:16, default 21
remove_alpha_ios: true
background_color_ios: "#ffffff"
web:
generate: true
image_path: "assets/icon/icon-1024x1024.png"
background_color: "#ffffff"
theme_color: "#F5325A"
windows:
generate: true
image_path: "assets/icon/icon-1024x1024.png"
icon_size: 48 # min:48, max:256, default: 48
macos:
generate: true
image_path: "assets/icon/icon-1024x1024.png"