themeStub function
This stub is used to create a new Theme in the /resources/themes/ directory.
Implementation
String themeStub(ReCase rc, {bool isDark = false}) => '''
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import '/config/design.dart';
import '/resources/themes/styles/color_styles.dart';
import '/resources/themes/text_theme/default_text_theme.dart';
import 'package:nylo_framework/nylo_framework.dart';
/* ${rc.titleCase} Theme
|--------------------------------------------------------------------------
| Theme Config - config/app_theme.dart
|-------------------------------------------------------------------------- */
ThemeData ${rc.camelCase}Theme(ColorStyles color) {
TextTheme ${rc.camelCase}Theme = getAppTextTheme(
appFont, defaultTextTheme.merge(_textTheme(color)));
return ThemeData(
useMaterial3: true,
primaryColor: color.content,
primaryColorLight: color.primaryAccent,
focusColor: color.content,
scaffoldBackgroundColor: color.background,
hintColor: color.primaryAccent,
dividerTheme: DividerThemeData(color: Colors.grey[100]),
appBarTheme: AppBarTheme(
surfaceTintColor: Colors.transparent,
backgroundColor: color.appBarBackground,
titleTextStyle:
${rc.camelCase}Theme.titleLarge!.copyWith(color: color.appBarPrimaryContent),
iconTheme: IconThemeData(color: color.appBarPrimaryContent),
elevation: 1.0,
systemOverlayStyle: SystemUiOverlayStyle.dark,
),
buttonTheme: ButtonThemeData(
buttonColor: color.buttonContent,
colorScheme: ColorScheme.light(primary: color.buttonBackground),
),
textButtonTheme: TextButtonThemeData(
style: TextButton.styleFrom(foregroundColor: color.content),
),
elevatedButtonTheme: ElevatedButtonThemeData(
style: TextButton.styleFrom(
foregroundColor: color.buttonContent,
backgroundColor: color.buttonBackground),
),
bottomNavigationBarTheme: BottomNavigationBarThemeData(
backgroundColor: color.bottomTabBarBackground,
unselectedIconTheme:
IconThemeData(color: color.bottomTabBarIconUnselected),
selectedIconTheme: IconThemeData(color: color.bottomTabBarIconSelected),
unselectedLabelStyle: TextStyle(color: color.bottomTabBarLabelUnselected),
selectedLabelStyle: TextStyle(color: color.bottomTabBarLabelSelected),
selectedItemColor: color.bottomTabBarLabelSelected,
),
textTheme: ${rc.camelCase}Theme,
colorScheme: ColorScheme.light(
surface: color.background,
onSecondary: Colors.white,
primary: color.primaryAccent,
),
);
}
/* ${rc.titleCase} Text Theme
|-------------------------------------------------------------------------- */
TextTheme _textTheme(ColorStyles colors) {
TextTheme textTheme = const TextTheme().apply(displayColor: colors.content);
return textTheme.copyWith(
labelLarge: TextStyle(color: colors.content.withOpacity(0.8)));
}
''';