improve: change main bottomNavigationBar widget

This commit is contained in:
Erfan Rahmati
2022-09-02 10:50:55 +04:30
parent 7974d283ee
commit 29464fef23
5 changed files with 69 additions and 88 deletions

View File

@ -1,6 +1,4 @@
import 'package:flutter/material.dart';
import 'package:flutter_phoenix/flutter_phoenix.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:get/get.dart';
import 'package:hive_flutter/adapters.dart';
import 'package:movielab/constants/themes.dart';
@ -21,7 +19,7 @@ void main() async {
await initializeHive();
await initializeGetX();
runApp(ProviderScope(child: Phoenix(child: const App())));
runApp(const App());
}
class App extends StatelessWidget {

View File

@ -5,7 +5,7 @@ import 'package:movielab/constants/types.dart';
setSystemUIOverlayStyle(
{required SystemUIOverlayStyle systemUIOverlayStyle,
Color color = kBackgroundColor}) {
Color color = kSecondaryColor}) {
if (systemUIOverlayStyle == SystemUIOverlayStyle.DARK) {
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
statusBarColor: Colors.transparent,

View File

@ -1,9 +1,8 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:movielab/constants/colors.dart';
import 'package:movielab/pages/main/main_controller.dart';
import 'package:google_nav_bar/google_nav_bar.dart';
import 'package:flashy_tab_bar2/flashy_tab_bar2.dart';
// Main pages:
import 'home/home_page.dart';
@ -19,60 +18,66 @@ class MainPage extends StatelessWidget {
return GetBuilder<MainController>(builder: (_) {
return Scaffold(
body: pages.elementAt(_.selectedIndex),
bottomNavigationBar: Container(
decoration: BoxDecoration(
color: kBackgroundColor,
boxShadow: [
BoxShadow(
blurRadius: 20,
color: Colors.black.withOpacity(.1),
)
],
),
child: SafeArea(
child: Padding(
padding:
const EdgeInsets.symmetric(horizontal: 22.5, vertical: 10),
child: GNav(
rippleColor: kBlueColor,
hoverColor: kBlueColor,
activeColor: CupertinoColors.activeBlue,
tabBackgroundColor: kBlueColor,
color: CupertinoColors.systemGrey,
gap: 5,
iconSize: 27,
textStyle: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w700,
color: CupertinoColors.activeBlue),
padding:
const EdgeInsets.symmetric(horizontal: 15, vertical: 10),
duration: const Duration(milliseconds: 400),
tabs: const [
GButton(
icon: Icons.home_max_rounded,
text: 'Home',
),
GButton(
icon: Icons.search_rounded,
text: 'Search',
),
GButton(
icon: Icons.bookmark_outline_rounded,
text: 'Lists',
),
GButton(
icon: Icons.podcasts_rounded,
text: 'Profile',
),
],
bottomNavigationBar: FlashyTabBar(
selectedIndex: _.selectedIndex,
onTabChange: (index) {
_.changeIndex(index);
},
animationCurve: Curves.linear,
showElevation: true,
backgroundColor: kSecondaryColor,
animationDuration: const Duration(milliseconds: 250),
iconSize: 27.5,
height: 70,
onItemSelected: (index) => _.changeIndex(index),
items: [
FlashyTabBarItem(
icon: const Icon(
Icons.home_max_rounded,
),
activeColor: Colors.white,
title: const Text(
'Home',
style: TextStyle(
fontSize: 15,
),
),
),
FlashyTabBarItem(
icon: const Icon(
Icons.search_rounded,
),
activeColor: Colors.white,
title: const Text(
'Search',
style: TextStyle(
fontSize: 15,
),
),
),
FlashyTabBarItem(
icon: const Icon(
Icons.bookmark_outline_rounded,
),
activeColor: Colors.white,
title: const Text(
'Lists',
style: TextStyle(
fontSize: 15,
),
),
),
FlashyTabBarItem(
icon: const Icon(
Icons.podcasts_rounded,
),
activeColor: Colors.white,
inactiveColor: const Color(0xff9496c1),
title: const Text(
'Profile',
style: TextStyle(
fontSize: 15,
),
),
),
],
),
);
});

View File

@ -267,6 +267,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.55.0"
flashy_tab_bar2:
dependency: "direct main"
description:
name: flashy_tab_bar2
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.4"
flutter:
dependency: "direct main"
description: flutter
@ -293,13 +300,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
flutter_phoenix:
dependency: "direct main"
description:
name: flutter_phoenix
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
flutter_plugin_android_lifecycle:
dependency: transitive
description:
@ -314,13 +314,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0"
flutter_riverpod:
dependency: "direct main"
description:
name: flutter_riverpod
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
flutter_slidable:
dependency: "direct main"
description:
@ -751,13 +744,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
riverpod:
dependency: transitive
description:
name: riverpod
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3"
rxdart:
dependency: transitive
description:
@ -966,13 +952,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.10.0"
state_notifier:
dependency: transitive
description:
name: state_notifier
url: "https://pub.dartlang.org"
source: hosted
version: "0.7.2+1"
stream_channel:
dependency: transitive
description:

View File

@ -36,7 +36,6 @@ dependencies:
http: ^0.13.4
cached_network_image: ^3.2.0
speech_to_text: ^5.6.0
flutter_riverpod: ^1.0.4
url_launcher: ^6.1.4
fl_chart: ^0.55.0
share_plus: ^4.0.10
@ -46,7 +45,7 @@ dependencies:
external_path: ^1.0.1
permission_handler: ^10.0.0
file_picker: ^5.0.1
flutter_phoenix: ^1.1.0
flashy_tab_bar2: ^0.0.4