From f2be74d8197b709f1ce7ce89437b50a13c8bbcc9 Mon Sep 17 00:00:00 2001 From: ezyyeah Date: Sat, 31 Dec 2022 13:32:47 +0100 Subject: [PATCH] bottom navbar color fix --- filcnaplo/lib/theme/observer.dart | 9 +++++++-- filcnaplo/lib/theme/theme.dart | 7 +++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/filcnaplo/lib/theme/observer.dart b/filcnaplo/lib/theme/observer.dart index 66a9c67..e5baaec 100644 --- a/filcnaplo/lib/theme/observer.dart +++ b/filcnaplo/lib/theme/observer.dart @@ -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(); } } diff --git a/filcnaplo/lib/theme/theme.dart b/filcnaplo/lib/theme/theme.dart index 292fe87..cc0a1b5 100644 --- a/filcnaplo/lib/theme/theme.dart +++ b/filcnaplo/lib/theme/theme.dart @@ -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(context, listen: false).updateNavbarColor ? backgroundColor : null, + ), ); } @@ -139,6 +143,9 @@ class AppTheme { backgroundColor: accent.withOpacity(.2), elevation: 1, ), + bottomNavigationBarTheme: BottomNavigationBarThemeData( + backgroundColor: Provider.of(context, listen: false).updateNavbarColor ? backgroundColor : null, + ), ); } }