底部导航栏重构

开门码隐藏名字
pull/1/head
张萌 3 years ago
parent 8748a649a1
commit 4c1ec3079e

@ -130,23 +130,23 @@ class _OpeningCodePageState extends State<OpeningCodePage> {
child: Column( child: Column(
children: [ children: [
107.hb, 107.hb,
Container( // Container(
width: 192.w, // width: 192.w,
height: 42.w, // height: 42.w,
decoration: BoxDecoration( // decoration: BoxDecoration(
color: Colors.black.withOpacity(0.06), // color: Colors.black.withOpacity(0.06),
borderRadius: // borderRadius:
BorderRadius.circular(45.w)), // BorderRadius.circular(45.w)),
alignment: Alignment.center, // alignment: Alignment.center,
child: Text( // child: Text(
UserTool.userProvider.userInfoModel! // UserTool.userProvider.userInfoModel!
.nickName ?? // .nickName ??
"", // "",
style: TextStyle( // style: TextStyle(
color: Colors.black, fontSize: 24.sp), // color: Colors.black, fontSize: 24.sp),
), // ),
), // ),
48.hb, // 48.hb,
Text( Text(
'2栋 1单元 1402室', '2栋 1单元 1402室',
style: TextStyle( style: TextStyle(

@ -1,11 +1,12 @@
import 'package:aku_new_community/const/resource.dart';
import 'package:aku_new_community/gen/assets.gen.dart'; import 'package:aku_new_community/gen/assets.gen.dart';
import 'package:aku_new_community/pages/opening_code_page/opening_code_page.dart';
import 'package:aku_new_community/pages/sign/login/other_login_page.dart'; import 'package:aku_new_community/pages/sign/login/other_login_page.dart';
import 'package:aku_new_community/provider/app_provider.dart'; import 'package:aku_new_community/provider/app_provider.dart';
import 'package:aku_new_community/ui/community/community_views/community_page.dart'; import 'package:aku_new_community/ui/community/community_views/community_page.dart';
import 'package:aku_new_community/ui/market/market_page.dart'; import 'package:aku_new_community/ui/market/market_page.dart';
import 'package:aku_new_community/utils/websocket/web_socket_util.dart'; import 'package:aku_new_community/utils/websocket/web_socket_util.dart';
import 'package:aku_new_community/widget/bee_scaffold.dart'; import 'package:aku_new_community/widget/bee_scaffold.dart';
import 'package:aku_new_community/widget/dialog/certification_dialog.dart';
import 'package:aku_new_community/widget/others/user_tool.dart'; import 'package:aku_new_community/widget/others/user_tool.dart';
import 'package:bot_toast/bot_toast.dart'; import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -48,6 +49,7 @@ class _TabNavigatorState extends State<TabNavigator>
HomePage(), HomePage(),
MarketPage(), MarketPage(),
// PropertyPage(), // PropertyPage(),
OpeningCodePage(),
CommunityPage(), CommunityPage(),
PersonalIndex() PersonalIndex()
]; ];
@ -56,51 +58,123 @@ class _TabNavigatorState extends State<TabNavigator>
length: _pages.length, vsync: this, initialIndex: widget.index ?? 0); length: _pages.length, vsync: this, initialIndex: widget.index ?? 0);
} }
_buildBottomBar( Widget _buildBottomBar(
String title, String title,
String unselected, String unselected,
String selected, String selected,
int index,
) { ) {
return BottomNavigationBarItem( return Expanded(
icon: Image.asset( child: GestureDetector(
onTap: () {
if (UserTool.userProvider.isLogin == false) {
//
Get.offAll(() => OtherLoginPage());
} else {
_tabController!.animateTo(index, curve: Curves.easeInOutCubic);
_currentIndex = index;
setState(() {});
}
},
child: Material(
color: Colors.transparent,
child: Container(
alignment: Alignment.center,
margin: EdgeInsets.only(top: 48.w),
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: [
_currentIndex != index
? Image.asset(
unselected, unselected,
height: 44.w, height: 44.w,
width: 44.w, width: 44.w,
color: Colors.black38, color: Colors.black38,
), )
activeIcon: Image.asset( : Image.asset(
selected, selected,
height: 44.w, height: 44.w,
width: 44.w, width: 44.w,
), ),
label: title, Text(
title,
style: TextStyle(
color: _currentIndex != index
? Color(0xFFA6ABB1)
: Color(0xFF333333),
fontWeight: _currentIndex == index
? FontWeight.bold
: FontWeight.normal,
fontSize: 22.sp),
)
],
)),
),
),
); );
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
// //
List<BottomNavigationBarItem> _bottomNav = <BottomNavigationBarItem>[ List<Widget> _bottomNav = <Widget>[
_buildBottomBar( _buildBottomBar(
'首页', '首页',
Assets.home.icShouyeNor.path, Assets.home.icShouyeNor.path,
Assets.home.icShouyeSel.path, Assets.home.icShouyeSel.path,
0,
), ),
_buildBottomBar( _buildBottomBar(
'商城', '商城',
R.ASSETS_ICONS_TABBAR_MARKET_NO_PNG, Assets.home.icShangcNor.path,
R.ASSETS_ICONS_TABBAR_MARKET_PNG, Assets.home.icShangcSel.path,
1,
),
Expanded(
child: GestureDetector(
onTap: () {
if (UserTool.userProvider.isLogin == false) {
//
Get.offAll(() => OtherLoginPage());
} else {}
if (UserTool.userProvider.userInfoModel?.name == null) {
Get.dialog(CertificationDialog());
} else {
_tabController!.animateTo(2, curve: Curves.easeInOutCubic);
_currentIndex = 2;
setState(() {});
}
},
child: Material(
color: Colors.transparent,
child: Center(
child: Container(
width: 108.w,
height: 108.w,
margin: EdgeInsets.only(top: 26.w),
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(54.w),
color: Color(0xFFFDE019),
),
child: Assets.home.icKaimen.image(width: 80.w, height: 80.w),
),
),
),
),
), ),
BottomNavigationBarItem(icon: Container()),
_buildBottomBar( _buildBottomBar(
'社区', '社区',
Assets.home.icShequNor.path, Assets.home.icShequNor.path,
Assets.home.icShequSel.path, Assets.home.icShequSel.path,
3,
), ),
_buildBottomBar( _buildBottomBar(
'我的', '我的',
Assets.home.icWodeNor.path, Assets.home.icWodeNor.path,
Assets.home.icWodeSel.path, Assets.home.icWodeSel.path,
4,
), ),
]; ];
return BeeScaffold( return BeeScaffold(
@ -123,24 +197,21 @@ class _TabNavigatorState extends State<TabNavigator>
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
), ),
), ),
bottomNavi: StatefulBuilder(builder: (context, setFunc) { bottomNavi: ConstrainedBox(
return BottomNavigationBar( constraints: BoxConstraints(maxWidth: 750.w, maxHeight: 146.w),
items: _bottomNav, child: Container(
backgroundColor: Colors.white, margin:
currentIndex: _currentIndex, EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
selectedFontSize: 20.sp, decoration: BoxDecoration(
unselectedFontSize: 20.sp, image: DecorationImage(
onTap: (index) { image: Assets.home.imgTabdi, fit: BoxFit.fitWidth),
if (UserTool.userProvider.isLogin == false) { color: Colors.transparent),
// child: Row(
Get.offAll(() => OtherLoginPage()); crossAxisAlignment: CrossAxisAlignment.center,
} else { children: _bottomNav.cast<Widget>().toList(),
_tabController!.animateTo(index, curve: Curves.easeInOutCubic); ),
setFunc(() => _currentIndex = index); ),
} ),
},
);
}),
); );
} }
} }

Loading…
Cancel
Save