import 'package:flutter/material.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/login_tips_dialog.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import '../../data/social_info.dart'; import '../../data/user_info.dart'; class MineNavbar extends StatefulWidget { final String? couponNum; final UserInfo? userInfo; final SocialInfo? infoNumber; final GestureTapCallback toIntegralPage; final Function queryCoupon; MineNavbar(this.couponNum,this.userInfo,this.infoNumber,this.toIntegralPage,this.queryCoupon); @override State createState() { return _MineNavbar(); } } class _MineNavbar extends State { @override Widget build(BuildContext context) { return Container( margin: EdgeInsets.fromLTRB(13.5.w, 15.h, 13.5.w,30.h), padding: EdgeInsets.only( top: 26.h, bottom: 24.h, ), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(6), boxShadow: [ BoxShadow( color: Color(0x08213303).withAlpha(12), offset: Offset(0, 2), blurRadius: 4, spreadRadius: 0, ), ], ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( children: [ ///订单 Expanded( child: InkWell( onTap: () { SharedPreferences.getInstance().then((value) { if (value.getString("token") == null || value.getString("token") == "") { LoginTipsDialog().show(context); return; } Navigator.of(context).pushNamed( '/router/order_history_page', arguments: {"status": 0}); }); }, child: mineTopItem( S.of(context).dingdan, "assets/image/mine_order.webp", ), ), ), ///钱包 Expanded( child: InkWell( onTap: () { SharedPreferences.getInstance().then((value) { if (value.getString("token") == null || value.getString("token") == "") { LoginTipsDialog().show(context); return; } Navigator.of(context).pushNamed('/router/mine_wallet'); }); }, child: mineTopItem( S.of(context).qianbao, "assets/image/wallet.webp", ), ), ), ///会员码 Expanded( child: InkWell( onTap: () { SharedPreferences.getInstance().then((value) { if (value.getString("token") == null || value.getString("token") == "") { LoginTipsDialog().show(context); return; } Navigator.of(context).pushNamed('/router/vip_pay_code'); }); }, child: mineTopItem( S.of(context).huiyuanma, "assets/image/vip_code.webp", ), ), ), ///设置 Expanded( child: InkWell( onTap: () { SharedPreferences.getInstance().then((value) { if (value.getString("token") == null || value.getString("token") == "") { LoginTipsDialog().show(context); return; } Navigator.of(context).pushNamed('/router/setting_page'); }); }, child: mineTopItem( S.of(context).shezhi, "assets/image/set.webp", ), ), ), ], ), Container( width: double.infinity, margin: EdgeInsets.only(top:17.h,left: 16.w,right: 16.w,bottom: 27.h), child: Flex( children: List.generate(120, (_) { return SizedBox( width: 1, height: 1, child: DecoratedBox( decoration: BoxDecoration(color: Color(0xFFEDEDED)), ), ); }), mainAxisAlignment: MainAxisAlignment.spaceBetween, direction: Axis.horizontal, ), ), Row( children: [ ///优惠券 Expanded( child: InkWell( onTap: () { SharedPreferences.getInstance().then((value) { if (value.getString("token") == null || value.getString("token") == "") { LoginTipsDialog().show(context); return; } Navigator.of(context).pushNamed('/router/coupon_page'); widget.queryCoupon(); }); }, child: mineBottomItem( widget.couponNum ?? "0", S.of(context).youhuiquan, ), ), ), ///积分 Expanded( child: InkWell( onTap: () { // SharedPreferences.getInstance().then((value) { // if (value.getString("token") == null || // value.getString("token") == "") { // LoginTipsDialog().show(context); // return; // } // widget.toIntegralPage(); // }); }, child: mineBottomItem( widget.userInfo?.points ?? "0", S.of(context).jifen, ), ), ), ///关注 Expanded( child: InkWell( onTap: () { SharedPreferences.getInstance().then((value) { if (value.getString("token") == null || value.getString("token") == "") { LoginTipsDialog().show(context); return; } Navigator.of(context).pushNamed('/router/communityFollow',arguments: { "status":0 }); });}, child: mineBottomItem( "${widget.infoNumber?.follow ?? "0"}", S.of(context).guanzhu, ), ), ), ///粉丝 Expanded( child: InkWell( onTap: () { SharedPreferences.getInstance().then((value) { if (value.getString("token") == null || value.getString("token") == "") { LoginTipsDialog().show(context); return; } Navigator.of(context).pushNamed('/router/communityFollow',arguments: { "status":1 }); }); }, child: mineBottomItem( "${widget.infoNumber?.fans ?? "0"}", S.of(context).fensi, ), ), ), ///集换卡 Expanded( child: InkWell( onTap: () { SharedPreferences.getInstance().then((value) { if (value.getString("token") == null || value.getString("token") == "") { LoginTipsDialog().show(context); return; } Navigator.of(context).pushNamed('/router/trading_card_page'); }); }, child: mineBottomItem( widget.userInfo?.happyBean ?? "0", S.of(context).yinzhang, ), ), ), ], ), ], ), ); } ///导航栏条目 Widget mineTopItem(text, icon) { return Container( color: Colors.white, margin: EdgeInsets.symmetric(vertical: 6.h), child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ Image.asset( icon, width: 23, height: 23, ), SizedBox( height: 5.h, ), Text( text, style: TextStyle( fontWeight: MyFontWeight.semi_bold, fontSize: 12.sp, color: Color(0xFF0D0D0D), ), ), ], ), ); } ///导航栏条目 Widget mineBottomItem(textTop, text) { return Container( color: Colors.white, margin: EdgeInsets.symmetric(vertical: 6.h), child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ Text( textTop, style: TextStyle( fontWeight: MyFontWeight.medium, fontSize: 18.sp, color: Color(0xFF000000), ), ), SizedBox( height:11.h, ), Text( text, style: TextStyle( fontWeight: MyFontWeight.medium, fontSize: 12.sp, color: Color(0xFF4D4D4D), ), ), ], ), ); } }