12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220 |
- // import 'dart:html';
- import 'package:flustars/flustars.dart' as flustars;
- import 'package:flutter/services.dart';
- import 'package:flutter_spinkit/flutter_spinkit.dart';
- import 'package:liftmanager/internal/bbs/model/expert_model.dart'
- as ExportModel;
- import 'package:flutter/material.dart';
- import 'package:flutter_screenutil/flutter_screenutil.dart';
- import 'package:flutter_swiper/flutter_swiper.dart';
- import 'package:liftmanager/common/common.dart';
- import 'package:liftmanager/common/user_db.dart';
- import 'package:liftmanager/internal/account/account_router.dart';
- import 'package:liftmanager/internal/account/provider/user_provider.dart';
- import 'package:liftmanager/internal/bbs/provide/websocket.dart';
- import 'package:liftmanager/internal/wode/model/privilege_model.dart';
- import 'package:liftmanager/internal/wode/model/vipfee_model.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/theme_utils.dart';
- import 'package:liftmanager/utils/time_format.dart';
- import 'package:liftmanager/utils/toast.dart';
- import 'package:liftmanager/widgets/app_bar.dart';
- import 'package:liftmanager/widgets/load_image.dart';
- import 'package:liftmanager/widgets/round_widget.dart';
- import 'package:oktoast/oktoast.dart';
- import 'package:provider/provider.dart';
- import 'package:umeng_common_sdk/umeng_common_sdk.dart';
- class Vip extends StatefulWidget {
- Vip(this.id);
- final String id;
- @override
- State<StatefulWidget> createState() {
- return VipState();
- }
- }
- class VipState extends State<Vip> with AutomaticKeepAliveClientMixin {
- UserProvider provider = UserProvider();
- int currentIndex = -1;
- /// 月卡季卡年卡
- int selectVipType = 0;
- ///选中的套餐
- Records selectedRecord = Records();
- List<PrivilegeModel> vipList = [];
- ///推荐套餐列表
- List<Records> moneyList = [];
- ExportModel.Records _userInfo = ExportModel.Records();
- TextEditingController _vipnumController = TextEditingController();
- void getUserInfo() {
- NewApiService().getExpertDetail(flustars.SpUtil.getString(Constant.userId),
- onSuccess: (res) {
- _userInfo = res;
- setState(() {});
- print("res");
- }, onError: (code, msg) {
- toasts(msg);
- });
- ApiService(context: context).userInfo(
- onSuccess: (data) {
- provider.setUser(data);
- // setUser(data);
- },
- onError: (code, msg) {},
- );
- }
- bool _isAuth = true;
- void getAuthInfo() {
- NewApiService().getAuthDetail(false, onSuccess: (res) {
- List dataArr = res ?? [];
- if (dataArr?.last['key'] == '1') {
- _isAuth = true;
- } else {
- _isAuth = false;
- }
- setState(() {});
- print("$res");
- }, onError: (code, msg) {
- toasts(msg);
- });
- }
- void getMemberAllMenu() {
- NewApiService().getVipFeeList(widget.id, onSuccess: (res) {
- moneyList = res.records;
- selectedRecord = moneyList[0];
- setState(() {});
- }, onError: (code, msg) {
- toasts(msg);
- });
- NewApiService().getMemberAllMenu(onSuccess: (res) {
- vipList = res;
- currentIndex = res.length > 0 ? 0 : -1;
- setState(() {});
- }, onError: (code, msg) {
- vipList = [];
- toasts(msg);
- });
- }
- bool vip = false;
- Future isVipOrExpert() async {
- await NewApiService().getIsVipOrExpert(onSuccess: (res) {
- if (res != null) {
- vip = true;
- }
- }, onError: (code, msg) {
- toasts(msg);
- });
- }
- Future becomeLowerMember() async {
- await NewApiService().getUserRebates(widget.id, onSuccess: (res) {
- toastsF(context, "你已成功接受${res != null ? res.toString() : ''}的邀请,立即成为会员!",
- timeInSecForIos: 3);
- // toasts("您已成为${res!=null?res.toString():''}的下级用户");
- }, onError: (code, msg) {
- toasts(msg);
- });
- }
- void updateVip(userLevel) {
- NewApiService().updateVip(userLevel, onSuccess: (res) {
- toasts("充值成功,请重新登录");
- setState(() {});
- User().clearUser();
- Provider.of<WebSocketProvide>(context, listen: false).closeWebSocket();
- // removeSocket();
- // _push.unbindAccount(account: flustars.SpUtil.getString(Constant.phone));
- NavigatorUtils.push(context, AccountRouter.loginPage, clearStack: true);
- }, onError: (code, msg) {
- toasts(msg);
- });
- }
- @override
- void initState() {
- UmengCommonSdk.onPageStart("会员中心");
- getMemberAllMenu();
- getUserInfo();
- getAuthInfo();
- super.initState();
- print(widget.id);
- print(66666);
- FastNotification.addListener("initUserMoney", (initThisUserMoney) {
- if (mounted) {
- getUserInfo();
- setState(() {});
- }
- });
- if (widget.id != null && widget.id != "") {
- print("触发绑定");
- becomeLowerMember();
- }
- }
- @override
- void dispose() {
- UmengCommonSdk.onPageEnd("会员中心");
- // provider.dispose();
- super.dispose();
- }
- @override
- Widget build(BuildContext context) {
- double width = MediaQuery.of(context).size.width;
- double height = MediaQuery.of(context).size.height;
- return ChangeNotifierProvider<UserProvider>(
- create: (_) => provider,
- child: Container(
- child: Scaffold(
- // resizeToAvoidBottomPadding: false,
- appBar: MyAppBar(
- centerTitle: "会员中心",
- titleColor: Colors.white,
- bgColors: [Color(0xff3B3633), Color(0xff5B5350)],
- ),
- body: Consumer<UserProvider>(
- builder: (_, provider, __) {
- return Container(
- color: Color(0xfff5f5f5),
- child: ListView(
- padding: EdgeInsets.all(0.0),
- children: <Widget>[
- _headeWidget(),
- _vipTip(),
- _setMeal(),
- _frindes(),
- _buybtn(),
- // Container(
- // padding:
- // EdgeInsets.only(left: 20.0, right: 20.0, top: 10.0),
- // // height: ScreenUtil().setWidth(345),
- // child: Column(
- // children: <Widget>[
- // vipList.length > 0
- // ? SwipeWidget(
- // banners: vipList,
- // onClickItem: (index, item) {
- // // showAlert(
- // // context,
- // // "提示",
- // // "您确定需要充值升级为Vip吗?",
- // // "确认",
- // // () {
- // // // updateVip(item.id);
- // // // NavigatorUtils.goBack(context);
- // // },
- // // txt2: "取消",
- // // onPre2: () {
- // // NavigatorUtils.goBack(context);
- // // },
- // // );
- // // print(333);
- // // print(provider);
- // NavigatorUtils.push(context,
- // "${WodeRouter.vipService}?id=${item.id.toString()}");
- // },
- // onChangItem: (index, item) {
- // currentIndex = index;
- // setState(() {});
- // },
- // )
- // : Container()
- // ],
- // ),
- // ),
- // LabelTitle(
- // title: "会员特权",
- // isMore: true,
- // userTap: () {
- // if (currentIndex != -1) {
- // NavigatorUtils.push(context,
- // "${WodeRouter.privilege}?id=${vipList[currentIndex].id.toString()}");
- // }
- // },
- // ),
- // Container(
- // color: ThemeUtils.getTabsBg(context),
- // height: ScreenUtil().setWidth(150),
- // padding: EdgeInsets.only(
- // top: ScreenUtil().setWidth(5),
- // left: ScreenUtil().setWidth(10),
- // right: ScreenUtil().setWidth(10),
- // ),
- // child: Privilege(
- // initList: currentIndex != -1
- // ? vipList[currentIndex].menuList
- // : []),
- // ),
- // LabelTitle(
- // title: "邀请好友",
- // isMore: false,
- // userTap: () {},
- // ),
- // GestureDetector(
- // onTap: () async {
- // await isVipOrExpert();
- // if (vip) {
- // NavigatorUtils.push(context, "${WodeRouter.qrshare}");
- // vip = false;
- // } else {
- // print(999);
- // toasts("请开通会员或成为专家");
- // }
- // },
- // child: Container(
- // color: ThemeUtils.getTabsBg(context),
- // height: ScreenUtil().setWidth(110),
- // padding: EdgeInsets.only(
- // top: ScreenUtil().setWidth(10),
- // left: ScreenUtil().setWidth(10),
- // right: ScreenUtil().setWidth(10),
- // ),
- // child: LoadAssetImage(
- // "wode/invite_friends",
- // width: ScreenUtil().setWidth(724),
- // height: ScreenUtil().setWidth(183),
- // ),
- // ),
- // )
- ],
- ),
- );
- },
- ),
- ),
- ),
- );
- }
- _headeWidget() {
- return Stack(
- children: [
- Positioned(
- // left: 10,
- // right: 10,
- // bottom: 0,
- child: Container(
- // margin: EdgeInsets.only(left: 10,right: 10),
- width: double.infinity,
- height: 160,
- decoration: BoxDecoration(
- gradient: const LinearGradient(
- colors: [Color(0xff3B3633), Color(0xff5B5350)],
- )),
- )),
- Positioned(
- bottom: 0,
- left: 10,
- right: 10,
- child: LoadAssetImage(
- "img_vipcenter_bg",
- width: 350,
- height: 152,
- fit: BoxFit.fill,
- ),
- ),
- Positioned(
- // top: 50,
- bottom: 10,
- left: 10,
- right: 20,
- // left: 0,
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- // crossAxisAlignment: CrossAxisAlignment.center,
- children: <Widget>[
- GestureDetector(
- onTap: () {
- NavigatorUtils.push(context, WodeRouter.personalPage);
- },
- child: Container(
- padding: EdgeInsets.only(
- left: ScreenUtil().setWidth(10),
- ),
- child: Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- Container(
- padding: EdgeInsets.only(
- right: ScreenUtil().setWidth(10),
- ),
- child: ClipRRect(
- borderRadius: BorderRadius.circular(
- ScreenUtil().setWidth(35)),
- child: Container(
- child: LoadNetworkImage(
- provider.user?.avatarUrl,
- // fit: BoxFit.fitWidth,
- width: ScreenUtil().setWidth(40),
- height: ScreenUtil().setWidth(40),
- ),
- ))),
- Column(
- mainAxisAlignment: MainAxisAlignment.start,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- Text(
- provider.user?.showWhichName == 1
- ? (provider.user?.nickName ?? "")
- : (provider.user?.userName ?? ""),
- // _userInfo.name ?? '',
- // '小小维修工',
- textAlign: TextAlign.left,
- style: TextStyle(
- fontSize: ScreenUtil().setSp(16),
- color: Color(0xff2F2B29),
- ),
- ),
- Text(
- _userInfo.vipFlag == 2 ? '尊敬的会员,您好!' : '',
- textAlign: TextAlign.left,
- style: TextStyle(
- fontSize: ScreenUtil().setSp(13),
- color: Color(0xffAB7223),
- ),
- ),
- SizedBox(height: 3),
- _userInfo.vipFlag == 2
- ? InkWell(
- onTap: () {
- if (_userInfo.vipId != null) {
- showToast('您已经填写了会员id哦');
- return;
- }
- showDialog(
- barrierDismissible: false,
- context: context,
- builder: (context) => new AlertDialog(
- title: Text('输入幸运数字'),
- content: Container(
- child: TextField(
- inputFormatters: <
- TextInputFormatter>[
- LengthLimitingTextInputFormatter(
- 8),
- FilteringTextInputFormatter
- .digitsOnly //限制长度
- ],
- maxLength: 8,
- controller: _vipnumController,
- keyboardType: TextInputType.phone,
- ),
- ),
- actions: <Widget>[
- FlatButton(
- onPressed: () {
- NavigatorUtils.goBack(context);
- },
- child: new Text("取消"),
- ),
- FlatButton(
- onPressed: () {
- if (_vipnumController.text ==
- '') {
- showToast('请输入幸运数字');
- return;
- }
- NewApiService().upLoadVipluckNum(
- vipId: _vipnumController.text,
- onSuccess: (res) {
- showToast(res);
- getUserInfo();
- print("res");
- NavigatorUtils.goBack(
- context);
- },
- onError: (code, msg) {
- toasts(msg);
- });
- },
- child: new Text('确认'),
- ),
- ],
- ),
- );
- },
- child: Container(
- padding: EdgeInsets.all(2),
- decoration: BoxDecoration(
- borderRadius: BorderRadius.all(
- Radius.circular(8.0)),
- gradient: LinearGradient(
- colors: [
- Color(0xffF3D99E),
- Color(0xffF4EDCE)
- ],
- )),
- child: Text(_userInfo.vipId == null
- ? ' 抢占自己的幸运id '
- : ' ID:${_userInfo.vipId} '),
- ),
- )
- : Container()
- ],
- ),
- ],
- ),
- ),
- ),
- Expanded(child: Container()),
- InkWell(
- onTap: () {
- // /api/tableDicts/query-constant
- if (_isAuth) {
- showToast('产品正在免费体验期,无需付费购买');
- return;
- }
- NavigatorUtils.push(context,
- "${WodeRouter.vipService}?id=&selectid=${selectedRecord.id.toString()}");
- // NavigatorUtils.push(context, WodeRouter.walletPage);
- },
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.end,
- // mainAxisAlignment: MainAxisAlignment.end,
- children: [
- Container(
- // alignment: Alignment.centerRight,
- child: Text(
- _userInfo.vipFlag == 2
- ? "您的会员到期日:${DateUtils.instance.getFormartData(timeSamp: _userInfo.vipEndTime, format: 'yyyy/MM/dd')}"
- : "",
- style: TextStyle(
- color: Color(0xff252426),
- fontSize: ScreenUtil().setSp(11)),
- ),
- ),
- SizedBox(
- height: 20,
- ),
- Container(
- decoration: BoxDecoration(
- color: Color(0xff272527),
- borderRadius: BorderRadius.all(Radius.circular(15)),
- ),
- padding: EdgeInsets.all(5),
- child: Text(
- ' 立即续费 ',
- style: TextStyle(
- color: Color(0xffFFDBB7),
- fontSize: ScreenUtil().setSp(12)),
- ),
- )
- ],
- ),
- )
- ],
- ),
- ),
- ],
- );
- // Container(
- // decoration: BoxDecoration(
- // gradient: LinearGradient(
- // colors: [Color(0xff3B3633), Color(0xff5B5350)],
- // ),
- // ),
- // // width: double.infinity,
- // // color: Colors.redAccent,
- // child:
- // );
- }
- _vipTip() {
- const OrderTypeList = [
- {
- 'id': 2,
- "title": "题库问答",
- "img": "wode/icon_viptag_0",
- },
- {
- 'id': 3,
- "title": "海量学堂",
- "img": "wode/icon_viptag_1",
- },
- {
- 'id': 4,
- "title": "商品专区",
- "img": "wode/icon_viptag_2",
- },
- {
- 'id': 5,
- "title": "招聘特权",
- "img": "wode/icon_viptag_3",
- },
- {
- 'id': 10,
- "title": "资料库查看",
- "img": "wode/icon_viptag_4",
- },
- {
- 'id': 9,
- "title": "附近的人",
- "img": "wode/icon_viptag_5",
- },
- {
- 'id': 209,
- "title": "快速问诊",
- "img": "wode/icon_viptag_6",
- },
- {
- "id": 210,
- "title": "专家出诊",
- "img": "wode/icon_viptag_7",
- },
- ];
- List<Container> _buildGuidTitleList(int count) {
- return List<Container>.generate(
- count,
- (int index) => Container(
- // padding: EdgeInsets.only(top: 15),
- child: _iconItem(
- title: OrderTypeList[index]["title"],
- icon: OrderTypeList[index]['img'],
- ontap: () {
- NavigatorUtils.push(context,
- "${WodeRouter.privilege}?id=${vipList[currentIndex].id.toString()}&index=${OrderTypeList[index]["id"].toString()}");
- // int nums = index + 1;
- // String index = nums.toString();
- // NavigatorUtils.push(
- // context, "${WodeRouter.orderPage}?checkType=$index");
- },
- ),
- ));
- }
- return TitleCard(
- title: '会员尊享8大权益',
- height: 230,
- body: Container(
- child: GridView.count(
- physics: const NeverScrollableScrollPhysics(),
- padding: EdgeInsets.all(10), // 内边距
- scrollDirection: Axis.vertical, // 滚动方向
- crossAxisSpacing: 10, // 列间距
- crossAxisCount:
- 4, // 每行的个数(Axis.vertic == 横向三个, Axis.horizontal == 竖方向三个)
- mainAxisSpacing: 10,
- //次轴元素间距
- children: _buildGuidTitleList(8), //添加
- ),
- ));
- // Stack(
- // children: [
- // // Positioned(
- // // top: -20,
- // // child: Container(
- // // height: 50,
- // // color: Colors.redAccent,
- // // )),
- // Container(
- // height: 200,
- // color: Colors.blue,
- // )
- // ],
- // );
- }
- _iconItem({String title, double size = 45, 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.text, fontSize: ScreenUtil().setSp(11)),
- textAlign: TextAlign.start,
- ),
- ),
- ],
- ),
- ),
- );
- }
- _setMeal() {
- const setMealList = [
- {"title": "月卡", "money": "40", "detalMoney": "50"},
- {"title": "季卡", "money": "100", "detalMoney": "150"},
- {"title": "半年卡", "money": "200", "detalMoney": "300"},
- {"title": "年卡", "money": "400", "detalMoney": "600"},
- {"title": "年卡", "money": "400", "detalMoney": "600"},
- {"title": "年卡", "money": "400", "detalMoney": "600"},
- {"title": "年卡", "money": "400", "detalMoney": "600"},
- {"title": "年卡", "money": "400", "detalMoney": "600"},
- {"title": "年卡", "money": "400", "detalMoney": "600"},
- {"title": "年卡", "money": "400", "detalMoney": "600"},
- ];
- _cell({title, money, detalMoney, bool isSelect, Function ontap, index}) {
- return InkWell(
- onTap: ontap,
- child: Stack(
- children: [
- Container(
- alignment: Alignment.center,
- height: 200,
- width: 200,
- decoration: BoxDecoration(
- color: isSelect ? Color(0x21FA4F21) : Colors.white,
- //设置四周圆角 角度
- borderRadius: BorderRadius.all(Radius.circular(8.0)),
- //设置四周边框
- border: Border.all(
- width: 1,
- color: isSelect ? Colors.red : Colours.text_gray),
- ),
- child: Column(
- // crossAxisAlignment: CrossAxisAlignment.center,
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- Text(
- '${moneyList[index].name}',
- // '$title',
- style: TextStyle(color: Colours.text, fontSize: 15),
- ),
- Text(
- '${moneyList[index].price}',
- // '¥$money',
- style: TextStyle(
- color: Color(0xffFA4F21),
- fontSize: 18,
- fontWeight: FontWeight.bold),
- ),
- // Text(
- // '原价${moneyList[index].price}/月',
- // style: TextStyle(
- // color: Colours.text_gray,
- // fontSize: 11,
- // decoration: TextDecoration.lineThrough,
- // decorationColor: Colours.text_gray,
- // ),
- // ),
- ],
- )),
- (index == 0 || index == moneyList.length - 1)
- ? RoundPathWidget(
- pathShape: PathShapeEnum.PartRoundRect,
- leftTopRadius: 8,
- rightBottomRadius: 8,
- child: Container(
- height: 20,
- width: 35,
- alignment: Alignment.center,
- decoration: BoxDecoration(
- gradient: LinearGradient(
- colors: index == 0
- ? [Color(0xff840AF5), Color(0xff9D32FE)]
- : [Color(0xffFF934C), Color(0xffFC686F)],
- )),
- // color: Color(0xff840AF5),
- child: Text(
- index == 0 ? '热销' : '超值',
- style: TextStyle(color: Colors.white, fontSize: 11),
- ),
- ))
- : Container(),
- ],
- ));
- }
- List<Container> _buildGuidTitleList() {
- return List<Container>.generate(
- moneyList.length,
- // setMealList.length,
- (int index) => Container(
- // padding: EdgeInsets.only(top: 15),
- child: _cell(
- title: setMealList[index]["title"],
- money: setMealList[index]["money"],
- detalMoney: setMealList[index]["detalMoney"],
- isSelect: moneyList[index] == selectedRecord,
- index: index,
- ontap: () {
- setState(() {
- selectedRecord = moneyList[index];
- });
- // int nums = index + 1;
- // String index = nums.toString();
- // NavigatorUtils.push(
- // context, "${WodeRouter.orderPage}?checkType=$index");
- },
- ),
- ));
- }
- return TitleCard(
- height: 260,
- title: '推荐套餐',
- body: Container(
- margin: EdgeInsets.only(top: 10),
- child: moneyList.length > 0
- ? GridView(
- // physics: const NeverScrollableScrollPhysics(),
- gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
- // 一行几列
- crossAxisCount: 2,
- // 设置每子元素的大小(宽高比)
- childAspectRatio: 2.0,
- // 元素的左右的 距离
- crossAxisSpacing: 20,
- // 子元素上下的 距离
- mainAxisSpacing: 10,
- ),
- //次轴元素间距
- children: _buildGuidTitleList(), //添加
- )
- : loadCircle(),
- ));
- }
- _frindes() {
- return GestureDetector(
- onTap: () {
- NavigatorUtils.push(context, "${WodeRouter.qrshare}");
- },
- child: Container(
- height: 185,
- margin: EdgeInsets.only(left: 10, right: 10, bottom: 5),
- decoration: new BoxDecoration(
- color: Colors.white,
- //设置四周圆角 角度
- borderRadius: BorderRadius.all(Radius.circular(6.0)),
- ),
- child: Stack(
- children: [
- Positioned(
- top: 0,
- right: -10,
- left: -10,
- bottom: -10,
- child: ClipRRect(
- borderRadius: BorderRadius.circular(6),
- child: LoadAssetImage("img_Invite_friends_bg",
- // width: double.infinity,
- // height: ScreenUtil().setHeight(260),
- fit: BoxFit.fill),
- ),
- ),
- Positioned(
- top: 30,
- left: 25,
- child: Column(
- // mainAxisAlignment: MainAxisAlignment.start,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- RichText(
- text: TextSpan(
- text: '邀请好友',
- style: TextStyle(
- fontSize: 24,
- color: Colors.black,
- fontWeight: FontWeight.bold,
- ),
- children: [
- TextSpan(
- text: '返佣金',
- style: TextStyle(
- fontSize: 24,
- color: Colors.red,
- fontWeight: FontWeight.bold),
- ),
- ],
- ),
- ),
- SizedBox(
- height: 10,
- ),
- Text('邀请好友开会员赚佣金')
- ],
- )),
- Positioned(
- left: 15,
- bottom: 15,
- right: 15,
- child: Row(
- // mainAxisAlignment:MainAxisAlignment.spaceBetween ,
- // crossAxisAlignment: CrossAxisAlignment.baseline,
- children: [
- Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- '邀请好友',
- style: TextStyle(color: Color(0xffEEA025)),
- ),
- Text('多邀多得,超多佣金等你来拿',
- style: TextStyle(color: Colours.text_gray))
- ],
- ),
- Expanded(child: Container()),
- Container(
- padding: EdgeInsets.all(3),
- decoration: BoxDecoration(
- //背景
- color: Colors.white,
- //设置四周圆角 角度
- borderRadius: BorderRadius.all(Radius.circular(15.0)),
- //设置四周边框
- border: Border.all(
- width: 1,
- color: Colors.red,
- ),
- ),
- child: InkWell(
- onTap: () {
- NavigatorUtils.push(
- context, "${WodeRouter.qrshare}");
- },
- child: Text(' 立即邀请 ',
- style:
- TextStyle(color: Colors.red, fontSize: 13)),
- ),
- )
- ],
- ))
- ],
- ),
- ));
- }
- _buybtn() {
- return InkWell(
- onTap: () {
- if (_isAuth) {
- showToast('产品正在免费体验期,无需付费购买');
- return;
- }
- NavigatorUtils.push(context,
- "${WodeRouter.vipService}?id=&selectid=${selectedRecord.id.toString()}");
- },
- child: Container(
- height: 72,
- margin: EdgeInsets.only(left: 0, right: 0, bottom: 5),
- child: Stack(
- children: [
- Positioned(
- top: 0,
- right: 0,
- left: 0,
- bottom: 0,
- child: LoadAssetImage(
- "img_buyvip_btnbg",
- // width: double.infinity,
- // height: ScreenUtil().setHeight(260),
- fit: BoxFit.cover,
- ),
- ),
- Positioned(
- left: 40,
- child: Container(
- alignment: Alignment.centerLeft,
- height: 60,
- child: RichText(
- text: TextSpan(
- text: '¥',
- style: TextStyle(
- fontSize: 15,
- color: Color(0xff3E3835),
- fontWeight: FontWeight.bold,
- ),
- children: [
- TextSpan(
- text: '${selectedRecord.price}',
- style: TextStyle(
- fontSize: 30,
- color: Color(0xff3E3835),
- fontWeight: FontWeight.bold),
- ),
- TextSpan(
- text: '/${selectedRecord.period}个月',
- style: TextStyle(
- fontSize: 15,
- color: Color(0xff3E3835),
- fontWeight: FontWeight.bold),
- ),
- // TextSpan(
- // text: '¥${selectedRecord.price}',
- // style: TextStyle(
- // fontSize: 15,
- // color: Color(0xff3E3835),
- // fontWeight: FontWeight.bold,
- // decoration: TextDecoration.lineThrough,
- // decorationColor: Color(0xff3E3835),
- // ),
- // ),
- ],
- ),
- ),
- )),
- Positioned(
- right: 40,
- child: Container(
- alignment: Alignment.centerLeft,
- height: 65,
- child: Text(
- '立即续费',
- style: TextStyle(color: Colors.white, fontSize: 18),
- )))
- ],
- ),
- ),
- );
- }
- Widget loadCircle() {
- return Container(
- padding: EdgeInsets.only(top: 10, bottom: 10),
- color: ThemeUtils.getTabsBg(context),
- child: Center(
- child: SpinKitFadingCircle(
- color: Colors.blueAccent,
- size: 30.0,
- ),
- ),
- );
- }
- @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(
- // color: Colors.red,
- margin: EdgeInsets.only(left: 10, right: 10, bottom: 10),
- 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: Color(0xff222222),
- 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 SwipeWidget extends StatelessWidget {
- const SwipeWidget({Key key, this.banners, this.onClickItem, this.onChangItem})
- : super(key: key);
- final List<dynamic> banners;
- final Function onClickItem;
- final Function onChangItem;
- @override
- Widget build(BuildContext context) {
- double width = MediaQuery.of(context).size.width;
- double height = ScreenUtil().setWidth(180);
- return Container(
- width: width,
- height: height,
- child: Swiper(
- itemBuilder: (BuildContext context, index) {
- return Container(
- width: width,
- height: height,
- child: LoadNetworkImage(
- banners[index].image,
- width: width,
- height: height,
- // fit: BoxFit.none
- ),
- );
- },
- pagination: SwiperPagination(
- builder: DotSwiperPaginationBuilder(
- color: Colors.grey,
- activeColor: Colors.white,
- size: 6,
- activeSize: 6,
- ),
- ),
- itemCount: banners.length,
- scrollDirection: Axis.horizontal,
- autoplay: false,
- onTap: (index) {
- onClickItem(index, banners[index]);
- },
- onIndexChanged: (index) {
- onChangItem(index, banners[index]);
- },
- ),
- );
- }
- }
- class Privilege extends StatelessWidget {
- const Privilege({Key key, this.initList}) : super(key: key);
- final List<dynamic> initList;
- List<Widget> listWidget(context) => initList.asMap().keys.map((i) {
- double width = MediaQuery.of(context).size.width;
- return GestureDetector(
- child: Container(
- margin: EdgeInsets.only(right: 10),
- padding: EdgeInsets.only(top: 10, bottom: 10),
- child: Row(
- children: <Widget>[
- SizedBox(width: ScreenUtil().setWidth(i == 0 ? 10 : 10)),
- Container(
- width: ScreenUtil().setWidth(120),
- padding: EdgeInsets.only(top: 20, bottom: 20),
- decoration: BoxDecoration(
- color: ThemeUtils.getTabsBg(context),
- borderRadius: BorderRadius.circular(5),
- boxShadow: [
- BoxShadow(
- offset: Offset(0, 0), //x,y轴
- color: Colors.grey[300], //投影颜色
- blurRadius: 5, //投影距离
- )
- ],
- ),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.center,
- children: <Widget>[
- // Icon(
- // IconData(initList[i]['icon'], fontFamily: "Iconfont"),
- // size: 24.0,
- // color: Color.fromRGBO(51, 51, 51, 1),
- // ),
- Container(
- margin: EdgeInsets.only(bottom: 8),
- child: LoadNetworkImage(
- initList[i].image,
- width: 30,
- height: 30,
- ),
- ),
- Text(
- initList[i].name ?? '',
- textAlign: TextAlign.start,
- style: TextStyle(
- fontSize: ScreenUtil().setSp(14),
- ),
- ),
- Text(
- initList[i].descr ?? '',
- textAlign: TextAlign.start,
- style: TextStyle(
- fontSize: ScreenUtil().setSp(14),
- color: Color(0xff999999),
- ),
- overflow: TextOverflow.ellipsis,
- ),
- ],
- ),
- ),
- ],
- ),
- ),
- onTap: () {
- // print(i);
- },
- );
- }).toList();
- @override
- Widget build(BuildContext context) {
- return ListView(
- scrollDirection: Axis.horizontal,
- padding: EdgeInsets.all(0),
- children: listWidget(context),
- );
- }
- }
|