refactor(ui): Update some UI and fix some bugs

This commit is contained in:
anhtunz
2025-01-11 16:43:19 +07:00
parent c2c685da86
commit a17831d0ac
16 changed files with 688 additions and 464 deletions

View File

@@ -8,6 +8,8 @@ import 'package:go_router/go_router.dart';
// import 'package:persistent_bottom_nav_bar_v2/persistent-tab-view.dart';
import 'package:badges/badges.dart' as badges;
import 'package:persistent_bottom_nav_bar/persistent_bottom_nav_bar.dart';
import '../settings/profile/profile_model.dart';
import '../../product/extention/context_extention.dart';
import '../../bloc/home_bloc.dart';
import '../../product/constant/app/app_constants.dart';
import '../../product/constant/enums/app_route_enums.dart';
@@ -75,6 +77,7 @@ class _MainScreenState extends State<MainScreen> with WidgetsBindingObserver {
WidgetsBinding.instance.addObserver(this);
initialCheck();
getBellNotification();
mainBloc.getUserProfile();
}
@override
@@ -176,36 +179,21 @@ class _MainScreenState extends State<MainScreen> with WidgetsBindingObserver {
builder: (context, themeModeSnapshot) {
return Scaffold(
appBar: AppBar(
title: StreamBuilder<User>(
stream: mainBloc.streamUserProfile,
builder: (context, userSnapshot) {
return Row(
children: [
IconConstants.instance.getMaterialIcon(Icons.person),
SizedBox(
width: context.lowValue,
),
Text(userSnapshot.data?.name ?? "")
],
);
}),
backgroundColor: Colors.transparent,
actions: [
// LightDarkSwitch(
// value: !isLight,
// onChanged: (value) {
// themeNotifier.changeTheme();
// isLight = !isLight;
// },
// ),
// SizedBox(
// width: context.lowValue,
// ),
// StreamBuilder<bool>(
// stream: mainBloc.streamIsVNIcon,
// builder: (context, isVNSnapshot) {
// return LanguageSwitch(
// value: isVNSnapshot.data ?? isVN,
// onChanged: (value) async {
// Locale locale = await LanguageServices().setLocale(isVN
// ? LanguageConstants.ENGLISH
// : LanguageConstants.VIETNAM);
// MyApp.setLocale(context, locale);
// isVN = !isVN;
// mainBloc.sinkIsVNIcon.add(isVN);
// },
// );
// }),
// SizedBox(
// width: context.lowValue,
// ),
IconButton(
onPressed: () async {
ThemeData newTheme = await ThemeServices().changeTheme(
@@ -337,11 +325,9 @@ class _MainScreenState extends State<MainScreen> with WidgetsBindingObserver {
controller: controller,
screens: _buildScreens(),
items: _navBarsItems(),
// confineInSafeArea: true,
handleAndroidBackButtonPress: true,
resizeToAvoidBottomInset: true,
stateManagement: true,
// hideNavigationBarWhenKeyboardShows: true,
backgroundColor:
themeModeSnapshot.data! ? Colors.white : Colors.black,
decoration: NavBarDecoration(
@@ -349,17 +335,18 @@ class _MainScreenState extends State<MainScreen> with WidgetsBindingObserver {
colorBehindNavBar:
themeModeSnapshot.data! ? Colors.white : Colors.black,
),
// popAllScreensOnTapOfSelectedTab: true,
// itemAnimationProperties: const ItemAnimationProperties(
// duration: Duration(milliseconds: 200),
// curve: Curves.bounceInOut,
// ),
// screenTransitionAnimation: const ScreenTransitionAnimation(
// animateTabTransition: true,
// curve: Curves.linear,
// duration: Duration(milliseconds: 200),
// ),
navBarStyle: NavBarStyle.style4,
animationSettings: const NavBarAnimationSettings(
navBarItemAnimation: ItemAnimationSettings(
duration: Duration(milliseconds: 200),
curve: Curves.bounceInOut,
),
screenTransitionAnimation: ScreenTransitionAnimationSettings(
animateTabTransition: true,
curve: Curves.bounceInOut,
duration: Duration(milliseconds: 200),
),
),
navBarStyle: NavBarStyle.style13,
),
);
},