diff --git a/README.md b/README.md index e412f1c..5f99c23 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ New to Mason? Read [the documentation][mason_doc_link] to learn how to spin up t | Brick | Description| Version | | - | - | - | -| [scaffold_app](https://github.com/Olivier-plessis/melos_and_mason_bricks/tree/feature/bricks/bricks/scaffold_app)| A brick to generate a new Flutter app with clean architecture and best practices. | 0.0.1 +| [scaffold_app](https://github.com/Olivier-plessis/melos_and_mason_bricks/tree/feature/bricks/bricks/scaffold_app)| A brick to generate a new Flutter app with clean architecture and best practices. | 0.2.0 | [feature_brick](https://github.com/Olivier-plessis/melos_and_mason_bricks/tree/feature/bricks/bricks/feature_brick)| A brick to add a new feature to your app with go_router! | 0.0.1 | [feature_brick_go_router_builder](https://github.com/Olivier-plessis/melos_and_mason_bricks/tree/feature/bricks/bricks/feature_brick_go_router_builder)| A brick to add a new feature to your app with go_router_builder! | 0.0.1 |Work in progress...| Another brick to create your feature using best practices and your state management of choice! diff --git a/bricks/scaffold_app/README.md b/bricks/scaffold_app/README.md index 2174e14..b941f23 100644 --- a/bricks/scaffold_app/README.md +++ b/bricks/scaffold_app/README.md @@ -81,8 +81,9 @@ Follow the instructions in the prompt and **VOILA**, your app is now installed i │ │ │ ├── custom_appbar_widget.dart // just an exemple │ │ ├── core │ │ │ ├── theme -│ │ │ ├── dark_theme.dart -│ │ │ ├── light_theme.dart +│ │ │ ├── app_theme_data.dart // extending ThemeData +│ │ │ ├── dark_theme.dart // using flex_color_scheme +│ │ │ ├── light_theme.dart // using flex_color_scheme │ │ │ ├── theme_mode_controller.dart │ │ │ ├── utils │ │ │ ├── dio_provider.dart @@ -118,3 +119,4 @@ analyzer: - custom_lint ``` + diff --git a/bricks/scaffold_app/__brick__/{{name.snakeCase()}}/lib/src/app.dart b/bricks/scaffold_app/__brick__/{{name.snakeCase()}}/lib/src/app.dart index 858e3dd..535e676 100644 --- a/bricks/scaffold_app/__brick__/{{name.snakeCase()}}/lib/src/app.dart +++ b/bricks/scaffold_app/__brick__/{{name.snakeCase()}}/lib/src/app.dart @@ -1,8 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; -import 'package:{{name.snakeCase()}}/src/core/theme/dark_theme.dart'; -import 'package:{{name.snakeCase()}}/src/core/theme/light_theme.dart'; +import 'package:{{name.snakeCase()}}/src/core/theme/app_theme_data.dart'; import 'package:{{name.snakeCase()}}/src/core/theme/theme_mode_controller.dart'; import 'package:{{name.snakeCase()}}/src/router/app_router.dart'; @@ -13,8 +12,6 @@ class MainApp extends ConsumerWidget { Widget build(BuildContext context, WidgetRef ref) { final ThemeMode themeMode = ref.watch(themeModeControllerProvider); - final theme = themeMode == ThemeMode.light ? lightTheme : darkTheme; - final goRouter = ref.watch(goRouterProvider); return ScreenUtilInit( designSize: ScreenUtil.defaultSize, @@ -24,10 +21,10 @@ class MainApp extends ConsumerWidget { routerConfig: goRouter, debugShowCheckedModeBanner: false, restorationScopeId: 'app', - theme: theme, - darkTheme: theme, + theme: AppThemeData.light(), + darkTheme: AppThemeData.dark(), themeMode: themeMode, - onGenerateTitle: (BuildContext context) => 'mason starter', + onGenerateTitle: (BuildContext context) => '${name.sentenceCase()}', builder: ( BuildContext context, Widget? child, diff --git a/bricks/scaffold_app/__brick__/{{name.snakeCase()}}/lib/src/core/theme/app_theme_data.dart b/bricks/scaffold_app/__brick__/{{name.snakeCase()}}/lib/src/core/theme/app_theme_data.dart new file mode 100644 index 0000000..53eae99 --- /dev/null +++ b/bricks/scaffold_app/__brick__/{{name.snakeCase()}}/lib/src/core/theme/app_theme_data.dart @@ -0,0 +1,16 @@ +import 'package:flex_color_scheme/flex_color_scheme.dart'; +import 'package:flutter/material.dart'; + +extension AppThemeData on ThemeData { + static ThemeData light() => + lightTheme._customAppTheme(); + static ThemeData dark() => + darkTheme._customAppTheme(); + + ThemeData _customAppTheme() { + // An updated theme with your own + return copyWith( + + ); + } +} diff --git a/bricks/scaffold_app/brick.yaml b/bricks/scaffold_app/brick.yaml index f5293b4..9bab4a9 100644 --- a/bricks/scaffold_app/brick.yaml +++ b/bricks/scaffold_app/brick.yaml @@ -1,7 +1,7 @@ name: scaffold_app description: A Riverpod clean architecture feature builder based on solid principles for Flutter projects. -version: 0.1.0+1 +version: 0.2.0 # The following defines the environment for the current brick. # It includes the version of mason that the brick requires.