generateThemeData method
Implementation
ThemeData generateThemeData() {
return ThemeData(
fontFamily: data.fontFamily,
primaryColor: _colorScheme.primaryColor,
cardColor: _colorScheme.backgroundColor,
colorScheme: ColorScheme.fromSwatch().copyWith(
surface: _colorScheme.backgroundColor,
primary: _colorScheme.primaryColor,
),
dividerColor: _colorScheme.dividerColor,
appBarTheme: AppBarTheme(
foregroundColor: _colorScheme.foregroundColor,
backgroundColor: _colorScheme.backgroundColor,
scrolledUnderElevation: 0.0,
centerTitle: false,
titleTextStyle: TextStyle(
fontWeight: FontWeight.bold,
color: _colorScheme.foregroundColor,
fontSize: 24.0,
fontFamily: data.fontFamily,
),
titleSpacing: 16.0,
),
dropdownMenuTheme: DropdownMenuThemeData(
textStyle: TextStyle(
fontSize: data.fontSize,
fontWeight: FontWeight.normal,
color: _colorScheme.foregroundColor,
fontFamily: data.fontFamily,
),
),
elevatedButtonTheme: ElevatedButtonThemeData(
style:
ElevatedButton.styleFrom(
elevation: 0.0,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8.0)),
backgroundColor: _colorScheme.primaryColor,
foregroundColor: _colorScheme.backgroundColor,
textStyle: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold, fontFamily: data.fontFamily),
).copyWith(
elevation: WidgetStateProperty.resolveWith((states) {
return 0.0;
}),
),
),
textButtonTheme: TextButtonThemeData(style: TextButton.styleFrom(foregroundColor: _colorScheme.primaryColor)),
dividerTheme: DividerThemeData(color: Colors.grey[300]!, thickness: 0.5, indent: 0.0, endIndent: 0.0, space: 0.0),
chipTheme: ChipThemeData(
color: WidgetStateProperty.resolveWith((states) {
if (states.contains(WidgetState.selected)) {
return _colorScheme.primaryColor;
}
return Colors.grey[100];
}),
),
switchTheme: SwitchThemeData(
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
padding: const EdgeInsets.all(0.0),
trackColor: WidgetStateProperty.resolveWith((states) {
if (states.contains(WidgetState.selected)) {
return _colorScheme.primaryColor;
}
return DN.theme.gray[300];
}),
thumbColor: WidgetStateProperty.resolveWith((states) {
if (states.contains(WidgetState.selected)) {
return _colorScheme.backgroundColor;
}
return DN.theme.gray[100];
}),
),
bottomNavigationBarTheme: BottomNavigationBarThemeData(
elevation: 4.0,
selectedItemColor: _colorScheme.primaryColor,
),
floatingActionButtonTheme: FloatingActionButtonThemeData(
elevation: 4.0,
backgroundColor: _colorScheme.primaryColor,
),
textTheme: TextTheme(
bodyLarge: TextStyle(
fontSize: data.fontSize,
fontWeight: FontWeight.normal,
color: _colorScheme.foregroundColor,
fontFamily: data.fontFamily,
),
bodyMedium: TextStyle(
fontSize: data.fontSize,
fontWeight: FontWeight.normal,
color: _colorScheme.foregroundColor,
fontFamily: data.fontFamily,
),
bodySmall: TextStyle(
fontSize: data.fontSize,
fontWeight: FontWeight.normal,
color: _colorScheme.foregroundColor,
fontFamily: data.fontFamily,
),
),
iconTheme: IconThemeData(color: _colorScheme.foregroundColor),
scaffoldBackgroundColor: _colorScheme.backgroundColor,
actionIconTheme: ActionIconThemeData(backButtonIconBuilder: (context) => Icon(Icons.arrow_back_ios_new_rounded)),
timePickerTheme: TimePickerThemeData(
dialHandColor: _colorScheme.primaryColor,
dialBackgroundColor: _colorScheme.backgroundColor,
entryModeIconColor: _colorScheme.primaryColor,
hourMinuteTextColor: _colorScheme.foregroundColor,
hourMinuteColor: _colorScheme.primaryColor.withValues(alpha: 0.2),
dayPeriodTextColor: _colorScheme.foregroundColor,
dayPeriodColor: _colorScheme.primaryColor.withValues(alpha: 0.2),
helpTextStyle: TextStyle(
fontSize: data.fontSize,
fontWeight: FontWeight.normal,
color: _colorScheme.foregroundColor,
fontFamily: data.fontFamily,
),
),
);
}