Skip to content

Commit

Permalink
Ensured the Dark Themes are dark!
Browse files Browse the repository at this point in the history
  • Loading branch information
Clon1998 committed Apr 16, 2022
1 parent 827528b commit 7a0333a
Show file tree
Hide file tree
Showing 7 changed files with 131 additions and 95 deletions.
File renamed without changes
File renamed without changes
32 changes: 18 additions & 14 deletions lib/ui/components/drawer/nav_drawer_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,13 @@ class _NavHeader extends ViewModelWidget<NavDrawerViewModel> {
var brandingIcon = (themeData.brightness == Brightness.light)
? context.themeService.selectedThemePack.brandingIcon
: context.themeService.selectedThemePack.brandingIconDark;
var background = (themeData.brightness == Brightness.light)? themeData.colorScheme.primary: themeData.colorScheme.surfaceVariant;
var onBackground = (themeData.brightness == Brightness.light)? themeData.colorScheme.onPrimary: themeData.colorScheme.onSurfaceVariant;

return DrawerHeader(
margin: EdgeInsets.zero,
padding: EdgeInsets.only(left: 10, right: 10, top: 30),
decoration: BoxDecoration(color: themeData.colorScheme.primary),
decoration: BoxDecoration(color: background),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expand All @@ -171,15 +174,15 @@ class _NavHeader extends ViewModelWidget<NavDrawerViewModel> {
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: themeData.textTheme.titleLarge?.copyWith(
color: themeData.colorScheme.onPrimary),
color:onBackground),
),
const SizedBox(height: 4),
Text(
model.printerUrl,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: themeData.textTheme.subtitle2?.copyWith(
color: themeData.colorScheme.onPrimary),
color: onBackground),
),
],
),
Expand All @@ -190,21 +193,21 @@ class _NavHeader extends ViewModelWidget<NavDrawerViewModel> {
tooltip: 'components.nav_drawer.printer_settings'.tr(),
icon: Icon(
FlutterIcons.settings_fea,
color: themeData.colorScheme.onPrimary,
color: onBackground,
size: 27,
))
],
),
ListTile(
title: Text(
'components.nav_drawer.manage_printers',
style: TextStyle(color: themeData.colorScheme.onPrimary),
style: TextStyle(color: onBackground),
).tr(),
trailing: Icon(
model.isManagePrintersExpanded
? Icons.expand_less
: Icons.expand_more,
color: themeData.colorScheme.onPrimary,
color: onBackground,
),
onTap: model.toggleManagePrintersExpanded,
)
Expand All @@ -228,11 +231,11 @@ class _DrawerItem extends ViewModelWidget<NavDrawerViewModel> {
@override
Widget build(BuildContext context, NavDrawerViewModel model) {
var themeData = Theme.of(context);
final color = themeData.colorScheme.primary;
var selectedTileColor = (themeData.brightness == Brightness.light)? themeData.colorScheme.surfaceVariant:themeData.colorScheme.primaryContainer.withOpacity(.1);

return ListTile(
selected: model.isSelected(path),
selectedTileColor: themeData.colorScheme.surfaceVariant,
selectedTileColor: selectedTileColor,
selectedColor: themeData.colorScheme.secondary,
textColor: themeData.colorScheme.onBackground,
leading: Icon(icon),
Expand All @@ -247,7 +250,8 @@ class _PrinterSelection extends ViewModelWidget<NavDrawerViewModel> {
Widget build(BuildContext context, NavDrawerViewModel model) {
List<Machine> printers = model.dataReady ? model.printers : [];
var themeData = Theme.of(context);
var baseColor = themeData.colorScheme.onBackground;
var onBackGroundColor = themeData.colorScheme.onBackground;
var selectedTileColor = (themeData.brightness == Brightness.light)? themeData.colorScheme.surfaceVariant:themeData.colorScheme.primaryContainer.withOpacity(.1);
const double baseIconSize = 20;
const basePadding = const EdgeInsets.only(left: 16, right: 16);
return AnimatedContainer(
Expand Down Expand Up @@ -283,11 +287,11 @@ class _PrinterSelection extends ViewModelWidget<NavDrawerViewModel> {
size: baseIconSize,
),
selectedTileColor: model.isManagePrintersExpanded
? themeData.colorScheme.surfaceVariant
? selectedTileColor
: Colors.transparent,
selectedColor: themeData.colorScheme.secondary,
textColor: baseColor,
iconColor: baseColor,
textColor: onBackGroundColor,
iconColor: onBackGroundColor,
contentPadding: basePadding,
selected: index == 0,
onTap: () => model.onSetActiveTap(curPS),
Expand All @@ -297,8 +301,8 @@ class _PrinterSelection extends ViewModelWidget<NavDrawerViewModel> {
ListTile(
title: Text('pages.printer_add.title').tr(),
contentPadding: basePadding,
textColor: baseColor,
iconColor: baseColor,
textColor: onBackGroundColor,
iconColor: onBackGroundColor,
trailing: Icon(
Icons.add,
size: baseIconSize,
Expand Down
129 changes: 73 additions & 56 deletions lib/ui/theme_setup.dart
Original file line number Diff line number Diff line change
Expand Up @@ -105,25 +105,20 @@ ThemePack _mobilerakerPack(BuildContext context) {

var dark = FlexThemeData.dark(
colors: const FlexSchemeColor(
primary: Color(0xff023047),
primaryContainer: Color(0xffd01e1e),
secondary: Color(0xfea28544),
secondaryContainer: Color(0xffffdbcf),
tertiary: Color(0xff715b2e),
tertiaryContainer: Color(0xffffefd2),
appBarColor: Color(0xffffdbcf),
error: Color(0xffb00020),
primary: Color(0xff74a6ce),
primaryContainer: Color(0xff2e4252),
secondary: Color(0xff00a69d),
secondaryContainer: Color(0xff00423e),
tertiary: Color(0xff9a9eda),
tertiaryContainer: Color(0xff004e59),
appBarColor: Color(0xff00423e),
error: Color(0xffcf6679),
),
usedColors: 2,
surfaceMode: FlexSurfaceMode.highScaffoldLowSurface,
blendLevel: 20,
usedColors: 5,
surfaceMode: FlexSurfaceMode.highScaffoldLevelSurface,
blendLevel: 15,
appBarStyle: FlexAppBarStyle.background,
appBarOpacity: 0.90,
tabBarStyle: FlexTabBarStyle.forBackground,
// darkIsTrueBlack: true,
keyColors: const FlexKeyColors(
keepPrimary: true,
),
tones: FlexTones.highContrast(Brightness.dark),
visualDensity: FlexColorScheme.comfortablePlatformDensity,
useMaterial3: true,
// To use the playground font, add GoogleFonts package and uncomment
Expand Down Expand Up @@ -153,22 +148,19 @@ ThemePack _mobilerakerPack(BuildContext context) {
elevatedButtonTheme: _elevatedButtonThemeData,
bottomNavigationBarTheme: FlexSubThemes.bottomNavigationBar(
colorScheme: dark.colorScheme,
selectedLabelSchemeColor: SchemeColor.onPrimary,
unselectedLabelSchemeColor: SchemeColor.onPrimary,
selectedIconSchemeColor: SchemeColor.onPrimary,
unselectedIconSchemeColor: SchemeColor.onPrimary,
backgroundSchemeColor: SchemeColor.primary,
selectedLabelSchemeColor: SchemeColor.onBackground,
unselectedLabelSchemeColor: SchemeColor.onBackground,
selectedIconSchemeColor: SchemeColor.onBackground,
unselectedIconSchemeColor: SchemeColor.onBackground,
backgroundSchemeColor: SchemeColor.background,
showSelectedLabels: false,
showUnselectedLabels: false,
),
// toggleButtonsTheme: FlexSubThemes.toggleButtonsTheme(colorScheme: dark.colorScheme,baseSchemeColor: SchemeColor.error, radius: 0),
toggleButtonsTheme: dark.toggleButtonsTheme
.copyWith(selectedColor: dark.colorScheme.onSecondaryContainer),
textButtonTheme: FlexSubThemes.textButtonTheme(
colorScheme: dark.colorScheme,
baseSchemeColor: SchemeColor.onSecondaryContainer),
inputDecorationTheme:
dark.inputDecorationTheme.copyWith(filled: false),
bottomSheetTheme: dark.bottomSheetTheme
.copyWith(modalBackgroundColor: dark.colorScheme.background)),
.copyWith(modalBackgroundColor: dark.colorScheme.background),
cardTheme: dark.cardTheme.copyWith(elevation: 3)),
brandingIcon: AssetImage('assets/icon/mr_logo.png'));
}

Expand Down Expand Up @@ -199,19 +191,19 @@ ThemePack _voronPack(BuildContext context) {
var dark = FlexThemeData.dark(
colors: const FlexSchemeColor(
primary: Color(0xffed3023),
primaryContainer: Color(0xffd0e4ff),
secondary: Color(0xff5aff00),
secondaryContainer: Color(0xffffdbcf),
tertiary: Color(0xff006875),
tertiaryContainer: Color(0xff95f0ff),
appBarColor: Color(0xffffdbcf),
error: Color(0xffb00020),
),
keyColors: const FlexKeyColors(
keepPrimary: true,
primaryContainer: Color(0xff5e130e),
secondary: Color(0xFFFF5044),
secondaryContainer: Color(0xff872100),
tertiary: Color(0xff5aff00),
tertiaryContainer: Color(0xff004e59),
appBarColor: Color(0xff872100),
error: Color(0xffcf6679),
),
usedColors: 2,
surfaceMode: FlexSurfaceMode.levelSurfacesLowScaffold,
surfaceMode: FlexSurfaceMode.highScaffoldLevelSurface,
blendLevel: 2,
appBarStyle: FlexAppBarStyle.background,
appBarOpacity: 0.90,
visualDensity: FlexColorScheme.comfortablePlatformDensity,
useMaterial3: true,
fontFamily: GoogleFonts.notoSans().fontFamily,
Expand All @@ -237,13 +229,22 @@ ThemePack _voronPack(BuildContext context) {
),
darkTheme: dark.copyWith(
elevatedButtonTheme: _elevatedButtonThemeData,
bottomNavigationBarTheme: BottomNavigationBarThemeData(
selectedItemColor: Colors.white,
unselectedItemColor: Colors.black),
bottomNavigationBarTheme: FlexSubThemes.bottomNavigationBar(
colorScheme: dark.colorScheme,
selectedLabelSchemeColor: SchemeColor.onBackground,
unselectedLabelSchemeColor: SchemeColor.onBackground,
selectedIconSchemeColor: SchemeColor.onBackground,
unselectedIconSchemeColor: SchemeColor.onBackground,
backgroundSchemeColor: SchemeColor.background,
showSelectedLabels: false,
showUnselectedLabels: false,
),
inputDecorationTheme:
dark.inputDecorationTheme.copyWith(filled: false),
bottomSheetTheme: dark.bottomSheetTheme
.copyWith(modalBackgroundColor: dark.colorScheme.background),
cardTheme: dark.cardTheme.copyWith(elevation: 3)),
brandingIcon: AssetImage('assets/images/voron_design.png'));
brandingIcon: AssetImage('assets/images/voron_design_padded.png'));
}

ThemePack _ratRigPack(BuildContext context) {
Expand Down Expand Up @@ -273,11 +274,21 @@ ThemePack _ratRigPack(BuildContext context) {
);

var dark = FlexThemeData.dark(
colorScheme: ColorScheme.fromSeed(
seedColor: ratRigGreen, brightness: Brightness.dark),
usedColors: 2,
blendLevel: 10,
darkIsTrueBlack: true,
colors: const FlexSchemeColor(
primary: Color(0xff5aff00),
primaryContainer: Color(0xff00423e),
secondary: Color(0xffa600ff),
secondaryContainer: Color(0xff872100),
tertiary: Color(0xff5aff00),
tertiaryContainer: Color(0xff004e59),
appBarColor: Color(0xff872100),
error: Color(0xffcf6679),
),
usedColors: 1,
surfaceMode: FlexSurfaceMode.highScaffoldLevelSurface,
blendLevel: 2,
appBarStyle: FlexAppBarStyle.background,
appBarOpacity: 0.90,
visualDensity: FlexColorScheme.comfortablePlatformDensity,
useMaterial3: true,
fontFamily: GoogleFonts.notoSans().fontFamily,
Expand All @@ -304,13 +315,19 @@ ThemePack _ratRigPack(BuildContext context) {
darkTheme: dark.copyWith(
elevatedButtonTheme: _elevatedButtonThemeData,
inputDecorationTheme:
light.inputDecorationTheme.copyWith(filled: false),
bottomNavigationBarTheme: BottomNavigationBarThemeData(
selectedItemColor: Colors.white,
unselectedItemColor: Colors.black),
cardTheme: light.cardTheme.copyWith(elevation: 3)),
brandingIconDark: AssetImage('assets/images/RR-Icon_Black.png'),
brandingIcon: AssetImage('assets/images/RR-Icon_Green.png'));
dark.inputDecorationTheme.copyWith(filled: false),
bottomNavigationBarTheme: FlexSubThemes.bottomNavigationBar(
colorScheme: dark.colorScheme,
selectedLabelSchemeColor: SchemeColor.onBackground,
unselectedLabelSchemeColor: SchemeColor.onBackground,
selectedIconSchemeColor: SchemeColor.onBackground,
unselectedIconSchemeColor: SchemeColor.onBackground,
backgroundSchemeColor: SchemeColor.background,
showSelectedLabels: false,
showUnselectedLabels: false,
),
cardTheme: dark.cardTheme.copyWith(elevation: 3)),
brandingIcon: AssetImage('assets/images/rr-icon_green.png'));
}

List<ThemePack> getThemePacks(BuildContext context) {
Expand Down
58 changes: 37 additions & 21 deletions lib/ui/views/dashboard/dashboard_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ class DashboardView extends ViewModelBuilderWidget<DashboardViewModel> {
const DashboardView({Key? key}) : super(key: key);

@override
Widget builder(BuildContext context, DashboardViewModel model, Widget? child) =>
Widget builder(
BuildContext context, DashboardViewModel model, Widget? child) =>
Scaffold(
appBar: AppBar(
title: GestureDetector(
Expand Down Expand Up @@ -51,22 +52,28 @@ class DashboardView extends ViewModelBuilderWidget<DashboardViewModel> {
),
body: ConnectionStateView(
body: (model.isPrinterAvailable)
? PageTransitionSwitcher(
duration: const Duration(milliseconds: 300),
reverse: model.reverse,
transitionBuilder: (
Widget child,
Animation<double> animation,
Animation<double> secondaryAnimation,
) {
return SharedAxisTransition(
child: child,
animation: animation,
secondaryAnimation: secondaryAnimation,
transitionType: SharedAxisTransitionType.horizontal,
);
},
child: _getViewForIndex(model.currentIndex),
? Theme(
data: Theme.of(context)
.copyWith(canvasColor: Colors.transparent),
child: PageTransitionSwitcher(
duration: kThemeAnimationDuration,
reverse: model.reverse,
transitionBuilder: (
Widget child,
Animation<double> animation,
Animation<double> secondaryAnimation,
) {
return SharedAxisTransition(
child: child,
animation: animation,
secondaryAnimation: secondaryAnimation,
transitionType: SharedAxisTransitionType.horizontal,
);
},
child: Theme(
data: Theme.of(context),
child: _getViewForIndex(model.currentIndex)),
),
)
: Center(
child: Column(
Expand Down Expand Up @@ -97,10 +104,18 @@ class DashboardView extends ViewModelBuilderWidget<DashboardViewModel> {
// FlutterIcons.camera_control_mco,
FlutterIcons.settings_oct,
],
activeColor: Theme.of(context).bottomNavigationBarTheme.selectedItemColor ?? Theme.of(context).colorScheme.onPrimary,
inactiveColor: Theme.of(context).bottomNavigationBarTheme.unselectedItemColor,
activeColor: Theme.of(context)
.bottomNavigationBarTheme
.selectedItemColor ??
Theme.of(context).colorScheme.onPrimary,
inactiveColor: Theme.of(context)
.bottomNavigationBarTheme
.unselectedItemColor,
gapLocation: GapLocation.end,
backgroundColor: Theme.of(context).bottomNavigationBarTheme.backgroundColor ?? Theme.of(context).colorScheme.primary,
backgroundColor: Theme.of(context)
.bottomNavigationBarTheme
.backgroundColor ??
Theme.of(context).colorScheme.primary,
notchSmoothness: NotchSmoothness.softEdge,
activeIndex: model.currentIndex,
onTap: model.setIndex,
Expand All @@ -110,7 +125,8 @@ class DashboardView extends ViewModelBuilderWidget<DashboardViewModel> {
);

@override
DashboardViewModel viewModelBuilder(BuildContext context) => DashboardViewModel();
DashboardViewModel viewModelBuilder(BuildContext context) =>
DashboardViewModel();

Color? _getActiveTextColor(context) {
var themeData = Theme.of(context);
Expand Down
3 changes: 2 additions & 1 deletion lib/ui/views/dashboard/tabs/general_tab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,8 @@ class _TemperaturePresetCard extends StatelessWidget {
Text('pages.dashboard.general.temp_preset_card.h_temp',
style: Theme.of(context).textTheme.caption)
.tr(args: [extruderTemp.toString()]),
Text('pages.dashboard.general.temp_preset_card.b_temp')
Text('pages.dashboard.general.temp_preset_card.b_temp',
style: Theme.of(context).textTheme.caption)
.tr(args: [bedTemp.toString()]),
],
);
Expand Down
4 changes: 1 addition & 3 deletions lib/ui/views/fullcam/full_cam_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ class FullCamView extends ViewModelBuilderWidget<FullCamViewModel> {
.textTheme
.bodySmall
?.copyWith(
color: Theme.of(context)
.colorScheme
.onSecondary),
color: Colors.white70),
)),
),
),
Expand Down

0 comments on commit 7a0333a

Please sign in to comment.