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.
301 lines
9.5 KiB
301 lines
9.5 KiB
import 'package:flutter/cupertino.dart'; |
|
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 '../../retrofit/data/social_info.dart'; |
|
import '../../retrofit/data/user_info.dart'; |
|
|
|
class MineNavbar extends StatefulWidget { |
|
final String couponNum; |
|
final UserInfo userInfo; |
|
final SocialInfo infoNumber; |
|
final GestureTapCallback toIntegralPage; |
|
|
|
MineNavbar(this.couponNum,this.userInfo,this.infoNumber,this.toIntegralPage); |
|
|
|
@override |
|
State<StatefulWidget> createState() { |
|
return _MineNavbar(); |
|
} |
|
} |
|
|
|
class _MineNavbar extends State<MineNavbar> { |
|
@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( |
|
"钱包", |
|
"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( |
|
"会员码", |
|
"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'); |
|
}); |
|
}, |
|
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", |
|
"积分", |
|
), |
|
), |
|
), |
|
///关注 |
|
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, |
|
), |
|
), |
|
), |
|
], |
|
) |
|
], |
|
), |
|
); |
|
} |
|
|
|
///导航栏条目 |
|
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), |
|
), |
|
), |
|
], |
|
), |
|
); |
|
} |
|
}
|
|
|