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.

255 lines
8.1 KiB

import 'package:flutter/cupertino.dart';
3 years ago
import 'package:flutter/material.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/utils/font_weight.dart';
3 years ago
import 'package:huixiang/view_widget/login_tips_dialog.dart';
3 years ago
import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:url_launcher/url_launcher.dart';
3 years ago
class MineItem extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return _MineItem();
}
}
class _MineItem extends State<MineItem> {
@override
Widget build(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),
3 years ago
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(
3 years ago
crossAxisAlignment: CrossAxisAlignment.start,
3 years ago
children: [
3 years ago
Container(
padding: EdgeInsets.only(left: 16,top:16,bottom:4),
3 years ago
child: Text(
3 years ago
S.of(context).wodegongju,
3 years ago
style: TextStyle(
color: Color(0xFF353535),
fontWeight: MyFontWeight.semi_bold,
fontSize: 16.sp,
),
3 years ago
),
),
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/releasePage',
// arguments: {});
// });
// },
// child: mineItem(
// S.of(context).wodedongtai,
3 years ago
// "assets/image/dynamic.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/exchange_history_page');
});
},
child: mineItem(
S.of(context).duihuanlishi,
3 years ago
"assets/image/icon_mine_records_of_consumption.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_card');
});
},
child: mineItem(
S.of(context).wodekaquan,
3 years ago
"assets/image/icon_mine_card.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/manage_address_page');
});
},
child: mineItem(
S.of(context).guanlidizhi,
3 years ago
"assets/image/icon_location_address.webp",
),
),),
///联系客服
Expanded(child: InkWell(
onTap: () {
showCallMobile();
},
child: mineItem(
"联系客服",
"assets/image/icon_mine_online_service.webp",
),
),),
],
3 years ago
),
SizedBox(height: 10.h,),
Row(
children: [
Expanded(child:
InkWell(
onTap: () {
Navigator.of(context)
.pushNamed('/router/bargain_group_order',
arguments: {"type":3});
},
child: mineItem(
S.of(context).wodekanjia,
"assets/image/icon_mine_records_of_consumption.webp",
),
),),
Expanded(child: InkWell(
onTap: () {
Navigator.of(context).pushNamed('/router/bargain_group_order',
arguments: {"type":1});
},
child: mineItem(
S.of(context).wodepintuan,
"assets/image/kan_jia.webp",
),
),),
Expanded(child: InkWell(
onTap: () {
Navigator.of(context).pushNamed('/router/qr_share', arguments: {});
},
child: mineItem(
S.of(context).tuiguangma,
"assets/image/pin_tuan.webp",
),
),),
Expanded(child:InkWell(
onTap: () {
Navigator.of(context).pushNamed('/router/invitation_record', arguments: {});
},
child: mineItem(
"邀请记录",
"assets/image/yao_q.webp",
),
),),
],
),
SizedBox(height: 10.h,),
],
3 years ago
),
3 years ago
);
}
///我的页面下面条目
Widget mineItem(text, icon) {
return Container(
3 years ago
color: Colors.white,
margin: EdgeInsets.symmetric(vertical: 6.h),
child: Column(
3 years ago
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Image.asset(
icon,
width: 32.w,
height: 32.w,
3 years ago
),
SizedBox(
height: 2.h,
3 years ago
),
Text(
text,
style: TextStyle(
fontWeight: MyFontWeight.medium,
fontSize: 12.sp,
color: Color(0xFF353535),
3 years ago
),
),
],
),
);
}
showCallMobile() {
showCupertinoModalPopup(
context: context,
builder: (context) {
return CupertinoActionSheet(
title: Text(S.of(context).bodadianhua),
actions: [
CupertinoActionSheetAction(
child: Text("15392949097"),
onPressed: () {
callMobile("15392949097");
Navigator.of(context).pop();
},
isDefaultAction: true,
isDestructiveAction: false,
),
],
cancelButton: CupertinoActionSheetAction(
onPressed: () {
Navigator.of(context).pop();
},
child: Text(S.of(context).quxiao),
isDestructiveAction: true,
),
);
});
}
callMobile(mobile) async {
String url = "tel:$mobile";
if (await canLaunch(url)) {
await launch(url);
} else {
throw 'Could not launch $url';
}
}
3 years ago
}