You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

318 lines
9.7 KiB

import 'package:flutter/material.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/utils/shared_preference.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<StatefulWidget> createState() {
return _MineNavbar();
}
}
class _MineNavbar extends State<MineNavbar> {
@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.symmetric(
horizontal: 13.5.w,
vertical: 15.h,
2 weeks ago
),
padding: EdgeInsets.only(
top: 26,
bottom: 24,
),
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: () {
if (SharedInstance.instance.token.isEmpty) {
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: () {
if (SharedInstance.instance.token.isEmpty) {
LoginTipsDialog().show(context);
return;
}
Navigator.of(context).pushNamed('/router/mine_wallet');
},
child: mineTopItem(
1 year ago
S.of(context).qianbao,
"assets/image/wallet.webp",
),
),
),
///会员码
Expanded(
child: InkWell(
onTap: () {
if (SharedInstance.instance.token.isEmpty) {
LoginTipsDialog().show(context);
return;
}
Navigator.of(context).pushNamed('/router/vip_pay_code');
},
child: mineTopItem(
1 year ago
S.of(context).huiyuanma,
"assets/image/vip_code.webp",
),
),
),
///设置
Expanded(
child: InkWell(
onTap: () {
if (SharedInstance.instance.token.isEmpty) {
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,
2 weeks ago
margin: EdgeInsets.symmetric(
vertical: 12,
horizontal: 15,
),
child: LayoutBuilder(
builder: (BuildContext context, BoxConstraints constraints) {
double width = constraints.constrainWidth();
return Flex(
children: List.generate(width ~/ 4, (_) {
return Container(
width: 2,
height: 1,
margin: EdgeInsets.symmetric(
horizontal: 1,
),
child: DecoratedBox(
decoration: BoxDecoration(
color: Color(0xFFEDEDED),
),
),
);
}),
mainAxisAlignment: MainAxisAlignment.spaceBetween,
direction: Axis.horizontal,
);
2 weeks ago
}
),
),
Row(
children: [
///优惠券
Expanded(
child: InkWell(
onTap: () {
if (SharedInstance.instance.token.isEmpty) {
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: () {
// if (SharedInstance.instance.token.isEmpty) {
// LoginTipsDialog().show(context);
// return;
// }
// widget.toIntegralPage();
},
child: mineBottomItem(
widget.userInfo?.points ?? "0",
1 year ago
S.of(context).jifen,
),
),
),
///关注
Expanded(
child: InkWell(
onTap: () {
if (SharedInstance.instance.token.isEmpty) {
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: () {
if (SharedInstance.instance.token.isEmpty) {
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: () {
if (SharedInstance.instance.token.isEmpty) {
LoginTipsDialog().show(context);
return;
}
Navigator.of(context).pushNamed('/router/trading_card_page');
},
child: mineBottomItem(
widget.userInfo?.happyBean ?? "0",
1 year ago
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),
),
),
],
),
);
}
}