|
|
|
import 'dart:convert';
|
|
|
|
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
|
|
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
|
|
|
import 'package:huixiang/generated/l10n.dart';
|
|
|
|
import 'package:huixiang/main.dart';
|
|
|
|
import 'package:huixiang/retrofit/data/base_data.dart';
|
|
|
|
import 'package:huixiang/retrofit/data/rank.dart';
|
|
|
|
import 'package:huixiang/retrofit/data/user_info.dart';
|
|
|
|
import 'package:huixiang/retrofit/retrofit_api.dart';
|
|
|
|
import 'package:huixiang/utils/event_type.dart';
|
|
|
|
import 'package:huixiang/utils/font_weight.dart';
|
|
|
|
import 'package:huixiang/view_widget/classic_header.dart';
|
|
|
|
import 'package:huixiang/view_widget/custom_image.dart';
|
|
|
|
import 'package:huixiang/view_widget/login_tips.dart';
|
|
|
|
import 'package:huixiang/view_widget/mine_vip_view.dart';
|
|
|
|
import 'package:pull_to_refresh/pull_to_refresh.dart';
|
|
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
|
|
import 'package:dio/dio.dart';
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
|
|
|
|
class MinePage extends StatefulWidget {
|
|
|
|
@override
|
|
|
|
State<StatefulWidget> createState() {
|
|
|
|
return _MinePage();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
|
|
|
|
ApiService apiService;
|
|
|
|
UserInfo userinfo;
|
|
|
|
int rankLevel = 1;
|
|
|
|
List<Rank> ranks = [];
|
|
|
|
final RefreshController _refreshController = RefreshController();
|
|
|
|
|
|
|
|
_toUserInfo() async {
|
|
|
|
SharedPreferences shared = await SharedPreferences.getInstance();
|
|
|
|
if (shared.getString("token") == null || shared.getString("token") == "") {
|
|
|
|
Navigator.of(context)
|
|
|
|
.pushNamed('/router/login_page', arguments: {"login": "login"});
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
await Navigator.of(context).pushNamed('/router/user_info_page');
|
|
|
|
setState(() {});;
|
|
|
|
}
|
|
|
|
|
|
|
|
loginTips() {
|
|
|
|
SmartDialog.show(
|
|
|
|
widget: LoginTips(
|
|
|
|
click: () {
|
|
|
|
SharedPreferences.getInstance()
|
|
|
|
.then((value) => value..setString("token", ""));
|
|
|
|
Navigator.of(context)
|
|
|
|
.pushNamed('/router/login_page', arguments: {"login": "login"});
|
|
|
|
},
|
|
|
|
),
|
|
|
|
clickBgDismissTemp: false,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
void dispose() {
|
|
|
|
super.dispose();
|
|
|
|
_refreshController.dispose();
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
|
|
|
|
eventBus.on<EventType>().listen((event) {
|
|
|
|
print("EventType: ${event.type}");
|
|
|
|
if (event.type < 3) {
|
|
|
|
setState(() {});
|
|
|
|
}
|
|
|
|
if (event.type == 3) {
|
|
|
|
setState(() {});;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
queryUserInfo() async {
|
|
|
|
EasyLoading.show(status: S.of(context).zhengzaijiazai);
|
|
|
|
|
|
|
|
final SharedPreferences value = await SharedPreferences.getInstance();
|
|
|
|
if (value.containsKey('user') &&
|
|
|
|
value.getString('user') != null &&
|
|
|
|
value.getString('user') != "") {
|
|
|
|
userinfo = UserInfo.fromJson(jsonDecode(value.getString('user')));
|
|
|
|
}
|
|
|
|
apiService = ApiService(Dio(), context: context,
|
|
|
|
token: value.getString('token'), showLoading: false);
|
|
|
|
|
|
|
|
BaseData<List<Rank>> rankData = await apiService.rankList();
|
|
|
|
if (rankData != null && rankData.isSuccess) {
|
|
|
|
ranks.clear();
|
|
|
|
ranks.addAll(rankData.data);
|
|
|
|
}
|
|
|
|
|
|
|
|
BaseData<UserInfo> baseDate = await apiService.queryInfo();
|
|
|
|
if (baseDate != null && baseDate.isSuccess) {
|
|
|
|
userinfo = baseDate.data;
|
|
|
|
if (userinfo != null &&
|
|
|
|
userinfo.memberRankVo != null &&
|
|
|
|
ranks != null &&
|
|
|
|
ranks.length > 0) {
|
|
|
|
rankLevel = (ranks.indexWhere(
|
|
|
|
(element) => element.id == userinfo.memberRankVo.id) +
|
|
|
|
1);
|
|
|
|
}
|
|
|
|
SharedPreferences.getInstance().then(
|
|
|
|
(value) => {
|
|
|
|
value.setString('user', jsonEncode(baseDate.data)),
|
|
|
|
},
|
|
|
|
);
|
|
|
|
_refreshController.refreshCompleted();
|
|
|
|
} else {
|
|
|
|
_refreshController.refreshFailed();
|
|
|
|
}
|
|
|
|
EasyLoading.dismiss();
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
super.build(context);
|
|
|
|
return Scaffold(
|
|
|
|
backgroundColor: Color(0xFFF7F7F7),
|
|
|
|
body: Container(
|
|
|
|
padding: EdgeInsets.only(bottom: 76.h),
|
|
|
|
margin: EdgeInsets.only(top: 40.h),
|
|
|
|
child: SmartRefresher(
|
|
|
|
controller: _refreshController,
|
|
|
|
enablePullDown: true,
|
|
|
|
enablePullUp: false,
|
|
|
|
header: MyHeader(),
|
|
|
|
physics: BouncingScrollPhysics(),
|
|
|
|
onRefresh: () {
|
|
|
|
// queryUserInfo
|
|
|
|
setState(() {});
|
|
|
|
},
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
child: Container(
|
|
|
|
child: Stack(
|
|
|
|
alignment: Alignment.centerRight,
|
|
|
|
children: [
|
|
|
|
FutureBuilder(
|
|
|
|
future: queryUserInfo(),
|
|
|
|
builder: (context, snapshot) {
|
|
|
|
return Column(
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
margin: EdgeInsets.only(right: 16.w),
|
|
|
|
alignment: Alignment.centerRight,
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
children: [
|
|
|
|
// Container(
|
|
|
|
// margin: EdgeInsets.all(8.h),
|
|
|
|
// child: Image.asset(
|
|
|
|
// "assets/image/icon_notices.png",
|
|
|
|
// width: 24.w,
|
|
|
|
// height: 24.h,
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
InkWell(
|
|
|
|
onTap: () {},
|
|
|
|
child: Container(
|
|
|
|
margin: EdgeInsets.all(8.h),
|
|
|
|
child: Image.asset(
|
|
|
|
"assets/image/icon_scan_qr_code.png",
|
|
|
|
width: 24.w,
|
|
|
|
height: 24.h,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
InkWell(
|
|
|
|
onTap: _toUserInfo,
|
|
|
|
child: mineView(),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
height: 22.h,
|
|
|
|
),
|
|
|
|
GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
SharedPreferences.getInstance().then((value) {
|
|
|
|
if (value.getString("token") == null ||
|
|
|
|
value.getString("token") == "") {
|
|
|
|
loginTips();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
Navigator.of(context).pushNamed(
|
|
|
|
'/router/mine_vip_level_page',
|
|
|
|
arguments: {
|
|
|
|
"rankLevel": rankLevel,
|
|
|
|
"createTime": (userinfo != null)
|
|
|
|
? "${userinfo.createTime}"
|
|
|
|
: "",
|
|
|
|
"points": (userinfo != null)
|
|
|
|
? int.tryParse(userinfo.points)
|
|
|
|
: 0,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
child: Hero(
|
|
|
|
tag: "vip",
|
|
|
|
child: MineVipView(
|
|
|
|
rankLevel,
|
|
|
|
curLevel: rankLevel,
|
|
|
|
rank: (userinfo != null)
|
|
|
|
? int.tryParse(userinfo.points)
|
|
|
|
: 0,
|
|
|
|
rankMax: (userinfo != null &&
|
|
|
|
userinfo.memberRankVo != null)
|
|
|
|
? userinfo.memberRankVo.rankOrigin
|
|
|
|
: 0,
|
|
|
|
createTime: (userinfo != null)
|
|
|
|
? userinfo.createTime
|
|
|
|
: "",
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
orderOrCard(),
|
|
|
|
mineList(context),
|
|
|
|
],
|
|
|
|
);
|
|
|
|
}),
|
|
|
|
// buildNotice(),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
///横向的提示
|
|
|
|
Widget buildNotice() {
|
|
|
|
return Container(
|
|
|
|
margin: EdgeInsets.only(top: 130.h),
|
|
|
|
child: Stack(
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
height: 33.h,
|
|
|
|
margin: EdgeInsets.only(left: 12.w),
|
|
|
|
padding: EdgeInsets.only(left: 16.w),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Colors.white,
|
|
|
|
boxShadow: [
|
|
|
|
BoxShadow(
|
|
|
|
color: Colors.black.withAlpha(25),
|
|
|
|
offset: Offset(0, 1),
|
|
|
|
blurRadius: 12,
|
|
|
|
spreadRadius: 0,
|
|
|
|
)
|
|
|
|
],
|
|
|
|
borderRadius: BorderRadius.only(
|
|
|
|
topLeft: Radius.circular(2),
|
|
|
|
bottomLeft: Radius.circular(2),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
S.of(context).ninyouyigedingdanyaolingqu,
|
|
|
|
style: TextStyle(
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
fontSize: 12.sp,
|
|
|
|
color: Colors.black),
|
|
|
|
),
|
|
|
|
Icon(
|
|
|
|
Icons.keyboard_arrow_right,
|
|
|
|
color: Colors.black,
|
|
|
|
size: 16,
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
margin: EdgeInsets.only(top: 5.h, bottom: 4.h),
|
|
|
|
padding: EdgeInsets.all(2),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Colors.white,
|
|
|
|
boxShadow: [
|
|
|
|
BoxShadow(
|
|
|
|
color: Colors.black.withAlpha(25),
|
|
|
|
offset: Offset(0, 1),
|
|
|
|
blurRadius: 12,
|
|
|
|
spreadRadius: 0,
|
|
|
|
)
|
|
|
|
],
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
// borderRadius: BorderRadius.all(Radius.circular(2)),
|
|
|
|
),
|
|
|
|
child: Image.asset(
|
|
|
|
"assets/image/icon_mine_motorcycle.png",
|
|
|
|
width: 20.w,
|
|
|
|
height: 20.h,
|
|
|
|
fit: BoxFit.contain,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
///我的下面的条目列表
|
|
|
|
Widget mineList(BuildContext context) {
|
|
|
|
return Container(
|
|
|
|
margin: EdgeInsets.fromLTRB(16.w, 10.h, 16.w, 28.h),
|
|
|
|
padding: EdgeInsets.fromLTRB(20.w, 12.h, 20.w, 12.h),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Colors.white,
|
|
|
|
borderRadius: BorderRadius.circular(8),
|
|
|
|
boxShadow: [
|
|
|
|
BoxShadow(
|
|
|
|
color: Colors.black.withAlpha(12),
|
|
|
|
offset: Offset(0, 3),
|
|
|
|
blurRadius: 14,
|
|
|
|
spreadRadius: 0,
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
InkWell(
|
|
|
|
onTap: () {
|
|
|
|
SharedPreferences.getInstance().then((value) {
|
|
|
|
if (value.getString("token") == null ||
|
|
|
|
value.getString("token") == "") {
|
|
|
|
loginTips();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
Navigator.of(context).pushNamed('/router/mine_wallet');
|
|
|
|
});
|
|
|
|
},
|
|
|
|
child: mineItem(
|
|
|
|
S.of(context).wodeqianbao,
|
|
|
|
"assets/image/icon_mine_wallet.png",
|
|
|
|
),
|
|
|
|
),
|
|
|
|
InkWell(
|
|
|
|
onTap: () {
|
|
|
|
SharedPreferences.getInstance().then((value) {
|
|
|
|
if (value.getString("token") == null ||
|
|
|
|
value.getString("token") == "") {
|
|
|
|
loginTips();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
Navigator.of(context)
|
|
|
|
.pushNamed('/router/exchange_history_page');
|
|
|
|
});
|
|
|
|
},
|
|
|
|
child: mineItem(
|
|
|
|
S.of(context).duihuanlishi,
|
|
|
|
"assets/image/icon_mine_records_of_consumption.png",
|
|
|
|
),
|
|
|
|
),
|
|
|
|
InkWell(
|
|
|
|
onTap: () {
|
|
|
|
SharedPreferences.getInstance().then((value) {
|
|
|
|
if (value.getString("token") == null ||
|
|
|
|
value.getString("token") == "") {
|
|
|
|
loginTips();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
Navigator.of(context).pushNamed('/router/roll_center_page');
|
|
|
|
});
|
|
|
|
},
|
|
|
|
child: mineItem(
|
|
|
|
S.of(context).lingquanzhongxin,
|
|
|
|
"assets/image/icon_mine_invoice_assistant.png",
|
|
|
|
),
|
|
|
|
),
|
|
|
|
InkWell(
|
|
|
|
onTap: () {
|
|
|
|
SharedPreferences.getInstance().then((value) {
|
|
|
|
if (value.getString("token") == null ||
|
|
|
|
value.getString("token") == "") {
|
|
|
|
loginTips();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
Navigator.of(context).pushNamed('/router/manage_address_page');
|
|
|
|
});
|
|
|
|
},
|
|
|
|
child: mineItem(
|
|
|
|
S.of(context).guanlidizhi,
|
|
|
|
"assets/image/icon_location_address.png",
|
|
|
|
),
|
|
|
|
),
|
|
|
|
InkWell(
|
|
|
|
onTap: () {
|
|
|
|
Navigator.of(context).pushNamed('/router/setting_page');
|
|
|
|
},
|
|
|
|
child: mineItem(
|
|
|
|
S.of(context).shezhi,
|
|
|
|
"assets/image/icon_mine_setting.png",
|
|
|
|
),
|
|
|
|
),
|
|
|
|
// mineItem(
|
|
|
|
// S.of(context).bangzhuyufankui,
|
|
|
|
// "assets/image/icon_mine_feedback.png",
|
|
|
|
// ),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
///我的页面下面条目
|
|
|
|
Widget mineItem(text, icon) {
|
|
|
|
return Container(
|
|
|
|
margin: EdgeInsets.only(top: 8.h, bottom: 8.h),
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Image.asset(
|
|
|
|
icon,
|
|
|
|
width: 28.w,
|
|
|
|
height: 28.h,
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
width: 12.w,
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
flex: 1,
|
|
|
|
child: Text(
|
|
|
|
text,
|
|
|
|
style: TextStyle(
|
|
|
|
fontWeight: MyFontWeight.medium,
|
|
|
|
fontSize: 16.sp,
|
|
|
|
color: Color(0xFF353535),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Icon(
|
|
|
|
Icons.keyboard_arrow_right,
|
|
|
|
size: 20,
|
|
|
|
color: Colors.black,
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
///订单或者卡包试图
|
|
|
|
Widget orderOrCard() {
|
|
|
|
return Container(
|
|
|
|
margin: EdgeInsets.fromLTRB(16.w, 12.h, 16.w, 10.h),
|
|
|
|
padding: EdgeInsets.fromLTRB(20.w, 12.h, 20.w, 12.h),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Colors.white,
|
|
|
|
borderRadius: BorderRadius.circular(8),
|
|
|
|
boxShadow: [
|
|
|
|
BoxShadow(
|
|
|
|
color: Colors.black.withAlpha(12),
|
|
|
|
offset: Offset(0, 3),
|
|
|
|
blurRadius: 14,
|
|
|
|
spreadRadius: 0,
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
flex: 1,
|
|
|
|
child: GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
SharedPreferences.getInstance().then((value) {
|
|
|
|
if (value.getString("token") == null ||
|
|
|
|
value.getString("token") == "") {
|
|
|
|
loginTips();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
Navigator.of(context).pushNamed('/router/mine_card');
|
|
|
|
});
|
|
|
|
},
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Image.asset(
|
|
|
|
"assets/image/icon_mine_card.png",
|
|
|
|
width: 32.w,
|
|
|
|
height: 32.h,
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
width: 12.w,
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
S.of(context).kaquan,
|
|
|
|
style: TextStyle(
|
|
|
|
fontWeight: MyFontWeight.medium,
|
|
|
|
fontSize: 16.sp,
|
|
|
|
color: Color(0xFF353535),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
width: 2.w,
|
|
|
|
height: 32.h,
|
|
|
|
margin: EdgeInsets.only(left: 20.w, right: 20.w),
|
|
|
|
color: Color(0xFFF7F7F7),
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
flex: 1,
|
|
|
|
child: GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
SharedPreferences.getInstance().then((value) {
|
|
|
|
if (value.getString("token") == null ||
|
|
|
|
value.getString("token") == "") {
|
|
|
|
loginTips();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
Navigator.of(context).pushNamed('/router/order_history_page');
|
|
|
|
});
|
|
|
|
},
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Image.asset(
|
|
|
|
"assets/image/icon_mine_order.png",
|
|
|
|
width: 32.w,
|
|
|
|
height: 32.h,
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
width: 12.w,
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
S.of(context).dingdan,
|
|
|
|
style: TextStyle(
|
|
|
|
fontWeight: MyFontWeight.medium,
|
|
|
|
fontSize: 16.sp,
|
|
|
|
color: Color(0xFF353535),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
///我的信息部分
|
|
|
|
Widget mineView() {
|
|
|
|
return Container(
|
|
|
|
alignment: Alignment.center,
|
|
|
|
margin: EdgeInsets.symmetric(horizontal: 16.w),
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
MImage(
|
|
|
|
userinfo == null ? "" : userinfo.headimg,
|
|
|
|
isCircle: true,
|
|
|
|
width: 50,
|
|
|
|
height: 50,
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
errorSrc: "assets/image/default_user.png",
|
|
|
|
fadeSrc: "assets/image/default_user.png",
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
width: 10.w,
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
flex: 1,
|
|
|
|
child: Container(
|
|
|
|
height: 50.h,
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
|
children: [
|
|
|
|
userinfo == null
|
|
|
|
? Text(
|
|
|
|
S.of(context).denglu,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 16.sp,
|
|
|
|
fontWeight: MyFontWeight.medium,
|
|
|
|
color: Color(0xFF353535),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
: Row(
|
|
|
|
children: [
|
|
|
|
InkWell(
|
|
|
|
onTap: () {
|
|
|
|
if (userinfo == null) {
|
|
|
|
SmartDialog.show(
|
|
|
|
widget: LoginTips(
|
|
|
|
click: () {
|
|
|
|
SharedPreferences.getInstance()
|
|
|
|
.then((value) => value.clear());
|
|
|
|
Navigator.of(context).pushNamed(
|
|
|
|
'/router/login_page',
|
|
|
|
arguments: {"login": "login"});
|
|
|
|
},
|
|
|
|
),
|
|
|
|
clickBgDismissTemp: false,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
child: Text(
|
|
|
|
userinfo == null
|
|
|
|
? S.of(context).denglu
|
|
|
|
: "${userinfo.nickname}",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 16.sp,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
color: Color(0xFF353535),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Image.asset(
|
|
|
|
"assets/image/icon_user.png",
|
|
|
|
width: 18.w,
|
|
|
|
height: 18.h,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
userinfo == null
|
|
|
|
? Text(
|
|
|
|
S.of(context).weidengluxinxi,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12.sp,
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
color: Color(0xFF2F2F2F),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
: Text(
|
|
|
|
userinfo == null ? "" : "NO.${userinfo.vipNo}",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12.sp,
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
color: Color(0xFF2F2F2F),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
userinfo == null
|
|
|
|
? Container(
|
|
|
|
alignment: Alignment.center,
|
|
|
|
height: 50.h,
|
|
|
|
child: Icon(
|
|
|
|
Icons.keyboard_arrow_right,
|
|
|
|
size: 20,
|
|
|
|
color: Colors.black,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
: Container(
|
|
|
|
alignment: Alignment.bottomRight,
|
|
|
|
height: 50.h,
|
|
|
|
child: GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
toIntegralPage();
|
|
|
|
},
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
S.of(context).jifenxiangqing,
|
|
|
|
style: TextStyle(
|
|
|
|
color: Colors.black,
|
|
|
|
fontSize: 12.sp,
|
|
|
|
fontWeight: MyFontWeight.semi_bold,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Icon(
|
|
|
|
Icons.keyboard_arrow_right,
|
|
|
|
size: 16,
|
|
|
|
color: Colors.black,
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
toIntegralPage() async {
|
|
|
|
SharedPreferences shared = await SharedPreferences.getInstance();
|
|
|
|
if (shared.getString("token") == null || shared.getString("token") == "") {
|
|
|
|
loginTips();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
await Navigator.of(context).pushNamed('/router/integral_page');
|
|
|
|
setState(() {});;
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
bool get wantKeepAlive => true;
|
|
|
|
}
|