1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252 |
- import 'dart:async';
- // import 'dart:html';
- import 'dart:io';
- import 'package:barcode_scan/barcode_scan.dart';
- import 'package:flustars/flustars.dart' as FlutterStars;
- import 'package:flutter/cupertino.dart';
- import 'package:flutter/material.dart';
- // import 'package:flutter_barcode_scanner/flutter_barcode_scanner.dart';
- import 'package:flutter/services.dart';
- import 'package:flutter_screenutil/flutter_screenutil.dart';
- import 'package:image_picker/image_picker.dart';
- import 'package:liftmanager/common/user_db.dart';
- import 'package:liftmanager/internal/account/model/user_info_entity.dart';
- import 'package:liftmanager/internal/account/provider/user_provider.dart';
- import 'package:liftmanager/internal/wode/page/reward_record_list.dart';
- import 'package:liftmanager/internal/wode/wode_router.dart';
- import 'package:liftmanager/net/api_service.dart';
- import 'package:liftmanager/res/colors.dart';
- import 'package:liftmanager/routers/fluro_navigator.dart';
- import 'package:liftmanager/utils/fast_notification.dart';
- import 'package:liftmanager/utils/toast.dart';
- import 'package:liftmanager/utils/utils.dart';
- import 'package:liftmanager/widgets/load_image.dart';
- import 'package:provider/provider.dart';
- class WodePage extends StatefulWidget {
- //1用户 2专家
- String type = "2";
- @override
- State<StatefulWidget> createState() {
- return WodePageState();
- }
- }
- class WodePageState extends State<WodePage> with AutomaticKeepAliveClientMixin {
- UserProvider provider = UserProvider();
- ///自己造数据
- ///vip
- // bool _isVip = true;
- //
- ///是否是专家
- bool _iszz = FlutterStars.SpUtil.getInt("expertFlag") == 1;
- @override
- void initState() {
- super.initState();
- upDataUserLogin();
- getUserInfo();
- getCoupon();
- getExpertOrderCont();
- FastNotification.addListener("initUserMoney", (initThisUserMoney) {
- if (mounted) {
- getCoupon();
- setState(() {});
- }
- });
- FastNotification.addListener("initUserInfomation",
- (initThisUserInfomation) {
- if (mounted) {
- getUserInfo();
- setState(() {});
- }
- });
- }
- String indexNow;
- final _cancelController = TextEditingController(text: "取消");
- Map<String, dynamic> detailOj = {
- "couponNum": 0,
- "balance": 0.0,
- "hongBaoNum": 0,
- "memberDays": "",
- };
- int isVip = 1;
- ///获取用户信息
- void getUserInfo() {
- ApiService(context: context).userInfo(
- onSuccess: (data) {
- setUser(data);
- // print(data.showWhichName);
- indexNow = data.showWhichName.toString();
- },
- onError: (code, msg) {},
- );
- }
- //更新用户信息
- Future upDataUserLogin() async {
- await NewApiService().upDataUserLogin(onSuccess: (res) {
- User().setCurrentUser(res, type: 'upDataAppMenus');
- _iszz = FlutterStars.SpUtil.getInt("expertFlag") == 1;
- String initThisUserMoney = randomInt(1111, 9999).toString() +
- DateTime.now().millisecondsSinceEpoch.toString();
- FastNotification.push("initUserMoney", initThisUserMoney);
- String initThisUserInfomation = randomInt(1111, 9999).toString() +
- DateTime.now().millisecondsSinceEpoch.toString();
- FastNotification.push("initUserInfomation", initThisUserInfomation);
- // setState(() {});
- }, onError: (code, msg) {
- toasts(msg);
- });
- }
- Map<String, dynamic> expertorderOj = {
- "totalMoney": 0,
- "askNum": 0,
- "outNum": 0,
- "dealingNum": 0
- };
- ///获取专家订单信息
- void getExpertOrderCont() {
- NewApiService().getExpertOrderCont(
- onSuccess: (data) {
- expertorderOj = data;
- print(data);
- setState(() {});
- // setUser(data);
- // print(data.showWhichName);
- // indexNow = data.showWhichName.toString();
- },
- onError: (code, msg) {},
- );
- }
- Future scan() async {
- try {
- // 此处为扫码结果,barcode为二维码的内容
- String barcode = await BarcodeScanner.scan();
- print(barcode);
- // http://lift.whlhcx.com/h5/index.html?page=/wode/vip&id=1288674418578472962
- // return;
- // print('扫码结果: ' + jsonDecode(barcode)["url"]);
- Uri u = Uri.parse(barcode);
- String id = u.queryParameters['id'];
- print('扫码结果: ' + id);
- // print('扫码结果: ' + jsonDecode(barcode)["userId"].toString());
- NewApiService().getUserRebates(id, onSuccess: (res) {
- toastsF(
- context, "你已成功接受${res != null ? res.toString() : ''}的邀请,立即成为会员!",
- timeInSecForIos: 3);
- // toasts("您已成为${res!=null?res.toString():''}的下级用户");
- NavigatorUtils.push(context, "${WodeRouter.vip}?id=");
- }, onError: (code, msg) {
- toasts(msg);
- });
- } on PlatformException catch (e) {
- if (e.code == BarcodeScanner.CameraAccessDenied) {
- // 未授予APP相机权限
- print('未授予APP相机权限');
- } else {
- // 扫码错误
- print('扫码错误: $e');
- }
- } on FormatException {
- // 进入扫码页面后未扫码就返回
- print('进入扫码页面后未扫码就返回');
- } catch (e) {
- // 扫码错误
- print('扫码错误: $e');
- }
- }
- // Future<void> scan() async {
- // String barcodeScanRes;
- // // Platform messages may fail, so we use a try/catch PlatformException.
- // try {
- // barcodeScanRes = await FlutterBarcodeScanner.scanBarcode(
- // "#ff6666", "取消", true, ScanMode.BARCODE);
- // print(123456);
- // print(barcodeScanRes);
- // Uri u = Uri.parse(barcodeScanRes);
- // String id = u.queryParameters['id'];
- // print("123456--" + id);
- // NewApiService().getUserRebates(id,
- // onSuccess: (res) {
- // toastsF(context,"你已成功接受${res!=null?res.toString():''}的邀请,立即成为会员!",timeInSecForIos:3);
- // // toasts("您已成为${res!=null?res.toString():''}的下级用户");
- // NavigatorUtils.push(context, "${WodeRouter.vip}?id=");
- // }, onError: (code, msg) {
- // toasts(msg);
- // });
- // } on PlatformException {
- // barcodeScanRes = 'Failed to get platform version.';
- // }
- // // If the widget was removed from the tree while the asynchronous platform
- // // message was in flight, we want to discard the reply rather than calling
- // // setState to update our non-existent appearance.
- // if (!mounted) return;
- // }
- Future getCoupon() async {
- await NewApiService().getUserCoupons(onSuccess: (res) {
- if (res != null) {
- detailOj["couponNum"] = res["couponNum"];
- detailOj["balance"] = res["balance"];
- detailOj["hongBaoNum"] = res["hongBaoNum"];
- detailOj["memberDays"] = res["memberDays"];
- isVip = res["isVip"];
- FlutterStars.SpUtil.putInt('isVip', isVip);
- setState(() {});
- print(6666544);
- }
- }, onError: (code, msg) {
- toasts(msg);
- });
- }
- void setUser(UserInfoEntity user) {
- provider.setUser(user);
- }
- ///选择图片
- void selectPicker() {
- showDialog(
- context: context,
- builder: (BuildContext context) {
- return SimpleDialog(
- title: Text("修改头像"),
- children: ["拍照", '从手机相册选择'].map((String value) {
- print("$value");
- return SimpleDialogOption(
- child: Text(
- "${value}",
- style: TextStyle(fontSize: 16, fontWeight: FontWeight.w500),
- ),
- onPressed: () {
- _getImage(value == '拍照' ? 1 : 0);
- Navigator.of(context).pop();
- },
- );
- }).toList(),
- );
- },
- );
- }
- void _getImage(int key) async {
- try {
- var _imageFile = await ImagePicker.pickImage(
- source: key == 1 ? ImageSource.camera : ImageSource.gallery,
- maxWidth: 800,
- imageQuality: 95);
- if (_imageFile != null) {
- updateAvatar(_imageFile);
- setState(() {});
- }
- } catch (e) {
- toasts("没有权限,无法打开相册!");
- }
- }
- void updateAvatar(File imageFile) {
- List<File> list = [imageFile];
- ApiService(context: context).uploadMore(list, onSuccess: (imgs) {
- ApiService(context: context).modifyAvatar(imgs[0], onSuccess: (res) {
- if (res != null) {
- getUserInfo();
- }
- }, onError: (code, msg) {
- toasts(msg);
- });
- });
- }
- void _updateUserInfo(value) {
- ApiService(context: context).modifyName(value, onSuccess: (res) {
- if (res != null) {
- getUserInfo();
- }
- }, onError: (code, msg) {
- toasts(msg);
- });
- }
- @override
- void dispose() {
- // provider.dispose();
- super.dispose();
- }
- static const OrderTypeList = [
- {
- "title": "待付款",
- "img": "wode/order_1",
- },
- {
- "title": "待确认",
- "img": "wode/order_3",
- },
- {
- "title": "待评价",
- "img": "wode/order_2",
- },
- {
- "title": "申诉",
- "img": "wode/order_4",
- },
- ];
- @override
- Widget build(BuildContext context) {
- return
- // Center(child:new Text("个人中心"));
- ChangeNotifierProvider<UserProvider>(
- create: (_) => provider,
- child: Scaffold(
- body: Consumer<UserProvider>(
- builder: (_, provider, __) {
- return Container(
- color: Colours.grey_app_bg,
- child: Column(
- children: [
- _headWidget(),
- Expanded(
- child: RefreshIndicator(
- onRefresh: () async {
- setState(() {
- getUserInfo();
- getCoupon();
- getExpertOrderCont();
- upDataUserLogin();
- });
- },
- child: ListView(
- padding: EdgeInsets.only(top: 0),
- children: <Widget>[
- _iszz ? _myJieDan() : Container(),
- _myOrder(context),
- _applications(),
- ],
- ),
- ),
- ),
- ],
- ));
- },
- ),
- ),
- );
- }
- _headWidget() {
- MediaQueryData mq = MediaQuery.of(context);
- return ClipPath(
- clipper: BottomClipper(clipheight: 15), //路
- child: Stack(
- children: [
- Positioned(
- left: 0,
- right: -40,
- child: Container(
- // color: Colors.red,
- height: 225 + mq.padding.top,
- width: double.infinity,
- child: LoadAssetImage(
- "wode_head_bg",
- fit: BoxFit.cover,
- // key: const Key('add'),
- // color: Colors.white,
- ),
- ),
- ),
- Container(
- margin: EdgeInsets.only(
- right: ScreenUtil().setWidth(8), top: mq.padding.top),
- height: 210,
- child: Column(
- children: <Widget>[
- Container(
- height: 60,
- // color: Colors.,
- child: Stack(
- children: [
- Container(
- width: double.infinity,
- alignment: Alignment.center,
- child: Text(
- '个人中心',
- style: TextStyle(
- color: Colors.white,
- fontWeight: FontWeight.w400,
- fontSize: 16),
- ),
- ),
- Positioned(
- top: 0,
- right: -10,
- child: Container(
- height: 60,
- // alignment: Alignm,
- child: IconButton(
- onPressed: () {
- NavigatorUtils.push(context,
- "${WodeRouter.settingPage}?indexNow=$indexNow");
- },
- icon: LoadAssetImage(
- "icon_setting",
- key: const Key('add'),
- width: 24,
- height: 24,
- color: Colors.white,
- ),
- ),
- ))
- ],
- ),
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- crossAxisAlignment: CrossAxisAlignment.center,
- children: <Widget>[
- GestureDetector(
- onTap: () {
- NavigatorUtils.push(context, WodeRouter.personalPage);
- },
- child: Container(
- padding: EdgeInsets.only(
- left: 10,
- // top: ScreenUtil().setHeight(5),
- // bottom: ScreenUtil().setWidth(25),
- ),
- child: Row(
- children: <Widget>[
- Container(
- padding: EdgeInsets.only(
- right: 10,
- ),
- child:
- // CircleAvatar(
- // radius: 24,
- // backgroundColor: Colors.transparent,
- // backgroundImage:
- // ImageUtils.getImageProvider(
- // provider.user?.avatarUrl),
- // ),
- ClipRRect(
- borderRadius: BorderRadius.circular(
- ScreenUtil().setWidth(35)),
- child: Container(
- child: LoadNetworkImage(
- provider.user?.avatarUrl,
- // fit: BoxFit.fitWidth,
- width: ScreenUtil().setWidth(70),
- height: ScreenUtil().setWidth(70),
- ),
- ))),
- Column(
- mainAxisAlignment: MainAxisAlignment.start,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- Row(
- children: [
- Container(
- child: Text(
- provider.user?.showWhichName == 1
- ? (provider.user?.nickName ?? "")
- : (provider.user?.userName ?? ""),
- textAlign: TextAlign.left,
- style: TextStyle(
- fontSize: ScreenUtil().setSp(16),
- color: Color(0xffffffff),
- ),
- ),
- ),
- // img_vip_icon
- // provider.us
- LoadAssetImage(
- isVip == 2
- ? 'img_vip_icon'
- : 'img_novip_icon',
- height: 17,
- width: 20,
- fit: BoxFit.fill,
- // alignment: Alignment.centerLeft,
- ),
- ],
- ),
- SizedBox(height: 3),
- Row(
- children: <Widget>[
- Stack(
- children: [
- Container(
- child: LoadAssetImage(
- // image: AssetImage(i['img']),
- _iszz
- ? 'img_user_expert'
- : 'img_user_ordinary',
- height: 20,
- width: 65,
- fit: BoxFit.fill,
- // alignment: Alignment.centerLeft,
- ),
- ),
- Container(
- height: 20,
- // width: ScreenUtil()certificateStatus
- // .setWidth(65),
- alignment: Alignment.centerLeft,
- margin: EdgeInsets.only(left: 20),
- child: Text(
- _iszz
- ? '${provider.user?.userLevelName} Lv${FlutterStars.SpUtil.getInt("expertLevel")}'
- : '${provider.user?.userLevelName}',
- style: TextStyle(
- color: Colors.white,
- fontSize: 10),
- ),
- )
- ],
- ),
- // GestureDetector(
- // onTap: () {
- // // print(provider.user.userLevel);
- // NavigatorUtils.push(context,
- // "${WodeRouter.vip}?id=");
- // },
- // child: Container(
- // padding: EdgeInsets.only(
- // left: 6,
- // right: 6,
- // top: 2,
- // bottom: 2,
- // ),
- // decoration: BoxDecoration(
- // borderRadius:
- // BorderRadius.circular(
- // 10.0),
- // color: Colors.white,
- // ),
- // child: Row(
- // children: <Widget>[
- // Container(
- // child: LoadAssetImage(
- // // image: AssetImage(i['img']),
- // 'wode/zuan',
- // height: ScreenUtil()
- // .setWidth(11),
- // width: ScreenUtil()
- // .setWidth(12),
- // fit: BoxFit.cover,
- // // alignment: Alignment.centerLeft,
- // ),
- // ),
- // SizedBox(width: 3),
- // Text(
- // provider.user?.userLevelName !=
- // null &&
- // provider.user
- // ?.userLevelName !=
- // ''
- // ? provider.user
- // ?.userLevelName
- // : "成为会员",
- // textAlign:
- // TextAlign.left,
- // style: TextStyle(
- // fontSize:
- // ScreenUtil()
- // .setSp(11),
- // color: Color(
- // 0xff0288FF),
- // ),
- // ),
- // ],
- // ),
- // ),
- // ),
- // SizedBox(
- // width: 10,
- // ),
- // Container(
- // child: Text(
- // detailOj["memberDays"] ??
- // "",
- // textAlign: TextAlign.left,
- // style: TextStyle(
- // fontSize: ScreenUtil()
- // .setSp(14),
- // color: Color(0xffffffff),
- // ),
- // ),
- // )
- ],
- )
- ],
- ),
- ],
- ),
- ),
- ),
- InkWell(
- onTap: () {
- NavigatorUtils.push(context, WodeRouter.walletPage);
- },
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.end,
- // mainAxisAlignment: MainAxisAlignment.end,
- children: [
- Container(
- // alignment: Alignment.centerRight,
- child: Text(
- detailOj["balance"] != null
- ? detailOj["balance"].toString()
- : "0.0",
- style: TextStyle(
- color: Colors.white,
- fontSize: ScreenUtil().setSp(18)),
- ),
- ),
- Row(
- children: [
- Text(
- '账户余额',
- style: TextStyle(
- color: Colors.white,
- fontSize: ScreenUtil().setSp(12)),
- ),
- Icon(
- Icons.arrow_forward_ios,
- size: 10,
- color: Colors.white,
- )
- ],
- )
- ],
- ),
- )
- ],
- ),
- ],
- ),
- ),
- Positioned(
- bottom: 5,
- left: 10,
- right: 10,
- child: InkWell(
- onTap: () {
- NavigatorUtils.push(context, "${WodeRouter.vip}?id=");
- },
- child: Container(
- height: 45,
- child: LoadAssetImage(
- "img_vip_tip",
- fit: BoxFit.fill,
- // key: const Key('add'),
- // color: Colors.white,
- ),
- ),
- ))
- ],
- ));
- }
- _myJieDan() {
- // widget a = Row(children: [],);
- return TitleCard(
- title: '我的接单',
- rightText: '查看全部接单',
- onTapRight: () {
- NavigatorUtils.push(
- context, "${WodeRouter.orderPageMaster}?checkType=0");
- },
- body: Container(
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceAround,
- // crossAxisAlignment: CrossAxisAlignment.center
- // crossAxisAlignment: co,
- children: [
- SizedBox(
- width: ScreenUtil().setWidth(5),
- ),
- Container(
- padding: EdgeInsets.only(top: 15),
- child: Column(
- // crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- Text(
- expertorderOj['totalMoney'].toString(),
- style: TextStyle(
- color: Colours.dark_text_gray, fontSize: 17),
- ),
- SizedBox(
- height: 5,
- ),
- Text(
- '总收益',
- style: TextStyle(
- color: Colours.dark_text_gray, fontSize: 13),
- ),
- ],
- ),
- ),
- SizedBox(
- width: ScreenUtil().setWidth(30),
- ),
- Container(
- padding: EdgeInsets.only(top: 15),
- child: Column(
- // crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- Text(
- expertorderOj['askNum'].toString(),
- style: TextStyle(
- color: Colours.dark_text_gray, fontSize: 17),
- ),
- SizedBox(
- height: 5,
- ),
- Text(
- '问诊单数',
- style: TextStyle(
- color: Colours.dark_text_gray, fontSize: 13),
- ),
- ],
- ),
- ),
- SizedBox(
- width: ScreenUtil().setWidth(30),
- ),
- Container(
- padding: EdgeInsets.only(top: 15),
- child: Column(
- // crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- Text(
- expertorderOj['outNum'].toString(),
- style: TextStyle(
- color: Colours.dark_text_gray, fontSize: 17),
- ),
- SizedBox(
- height: 5,
- ),
- Text(
- '出诊单数',
- style: TextStyle(
- color: Colours.dark_text_gray, fontSize: 13),
- ),
- ],
- ),
- ),
- Container(
- margin: EdgeInsets.only(top: 15, left: 10),
- // color: Colors.red,
- height: 30,
- width: 5,
- child: LoadAssetImage(
- "icon_line",
- fit: BoxFit.cover,
- // key: const Key('add'),
- // color: Colors.white,
- ),
- ),
- // Icon(icon)
- SizedBox(
- height: 5,
- ),
- InkWell(
- onTap: () {
- NavigatorUtils.push(
- context, "${WodeRouter.orderPageMaster}?checkType=0");
- },
- child: Container(
- margin: EdgeInsets.only(top: 10),
- // height: 100,
- child: Stack(
- children: [
- Column(
- // crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- SizedBox(
- height: 5,
- ),
- Icon(
- const IconData(0xe61f, fontFamily: "Iconfont"),
- ),
- SizedBox(
- height: 1,
- ),
- Text(
- '待处理',
- style: TextStyle(
- color: Colours.dark_text_gray, fontSize: 13),
- ),
- ],
- ),
- Positioned(
- top: 0,
- right: 0,
- child: Container(
- height: 16,
- width: 16,
- alignment: Alignment.center,
- decoration: BoxDecoration(
- //背景
- color: Colors.white,
- //设置四周圆角 角度
- borderRadius:
- BorderRadius.all(Radius.circular(10.0)),
- //设置四周边框
- border: Border.all(width: 1, color: Colors.red),
- ),
- child: Text(expertorderOj['dealingNum'].toString(),
- style:
- TextStyle(fontSize: 9, color: Colors.red)),
- )),
- ],
- ),
- ),
- ),
- SizedBox(
- width: ScreenUtil().setWidth(5),
- ),
- ],
- ),
- ));
- }
- _myOrder(context) {
- List<Widget> brandList(context) => OrderTypeList.asMap().keys.map(
- (item) {
- double width = MediaQuery.of(context).size.width;
- return Container(
- padding: EdgeInsets.only(top: 15),
- child: _iconItem(
- size: 30,
- title: OrderTypeList[item]["title"],
- icon: OrderTypeList[item]['img'],
- ontap: () {
- int nums = item + 1;
- String index = nums.toString();
- NavigatorUtils.push(
- context, "${WodeRouter.orderPage}?checkType=$index");
- },
- ),
- );
- // InkWell(
- // onTap: () {
- // int nums = item + 1;
- // String index = nums.toString();
- // NavigatorUtils.push(
- // context, "${WodeRouter.orderPage}?checkType=$index");
- // },
- // child: Container(
- // padding: EdgeInsets.only(top: 15),
- // child: Column(
- // // crossAxisAlignment: CrossAxisAlignment.center,
- // children: [
- // Container(
- // // height: 70,
- // // color: Colors.red,
- // child: LoadAssetImage(
- // // image: AssetImage(i['img']),
- // OrderTypeList[item]['img'],
- // width: ScreenUtil().setWidth(24),
- // height: ScreenUtil().setWidth(24),
- // // alignment: Alignment.centerLeft,
- // ),
- // ),
- // SizedBox(height: ScreenUtil().setWidth(10)),
- // Container(
- // child: Text(
- // OrderTypeList[item]["title"],
- // style: TextStyle(
- // color: Colours.dark_text_gray,
- // fontSize: ScreenUtil().setSp(13)),
- // textAlign: TextAlign.start,
- // ),
- // ),
- // ],
- // ),
- // ),
- // );
- // Container(
- // // color:Colors.yellow,
- // width: width / 4,
- // child: FlatButton(
- // padding: EdgeInsets.all(0),
- // highlightColor: Colors.white,
- // splashColor: Colors.white,
- // child: Container(
- // // width: 90,
- // height: ScreenUtil().setWidth(80),
- // // color: Colors.red,
- // padding: EdgeInsets.only(
- // left: ScreenUtil().setWidth(10),
- // right: ScreenUtil().setWidth(10),
- // top: ScreenUtil().setWidth(10)),
- // child: Column(
- // mainAxisAlignment: MainAxisAlignment.start,
- // children: <Widget>[
- // Container(
- // // height: 70,
- // // color: Colors.red,
- // child: LoadAssetImage(
- // // image: AssetImage(i['img']),
- // initList[item]['img'],
- // width: ScreenUtil().setWidth(50),
- // height: ScreenUtil().setWidth(30),
- // // alignment: Alignment.centerLeft,
- // ),
- // ),
- // SizedBox(height: ScreenUtil().setWidth(10)),
- // Container(
- // child: Text(
- // initList[item]["title"],
- // style: TextStyle(
- // color: Colours.red,
- // fontSize: ScreenUtil().setSp(15)),
- // textAlign: TextAlign.start,
- // ),
- // ),
- // ]),
- // ),
- // onPressed: () {
- // int nums = item + 1;
- // String index = nums.toString();
- // NavigatorUtils.push(
- // context, "${WodeRouter.orderPage}?checkType=$index");
- // },
- // ),
- // );
- },
- ).toList();
- return TitleCard(
- title: '我的订单',
- height: 140,
- rightText: '查看全部订单',
- onTapRight: () {
- NavigatorUtils.push(context, "${WodeRouter.orderPage}?checkType=0");
- },
- body: Container(
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceAround,
- // crossAxisAlignment: CrossAxisAlignment.center
- // crossAxisAlignment: co,
- children: brandList(context))));
- }
- _iconItem({String title, double size = 24, String icon, Function ontap}) {
- return InkWell(
- onTap: ontap,
- child: Container(
- // padding: EdgeInsets.only(top: 15),
- child: Column(
- // crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- Container(
- // height: 70,
- // color: Colors.red,
- child: LoadAssetImage(
- // image: AssetImage(i['img']),
- icon,
- width: ScreenUtil().setWidth(size),
- height: ScreenUtil().setWidth(size),
- // alignment: Alignment.centerLeft,
- ),
- ),
- SizedBox(height: ScreenUtil().setWidth(10)),
- Container(
- child: Text(
- title,
- style: TextStyle(
- color: Colours.dark_text_gray,
- fontSize: ScreenUtil().setSp(13)),
- textAlign: TextAlign.start,
- ),
- ),
- ],
- ),
- ),
- );
- }
- _applications() {
- double itemSize = 38;
- return TitleCard(
- title: '我的服务',
- // rightText: '查看全部接单',
- height: _iszz ? 330 : 260,
- // onTapRight: () {},
- body: Container(
- child: GridView.count(
- physics: const NeverScrollableScrollPhysics(),
- padding: EdgeInsets.only(top: 20),
- // 内边距
- scrollDirection: Axis.vertical,
- childAspectRatio: 1.1,
- // 滚动方向
- crossAxisSpacing: 10,
- // 列间距
- crossAxisCount: 4,
- // 每行的个数(Axis.vertic == 横向三个, Axis.horizontal == 竖方向三个)
- mainAxisSpacing: 10,
- children: [
- _iconItem(
- title: "打赏记录",
- icon: "wode/dashang",
- size: itemSize,
- ontap: () {
- Navigator.of(context).push(MaterialPageRoute(
- builder: (context) => RewardRecordList()));
- // Navigator.push(context, route)
- // // RewardRecordList();
- // NavigatorUtils.push(context, WodeRouter.collectPage);
- },
- ),
- _iconItem(
- title: "收藏",
- icon: "wode/shoucang",
- size: itemSize,
- ontap: () {
- NavigatorUtils.push(context, WodeRouter.collectPage);
- },
- ),
- _iconItem(
- title: "我的视频",
- icon: "wode/shipin",
- size: itemSize,
- ontap: () {
- NavigatorUtils.push(context, WodeRouter.myVideo);
- },
- ),
- _iconItem(
- title: "发票中心",
- icon: "wode/piao",
- size: itemSize,
- ontap: () {
- NavigatorUtils.push(context, WodeRouter.piaoCenter);
- },
- ),
- _iconItem(
- title: "优惠券",
- icon: "wode/youhuiquan",
- size: itemSize,
- ontap: () {
- NavigatorUtils.push(context, WodeRouter.couponPage);
- },
- ),
- _iconItem(
- title: "红包",
- icon: "wode/hongbao",
- size: itemSize,
- ontap: () {
- NavigatorUtils.push(context, WodeRouter.redbaoPage);
- },
- ),
- _iconItem(
- title: "我的消息",
- icon: "wode/xiaoxi",
- size: itemSize,
- ontap: () {
- NavigatorUtils.push(context, WodeRouter.noticeList);
- },
- ),
- _iconItem(
- title: "扫一扫",
- icon: "wode/qr",
- size: itemSize,
- ontap: () {
- scan();
- },
- ),
- _iszz
- ? _iconItem(
- title: "专家处罚",
- icon: "wode/wr",
- size: itemSize,
- ontap: () {
- NavigatorUtils.push(context, WodeRouter.errorRecordList);
- },
- )
- : Container(),
- ],
- )));
- }
- @override
- bool get wantKeepAlive => true;
- }
- class TitleCard extends StatelessWidget {
- String title;
- String rightText;
- Function onTapRight;
- double height;
- Widget body;
- TitleCard(
- {this.title,
- this.rightText,
- this.onTapRight,
- this.body,
- this.height = 120});
- @override
- Widget build(BuildContext context) {
- return Container(
- margin: EdgeInsets.only(left: 10, right: 10, bottom: 5),
- decoration: new BoxDecoration(
- color: Colors.white,
- //设置四周圆角 角度
- borderRadius: BorderRadius.all(Radius.circular(6.0)),
- ),
- padding: EdgeInsets.only(left: 10, right: 10, top: 15, bottom: 15),
- height: height,
- // width: ScreenUtil().setWidth(355),
- child: Column(
- children: [
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text(title,
- style: TextStyle(
- color: Colours.tip_text_black,
- fontSize: 15,
- fontWeight: FontWeight.bold)),
- rightText != null
- ? InkWell(
- onTap: onTapRight,
- child: Row(
- children: [
- Text(rightText,
- style: TextStyle(
- color: Colours.dark_text_gray, fontSize: 13)),
- Icon(
- Icons.arrow_forward_ios,
- color: Colours.dark_text_gray,
- size: 15,
- )
- ],
- ),
- )
- : Container()
- ],
- ),
- // SizedBox(
- // height: 15,
- // ),
- Expanded(child: body),
- // body
- ],
- ),
- );
- }
- }
- class OrderType extends StatelessWidget {
- OrderType({Key key, this.initList}) : super(key: key);
- List<dynamic> initList;
- List<Widget> brandList(context) => initList.asMap().keys.map(
- (item) {
- double width = MediaQuery.of(context).size.width;
- return Container(
- // color:Colors.yellow,
- width: width / 4,
- child: FlatButton(
- padding: EdgeInsets.all(0),
- highlightColor: Colors.white,
- splashColor: Colors.white,
- child: Container(
- // width: 90,
- height: ScreenUtil().setWidth(80),
- // color: Colors.red,
- padding: EdgeInsets.only(
- left: ScreenUtil().setWidth(10),
- right: ScreenUtil().setWidth(10),
- top: ScreenUtil().setWidth(10)),
- child: Column(
- mainAxisAlignment: MainAxisAlignment.start,
- children: <Widget>[
- Container(
- // height: 70,
- // color: Colors.red,
- child: LoadAssetImage(
- // image: AssetImage(i['img']),
- initList[item]['img'],
- width: ScreenUtil().setWidth(50),
- height: ScreenUtil().setWidth(30),
- // alignment: Alignment.centerLeft,
- ),
- ),
- SizedBox(height: ScreenUtil().setWidth(10)),
- Container(
- child: Text(
- initList[item]["title"],
- style: TextStyle(
- color: Colours.red,
- fontSize: ScreenUtil().setSp(15)),
- textAlign: TextAlign.start,
- ),
- ),
- ]),
- ),
- onPressed: () {
- int nums = item + 1;
- String index = nums.toString();
- NavigatorUtils.push(
- context, "${WodeRouter.orderPage}?checkType=$index");
- },
- ),
- );
- },
- ).toList();
- @override
- Widget build(BuildContext context) {
- return Container(
- padding: EdgeInsets.only(top: ScreenUtil().setWidth(5)),
- child: Wrap(
- // spacing: 26,
- alignment: WrapAlignment.spaceBetween,
- crossAxisAlignment: WrapCrossAlignment.center,
- children: brandList(context),
- ),
- );
- }
- }
|