bottom navbar color fix

This commit is contained in:
ezyyeah 2022-12-31 13:32:47 +01:00
parent a839f20a38
commit f2be74d819
2 changed files with 14 additions and 2 deletions

View File

@ -2,12 +2,17 @@ import 'package:flutter/material.dart';
class ThemeModeObserver extends ChangeNotifier {
ThemeMode _themeMode;
bool _updateNavbarColor;
ThemeMode get themeMode => _themeMode;
bool get updateNavbarColor => _updateNavbarColor;
ThemeModeObserver({ThemeMode initialTheme = ThemeMode.system}) : _themeMode = initialTheme;
ThemeModeObserver({ThemeMode initialTheme = ThemeMode.system, bool updateNavbarColor = true})
: _themeMode = initialTheme,
_updateNavbarColor = updateNavbarColor;
void changeTheme(ThemeMode mode) {
void changeTheme(ThemeMode mode, {bool updateNavbarColor = true}) {
_themeMode = mode;
_updateNavbarColor = updateNavbarColor;
notifyListeners();
}
}

View File

@ -1,6 +1,7 @@
import 'package:filcnaplo/models/settings.dart';
import 'package:filcnaplo/theme/colors/accent.dart';
import 'package:filcnaplo/theme/colors/colors.dart';
import 'package:filcnaplo/theme/observer.dart';
import 'package:flutter/material.dart';
import 'package:material_color_utilities/material_color_utilities.dart';
import 'package:provider/provider.dart';
@ -76,6 +77,9 @@ class AppTheme {
progressIndicatorTheme: ProgressIndicatorThemeData(color: accent),
expansionTileTheme: ExpansionTileThemeData(iconColor: accent),
cardColor: highlightColor,
bottomNavigationBarTheme: BottomNavigationBarThemeData(
backgroundColor: Provider.of<ThemeModeObserver>(context, listen: false).updateNavbarColor ? backgroundColor : null,
),
);
}
@ -139,6 +143,9 @@ class AppTheme {
backgroundColor: accent.withOpacity(.2),
elevation: 1,
),
bottomNavigationBarTheme: BottomNavigationBarThemeData(
backgroundColor: Provider.of<ThemeModeObserver>(context, listen: false).updateNavbarColor ? backgroundColor : null,
),
);
}
}