Merge pull request #26 from basitali1509/feat/bottom-nav-bar-UI

FEEDBACK: Bottom Navigation Bar background color should be white in light mode
This commit is contained in:
dstark5
2023-09-12 08:44:34 +05:30
committed by GitHub

View File

@ -14,11 +14,11 @@ import 'package:openlib/services/files.dart'
show moveFilesToAndroidInternalStorage; show moveFilesToAndroidInternalStorage;
import 'package:openlib/state/state.dart' import 'package:openlib/state/state.dart'
show show
selectedIndexProvider, selectedIndexProvider,
themeModeProvider, themeModeProvider,
openPdfWithExternalAppProvider, openPdfWithExternalAppProvider,
openEpubWithExternalAppProvider, openEpubWithExternalAppProvider,
dbProvider; dbProvider;
void main() async { void main() async {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
@ -32,9 +32,9 @@ void main() async {
MyLibraryDb dataBase = MyLibraryDb(dbInstance: initDb); MyLibraryDb dataBase = MyLibraryDb(dbInstance: initDb);
bool isDarkMode = await dataBase.getPreference('darkMode'); bool isDarkMode = await dataBase.getPreference('darkMode');
bool openPdfwithExternalapp = bool openPdfwithExternalapp =
await dataBase.getPreference('openPdfwithExternalApp'); await dataBase.getPreference('openPdfwithExternalApp');
bool openEpubwithExternalapp = bool openEpubwithExternalapp =
await dataBase.getPreference('openEpubwithExternalApp'); await dataBase.getPreference('openEpubwithExternalApp');
if (Platform.isAndroid) { if (Platform.isAndroid) {
await moveFilesToAndroidInternalStorage(); await moveFilesToAndroidInternalStorage();
@ -45,7 +45,7 @@ void main() async {
overrides: [ overrides: [
dbProvider.overrideWithValue(dataBase), dbProvider.overrideWithValue(dataBase),
themeModeProvider.overrideWith( themeModeProvider.overrideWith(
(ref) => isDarkMode ? ThemeMode.dark : ThemeMode.light), (ref) => isDarkMode ? ThemeMode.dark : ThemeMode.light),
openPdfWithExternalAppProvider openPdfWithExternalAppProvider
.overrideWith((ref) => openPdfwithExternalapp), .overrideWith((ref) => openPdfwithExternalapp),
openEpubWithExternalAppProvider openEpubWithExternalAppProvider
@ -96,6 +96,8 @@ class _HomePageState extends ConsumerState<HomePage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final isDarkMode = Theme.of(context).brightness == Brightness.dark;
final selectedIndex = ref.watch(selectedIndexProvider); final selectedIndex = ref.watch(selectedIndexProvider);
return Scaffold( return Scaffold(
@ -108,7 +110,7 @@ class _HomePageState extends ConsumerState<HomePage> {
bottomNavigationBar: SafeArea( bottomNavigationBar: SafeArea(
child: GNav( child: GNav(
rippleColor: Colors.redAccent, rippleColor: Colors.redAccent,
backgroundColor: Colors.black, backgroundColor: isDarkMode ? Colors.black : Colors.grey.shade300,
haptic: true, haptic: true,
tabBorderRadius: 50, tabBorderRadius: 50,
tabActiveBorder: Border.all( tabActiveBorder: Border.all(
@ -123,12 +125,12 @@ class _HomePageState extends ConsumerState<HomePage> {
iconSize: 19, // tab button icon size iconSize: 19, // tab button icon size
tabBackgroundColor: Theme.of(context).colorScheme.secondary, tabBackgroundColor: Theme.of(context).colorScheme.secondary,
padding: const EdgeInsets.symmetric(horizontal: 13, vertical: 6.5), padding: const EdgeInsets.symmetric(horizontal: 13, vertical: 6.5),
tabs: const [ tabs: [
GButton( GButton(
icon: Icons.trending_up, icon: Icons.trending_up,
text: 'Trending', text: 'Trending',
iconColor: Colors.white, iconColor: isDarkMode ? Colors.white : Colors.black,
textStyle: TextStyle( textStyle: const TextStyle(
fontWeight: FontWeight.w900, fontWeight: FontWeight.w900,
color: Colors.white, color: Colors.white,
fontSize: 11, fontSize: 11,
@ -137,8 +139,8 @@ class _HomePageState extends ConsumerState<HomePage> {
GButton( GButton(
icon: Icons.search, icon: Icons.search,
text: 'Search', text: 'Search',
iconColor: Colors.white, iconColor: isDarkMode ? Colors.white : Colors.black,
textStyle: TextStyle( textStyle: const TextStyle(
fontWeight: FontWeight.w900, fontWeight: FontWeight.w900,
color: Colors.white, color: Colors.white,
fontSize: 11, fontSize: 11,
@ -147,8 +149,8 @@ class _HomePageState extends ConsumerState<HomePage> {
GButton( GButton(
icon: Icons.collections_bookmark, icon: Icons.collections_bookmark,
text: 'My Library', text: 'My Library',
iconColor: Colors.white, iconColor: isDarkMode ? Colors.white : Colors.black,
textStyle: TextStyle( textStyle: const TextStyle(
fontWeight: FontWeight.w900, fontWeight: FontWeight.w900,
color: Colors.white, color: Colors.white,
fontSize: 11, fontSize: 11,
@ -157,8 +159,8 @@ class _HomePageState extends ConsumerState<HomePage> {
GButton( GButton(
icon: Icons.build, icon: Icons.build,
text: 'Settings', text: 'Settings',
iconColor: Colors.white, iconColor: isDarkMode ? Colors.white : Colors.black,
textStyle: TextStyle( textStyle: const TextStyle(
fontWeight: FontWeight.w900, fontWeight: FontWeight.w900,
color: Colors.white, color: Colors.white,
fontSize: 11, fontSize: 11,