diff --git a/lib/community/community_course.dart b/lib/community/community_course.dart index 7050596d..ba0a850a 100644 --- a/lib/community/community_course.dart +++ b/lib/community/community_course.dart @@ -221,7 +221,7 @@ class _CommunityCourse extends State bannerData, ), - SizedBox(height: 28.h), + SizedBox(height: 18.h), ///合集列表 HomeClass( diff --git a/lib/community/order_page.dart b/lib/community/order_page.dart index 9f6163fe..9f5d05aa 100644 --- a/lib/community/order_page.dart +++ b/lib/community/order_page.dart @@ -12,8 +12,7 @@ class OrderPage extends StatefulWidget { } } -class _OrderPage extends State - with SingleTickerProviderStateMixin,AutomaticKeepAliveClientMixin { +class _OrderPage extends State with SingleTickerProviderStateMixin,AutomaticKeepAliveClientMixin { TabController? tabcontroller; List lables = [ diff --git a/lib/home/help_farmers/help_farmers_page.dart b/lib/home/help_farmers/help_farmers_page.dart index 82ddfc0a..e1d24255 100644 --- a/lib/home/help_farmers/help_farmers_page.dart +++ b/lib/home/help_farmers/help_farmers_page.dart @@ -52,8 +52,6 @@ class _HelpFarmersPage extends State { try { BaseListData? baseData = await apiService?.getConfig().catchError((error) { - SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type), - alignment: Alignment.center); networkStatus = -1; refreshController.refreshFailed(); return BaseListData()..isSuccess = false; @@ -79,6 +77,30 @@ class _HelpFarmersPage extends State { Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.transparent, + appBar: networkStatus == 2 + ? AppBar( + backgroundColor: Color(0xFF32A060), + leading: InkWell( + child: Icon( + Icons.arrow_back, + color: Colors.white, + ), + onTap: () { + Navigator.of(context).pop(); + }, + ), + title: Text( + S.of(context).zhunongzhuanqu, + style: TextStyle( + fontWeight: MyFontWeight.semi_bold, + fontSize: 17.sp, + color: Colors.white, + ), + ), + centerTitle: true, + elevation: 0, + ) + : null, body: networkStatus == 0 ? recommendSm() : (networkStatus == 2 @@ -91,7 +113,8 @@ class _HelpFarmersPage extends State { fontSize: 16.sp, margin: EdgeInsets.only(top: 120.h, left: 60.w, right: 60.w), - )) + ), + ) : NestedScrollView( headerSliverBuilder: (context, inner) { return [ diff --git a/lib/home/points_mall_page.dart b/lib/home/points_mall_page.dart index abf73855..6c3226c6 100644 --- a/lib/home/points_mall_page.dart +++ b/lib/home/points_mall_page.dart @@ -71,18 +71,16 @@ class _PointsMallPage extends State BaseData>? banner = await client?.queryBanner({ "model": {"type": "CREDIT_INDEX"}, }).catchError((onError) { - return Future.value(null); + return BaseData>()..isSuccess = false; }); - if ((banner?.isSuccess ?? false) && - (banner?.data?.records?.isNotEmpty ?? false)) { + if ((banner?.isSuccess ?? false) && (banner?.data?.records?.isNotEmpty ?? false)) { bannerData.clear(); bannerData.addAll(banner?.data?.records ?? []); } - BaseData? baseData = - await client?.queryInfo().catchError((onError) { - return Future.value(null); + BaseData? baseData = await client?.queryInfo().catchError((onError) { + return BaseData()..isSuccess = false; }); if (baseData?.isSuccess ?? false) { userInfo = baseData!.data; @@ -98,13 +96,11 @@ class _PointsMallPage extends State ); final SharedPreferences value = await SharedPreferences.getInstance(); - client = ApiService(Dio(), - context: context, token: value.getString('token'), showLoading: false); + client = ApiService(Dio(), context: context, token: value.getString('token'), showLoading: false); await queryUser(); - BaseData>? dataCategory = - await client?.goodsCategory({ + BaseData>? dataCategory = await client?.goodsCategory({ "current": 1, "map": {}, "model": {"pageNum": 1, "pageSize": 20, "searchKey": ""}, @@ -114,11 +110,10 @@ class _PointsMallPage extends State }).catchError((onError) { _refreshController.loadFailed(); _refreshController.refreshFailed(); - return Future.value(null); + return BaseData>()..isSuccess = false; }); - if ((dataCategory?.isSuccess ?? false) && - (dataCategory?.data?.records?.isNotEmpty ?? false)) { + if ((dataCategory?.isSuccess ?? false) && (dataCategory?.data?.records?.isNotEmpty ?? false)) { gooodsCategorys.clear(); gooodsCategorys.add(GoodsCategory()..name = S.of(context).quanbu); gooodsCategorys.addAll(dataCategory?.data?.records ?? []); @@ -132,11 +127,10 @@ class _PointsMallPage extends State "pageSize": 10, "state": 1 }; - BaseData>? baseData = - await client?.creditGoods(param).catchError((onError) { + BaseData>? baseData = await client?.creditGoods(param).catchError((onError) { _refreshController.loadFailed(); _refreshController.refreshFailed(); - return Future.value(null); + return BaseData>()..isSuccess = false; }); SmartDialog.dismiss(); if (baseData?.isSuccess ?? false) { diff --git a/lib/home/welfare_exchange.dart b/lib/home/welfare_exchange.dart index 912b8409..0f1aee60 100644 --- a/lib/home/welfare_exchange.dart +++ b/lib/home/welfare_exchange.dart @@ -66,7 +66,7 @@ class _WelfareExchange extends State queryUser() async { BaseData? baseData = await apiService?.queryInfo().catchError((onError) { - return Future.value(null); + return BaseData()..isSuccess = false; }); if (baseData?.isSuccess ?? false) { userInfo = baseData!.data; @@ -99,7 +99,7 @@ class _WelfareExchange extends State "state": 1 }).catchError((onError) { refreshController.refreshFailed(); - return Future.value(null); + return BaseData>()..isSuccess = false; }); if (goodsData?.isSuccess ?? false) { gooods.clear(); @@ -117,7 +117,7 @@ class _WelfareExchange extends State }).catchError((onError) { refreshController.loadFailed(); refreshController.refreshFailed(); - return Future.value(null); + return BaseData>()..isSuccess = false; }); if ((dataCategory?.isSuccess ?? false) && @@ -139,7 +139,7 @@ class _WelfareExchange extends State await apiService?.creditGoods(param).catchError((onError) { refreshController.loadFailed(); refreshController.refreshFailed(); - return Future.value(null); + return BaseData>()..isSuccess = false; }); if (pageGoods?.isSuccess ?? false) { if (pageNum == 1) { @@ -169,6 +169,7 @@ class _WelfareExchange extends State @override Widget build(BuildContext context) { + super.build(context); return Scaffold( backgroundColor: Colors.white, body: NestedScrollView( @@ -176,12 +177,14 @@ class _WelfareExchange extends State return [ SliverAppBar( pinned: true, - backgroundColor: Colors.white, + backgroundColor: Color(0xFF277D4B), elevation: 0, title: Text( S.of(context).fuliduihuan, - style: - TextStyle(fontWeight: FontWeight.w500, color: Colors.white), + style: TextStyle( + fontWeight: FontWeight.w500, + color: Colors.white, + ), ), centerTitle: true, leading: GestureDetector( @@ -199,35 +202,45 @@ class _WelfareExchange extends State ), ), ), + toolbarHeight: kToolbarHeight, + collapsedHeight: kToolbarHeight + MediaQuery.of(context).padding.top, flexibleSpace: FlexibleSpaceBar( - background: Stack( - children: [ - Container( - // padding: EdgeInsets.only(top: 40.h), - height: 172.h, - decoration: BoxDecoration( - // border: Border.all(color: Colors.white,width: 0.5), - color: Color(0xFF277D4B), - shape: BoxShape.rectangle, - borderRadius: BorderRadius.only( - bottomRight: Radius.circular(40.r), - bottomLeft: Radius.circular(40.r), + background: Stack( + children: [ + Positioned.fill( + top: kToolbarHeight + MediaQuery.of(context).padding.top, + child: Container( + // padding: EdgeInsets.only(top: 40.h), + height: 172.h - (kToolbarHeight + MediaQuery.of(context).padding.top), + decoration: BoxDecoration( + color: Colors.white, + ), + padding: EdgeInsets.only(bottom: 75.h), + child: Container( + decoration: BoxDecoration( + color: Color(0xFF277D4B), + shape: BoxShape.rectangle, + borderRadius: BorderRadius.only( + bottomRight: Radius.circular(40.r), + bottomLeft: Radius.circular(40.r), + ), + ), + ), ), ), - ), - Container( - alignment: Alignment.topCenter, - margin: EdgeInsets.only(top: 110.h), - child: pointUser(), - ), - ], - )), - expandedHeight: - MediaQuery.of(context).size.height >= 750 ? 245.h : 258.h, + Container( + alignment: Alignment.topCenter, + margin: EdgeInsets.only(top: 110.h), + child: pointUser(), + ), + ], + ), + ), + expandedHeight: MediaQuery.of(context).size.height >= 750 ? 245.h : 258.h, bottom: PreferredSize( preferredSize: Size(double.infinity, 0), child: DefaultTabController( - length: gooodsCategorys == null ? 0 : gooodsCategorys.length, + length: gooodsCategorys.length, child: Container( color: Colors.white, alignment: Alignment.centerLeft, @@ -251,10 +264,7 @@ class _WelfareExchange extends State unselectedLabelColor: Color(0xff4D4D4D), indicatorSize: TabBarIndicatorSize.label, //指示器与文字等宽 - tabs: gooodsCategorys - ?.map((e) => MyTab(text: "${e.name}")) - .toList() ?? - [], + tabs: gooodsCategorys.map((e) => MyTab(text: "${e.name}")).toList(), onTap: (index) { categoryId = gooodsCategorys[index].id; pageNum = 1; @@ -281,9 +291,9 @@ class _WelfareExchange extends State onRefresh: _onRefresh, child: Container( color: Colors.white, - padding: EdgeInsets.only(top: 15.h), child: pointList(), - )), + ), + ), ), ); } @@ -291,16 +301,17 @@ class _WelfareExchange extends State Widget pointUser() { return Container( decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all(Radius.circular(4.r)), - boxShadow: [ - BoxShadow( - color: Colors.black.withAlpha(12), - offset: Offset(0, 1), - blurRadius: 8, - spreadRadius: 0, - ) - ]), + color: Colors.white, + borderRadius: BorderRadius.all(Radius.circular(4.r)), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 1), + blurRadius: 8, + spreadRadius: 0, + ), + ], + ), margin: EdgeInsets.all(16), padding: EdgeInsets.all(16), child: Row( @@ -352,9 +363,7 @@ class _WelfareExchange extends State ), ) : Text( - userInfo == null - ? "" - : AppUtils.phoneEncode(userInfo?.phone ?? ""), + userInfo == null ? "" : AppUtils.phoneEncode(userInfo?.phone ?? ""), style: TextStyle( fontSize: 12.sp, fontWeight: MyFontWeight.regular, @@ -469,11 +478,11 @@ class _WelfareExchange extends State ), ) : GridView.builder( - itemCount: goods?.length ?? 0, + itemCount: goods.length, padding: EdgeInsets.only( - left: 16.w, - right: 16.w, - top: 18.h, + left: 12.w, + right: 12.w, + top: 16.h, bottom: 16.h, ), shrinkWrap: true, @@ -482,12 +491,11 @@ class _WelfareExchange extends State //一行的Widget数量 crossAxisCount: 2, //水平子Widget之间间距 - crossAxisSpacing: 11.w, + crossAxisSpacing: 12.w, //垂直子Widget之间间距 - mainAxisSpacing: 16.w, + mainAxisSpacing: 12.w, //子Widget宽高比例 0.59 - childAspectRatio: - 200 / (285 / 2 + (285 / 2) * AppUtils.textScale(context)), + childAspectRatio: 200 / (285 / 2 + (285 / 2) * AppUtils.textScale(context)), ), itemBuilder: (context, index) { return GestureDetector( diff --git a/lib/home/welfare_page.dart b/lib/home/welfare_page.dart index fff77812..2fcda1dd 100644 --- a/lib/home/welfare_page.dart +++ b/lib/home/welfare_page.dart @@ -4,6 +4,8 @@ import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:flutter_swiper_view/flutter_swiper_view.dart'; +import 'package:get/get.dart'; +import 'package:get/utils.dart'; import 'package:huixiang/data/base_data.dart'; import 'package:huixiang/data/coupon.dart'; import 'package:huixiang/data/goods.dart'; @@ -208,7 +210,6 @@ class _WelfarePage extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ weekCoupons(), - Container( color: Colors.white, padding: EdgeInsets.only(left: 14, right: 14), @@ -219,7 +220,6 @@ class _WelfarePage extends State { ], ), ) - // activityTask(), ], ), @@ -234,117 +234,116 @@ class _WelfarePage extends State { /// 周券包推荐 Widget weekCoupons() { return Container( - width: double.infinity, - decoration: BoxDecoration( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(6), - topRight: Radius.circular(6), + width: double.infinity, + decoration: BoxDecoration( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(6), + topRight: Radius.circular(6), + ), + color: Colors.white, + boxShadow: [ + BoxShadow( + color: Color(0x08213303).withAlpha(12), + offset: Offset(0, 2), + blurRadius: 3, + spreadRadius: 0, ), - color: Colors.white, - boxShadow: [ - BoxShadow( - color: Color(0x08213303).withAlpha(12), - offset: Offset(0, 2), - blurRadius: 3, - spreadRadius: 0, + ], + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.symmetric( + horizontal: 17.w, + vertical: 16.h, ), - ], - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.symmetric(horizontal: 17.w, vertical: 16.h), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Text( - S.of(context).lingquanzhongxin, - style: TextStyle( - color: Color(0xFF0D0D0D), - fontSize: 15.sp, - fontWeight: MyFontWeight.bold, - ), - ), - Text( - S.of(context).meizhousangengxin, - style: TextStyle( - color: Color(0xFF4D4D4D), - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - ), - ), - ], - )), - coupon.length == 0 - ? NoDataView( - src: "assets/image/ka.webp", - isShowBtn: false, - text: S.of(context).haimeiyouyouhuiquankeyilingqu, - fontSize: 16.sp, - ) - : Container( - height: coupon[0].length >= 3 ? 350.h : 250.h, - child: Swiper( - onIndexChanged: (it) { - swiperIndex = it; - }, - index: couponIndex, - viewportFraction: 0.9, - scale: 0.7, - key: UniqueKey(), - pagination: SwiperPagination( - alignment: Alignment.bottomCenter, - builder: DotSwiperPaginationBuilder( - size: 8, - activeSize: 8, - space: 5, - activeColor: Colors.black, - color: Colors.black.withAlpha(76), - ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + S.of(context).lingquanzhongxin, + style: TextStyle( + color: Color(0xFF0D0D0D), + fontSize: 15.sp, + fontWeight: MyFontWeight.bold, + ), + ), + Text( + S.of(context).meizhousangengxin, + style: TextStyle( + color: Color(0xFF4D4D4D), + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + ), + ), + ], + ), + ), + coupon.length == 0 + ? NoDataView( + src: "assets/image/ka.webp", + isShowBtn: false, + text: S.of(context).haimeiyouyouhuiquankeyilingqu, + fontSize: 16.sp, + ) + : Container( + // height: coupon[0].length >= 3 ? 350.h : 250.h, + height: coupon[0].length >= 3 ? 111.h * 3 : 111.h * 2, + child: Swiper( + onIndexChanged: (it) { + swiperIndex = it; + }, + index: couponIndex, + viewportFraction: (Get.width - 28) / Get.width, + scale: 0.7, + key: UniqueKey(), + pagination: SwiperPagination( + alignment: Alignment.bottomCenter, + margin: EdgeInsets.only(bottom: 15.h), + builder: DotSwiperPaginationBuilder( + size: 8, + activeSize: 8, + space: 5, + activeColor: Colors.black, + color: Colors.black.withAlpha(76), ), - physics: BouncingScrollPhysics(), - itemBuilder: (context, position) { - return Column( - children: [ - Container( - child: weekList(coupon[position]), - ), - ], - ); - }, - itemCount: coupon.length ?? 0, ), - ) - ], - )); + physics: BouncingScrollPhysics(), + itemBuilder: (context, position) { + return weekList(coupon[position]); + }, + itemCount: coupon.length, + ), + ) + ], + ), + ); } Widget weekList(List cops) { - return Expanded( - child: (cops?.isEmpty ?? true) - ? NoDataView( - src: "assets/image/ka.webp", - isShowBtn: false, - text: S.of(context).haimeiyouyouhuiquankeyilingqu, - fontSize: 16.sp, - ) - : ListView.builder( - padding: EdgeInsets.zero, - itemCount: cops.length ?? 0, - scrollDirection: Axis.vertical, - shrinkWrap: true, - physics: BouncingScrollPhysics(), - itemBuilder: (context, position) { - return GestureDetector( - onTap: () {}, - child: weekCoupon(cops[position]), - ); - }, - ), - ); + return (cops.isEmpty) + ? NoDataView( + src: "assets/image/ka.webp", + isShowBtn: false, + text: S.of(context).haimeiyouyouhuiquankeyilingqu, + fontSize: 16.sp, + ) + : ListView.builder( + padding: EdgeInsets.zero, + itemCount: cops.length, + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: BouncingScrollPhysics(), + itemBuilder: (context, position) { + return GestureDetector( + onTap: () {}, + child: weekCoupon(cops[position]), + ); + }, + ); } ///优惠券列表 @@ -408,7 +407,7 @@ class _WelfarePage extends State { ? Color(0xFFB3B3B3) : Color(0xFF4D4D4D), ), - ) + ), ], ), ), @@ -421,7 +420,7 @@ class _WelfarePage extends State { Container( margin: EdgeInsets.only(bottom: 12), child: weekBtn(cop), - ) + ), ], ), ], @@ -625,7 +624,10 @@ class _WelfarePage extends State { receiveCoupon(cop.id); }, child: Container( - padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 2.h), + padding: EdgeInsets.symmetric( + horizontal: 12.w, + vertical: 2.h, + ), decoration: BoxDecoration( borderRadius: BorderRadius.circular(3), color: Color(0xFF32A060), @@ -647,18 +649,23 @@ class _WelfarePage extends State { child: InkWell( onTap: () { if (cop.bizType == 5 || cop.bizType == 3) { - Navigator.of(context) - .pushNamed('/router/write_off_page', arguments: { - "couponId": cop.id, - "coupon": cop, - }); + Navigator.of(context).pushNamed( + '/router/write_off_page', + arguments: { + "couponId": cop.id, + "coupon": cop, + }, + ); } else { showStoreSelector(cop.storeList); } }, child: Container( // height: 19.h, - padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 1.h), + padding: EdgeInsets.symmetric( + horizontal: 8.w, + vertical: 1.h, + ), decoration: BoxDecoration( borderRadius: BorderRadius.circular(3), border: Border.all( @@ -692,11 +699,12 @@ class _WelfarePage extends State { showAlertDialog(); } else { SmartDialog.show( - clickMaskDismiss: false, - builder: (ctx) => SettlementTips( - () {}, - text: "${baseData?.msg}", - )); + clickMaskDismiss: false, + builder: (ctx) => SettlementTips( + () {}, + text: "${baseData?.msg}", + ), + ); } } @@ -723,7 +731,7 @@ class _WelfarePage extends State { ///邀请好友 Widget inviteFriends() { return Container( - margin: EdgeInsets.only(top: 24.h, bottom: 20.h), + margin: EdgeInsets.only(top: 14.h, bottom: 20.h), child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, @@ -762,7 +770,7 @@ class _WelfarePage extends State { Widget benefitExchange() { return Container( width: double.infinity, - margin: EdgeInsets.only(top: 24.h, bottom: 20.h), + margin: EdgeInsets.only(top: 14.h, bottom: 20.h), child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, @@ -801,9 +809,6 @@ class _WelfarePage extends State { ], ), ), - SizedBox( - height: 12, - ), (goods.length == 0) ? NoDataView( src: "assets/image/xiao_fei.webp", @@ -815,9 +820,7 @@ class _WelfarePage extends State { : GridView.builder( itemCount: goods.length > 6 ? 6 : goods.length, padding: EdgeInsets.only( - // left: 16.w, - // right: 16.w, - top: 18.h, + top: 12.h, bottom: 16.h, ), shrinkWrap: true, diff --git a/lib/im/chat_friend_group.dart b/lib/im/chat_friend_group.dart index 4b966201..ae86eb1b 100644 --- a/lib/im/chat_friend_group.dart +++ b/lib/im/chat_friend_group.dart @@ -35,8 +35,8 @@ class _ChatFriendGroup extends State void initState() { super.initState(); tabController = TabController(length: 3, vsync: this, initialIndex: 0); - tabController?.addListener(() { - if(!(tabController?.indexIsChanging ?? false)) + tabController.addListener(() { + if(!(tabController.indexIsChanging)) setState(() {}); }); loadFinish(); @@ -87,11 +87,11 @@ class _ChatFriendGroup extends State Align( alignment: Alignment.centerLeft, child: Theme( - data: ThemeData( - splashColor: Colors.transparent, // 点击时的水波纹颜色设置为透明 - highlightColor: Colors.transparent, // 点击时的背景高亮颜色设置为透明 - ), - child: TabBar( + data: ThemeData( + splashColor: Colors.transparent, // 点击时的水波纹颜色设置为透明 + highlightColor: Colors.transparent, // 点击时的背景高亮颜色设置为透明 + ), + child: TabBar( controller: tabController, isScrollable: true, //可滚动 @@ -100,6 +100,9 @@ class _ChatFriendGroup extends State fontSize: 16.sp, fontWeight: FontWeight.bold, ), + tabAlignment: TabAlignment.start, + dividerColor: Colors.transparent, + dividerHeight: 0, unselectedLabelStyle: TextStyle( fontSize: 15.sp, fontWeight: FontWeight.normal, @@ -107,8 +110,15 @@ class _ChatFriendGroup extends State //未选中文字颜色 unselectedLabelColor: Color(0XFFA29E9E), indicator: CustomUnderlineTabIndicator( - insets: EdgeInsets.only(top: 10.w, bottom: 2.w), - borderSide: BorderSide(width: 5.w, color: Color(0XFF32A060)),), + insets: EdgeInsets.only( + top: 10.w, + bottom: 2.w, + ), + borderSide: BorderSide( + width: 5.w, + color: Color(0XFF32A060), + ), + ), indicatorSize: TabBarIndicatorSize.label, //指示器与文字等宽 tabs: [ @@ -116,7 +126,8 @@ class _ChatFriendGroup extends State MyTab(text: S.of(context).guanzhu), MyTab(text: S.of(context).fensi), ], - )), + ), + ), ), Expanded( child: TabBarView( @@ -127,7 +138,7 @@ class _ChatFriendGroup extends State FriendGroupList(_allKey[2],"true","粉丝"), ], ), - ) + ), ], ), ), diff --git a/lib/im/contact_share.dart b/lib/im/contact_share.dart index add97e08..576b6f98 100644 --- a/lib/im/contact_share.dart +++ b/lib/im/contact_share.dart @@ -74,7 +74,8 @@ class _ContactsShare extends State { fontSize: 17.sp, color: Color(0xFF0D0D0D), fontWeight: MyFontWeight.regular, - )), + ), + ), ), mineFollowList(), ], diff --git a/lib/im/im_view/friend_groip_list.dart b/lib/im/im_view/friend_groip_list.dart index ae9d086c..89960dc8 100644 --- a/lib/im/im_view/friend_groip_list.dart +++ b/lib/im/im_view/friend_groip_list.dart @@ -74,13 +74,13 @@ class _FriendGroupList extends State { ///关注、粉丝列表 queryFollowList() async { SharedPreferences sharedPreferences = await SharedPreferences.getInstance(); - if (apiService == null) - apiService = ApiService( - Dio(), - context: context, - token: sharedPreferences.getString("token"), - showLoading: false, - ); + apiService ??= ApiService( + Dio(), + context: context, + token: sharedPreferences.getString("token"), + showLoading: false, + ); + BaseData>? baseData = await apiService?.followList({ "isMyFans": widget.isMyFans, "pageNum": pageNum, @@ -88,6 +88,7 @@ class _FriendGroupList extends State { }).catchError((error) { _refreshController.refreshFailed(); _refreshController.loadFailed(); + return BaseData>()..isSuccess = false; }); if (baseData?.isSuccess ?? false) { if (pageNum == 1) { @@ -104,13 +105,13 @@ class _FriendGroupList extends State { ///好友列表 queryMutualFollowList() async { SharedPreferences sharedPreferences = await SharedPreferences.getInstance(); - if (apiService == null) - apiService = ApiService( - Dio(), - context: context, - token: sharedPreferences.getString("token"), - showLoading: false, - ); + apiService ??= ApiService( + Dio(), + context: context, + token: sharedPreferences.getString("token"), + showLoading: false, + ); + BaseData>? baseData = await apiService?.mutualFollowList({ "isMyFans": widget.isMyFans, "pageNum": 1, @@ -118,6 +119,7 @@ class _FriendGroupList extends State { }).catchError((error) { _refreshController.refreshFailed(); _refreshController.loadFailed(); + return BaseData>()..isSuccess = false; }); if (baseData?.isSuccess ?? false) { if (pageNum == 1) { @@ -146,7 +148,11 @@ class _FriendGroupList extends State { ? "目前暂无${widget.title}" : ("目前暂无${widget.title},${widget.title == "粉丝" ? "听说多发动态可以涨粉哦" : "可以在社群广场中关注自己喜欢的人哦"}~"), fontSize: 16.sp, - margin: EdgeInsets.only(top: 120.h, left: 60.w, right: 60.w), + margin: EdgeInsets.only( + top: 120.h, + left: 60.w, + right: 60.w, + ), ) : Expanded( child: ListView.builder( @@ -184,33 +190,39 @@ class _FriendGroupList extends State { Widget friendGroupItem(Follow list) { return Container( - margin: EdgeInsets.only(left: 16.w, right: 16.w, bottom: 24.h), - child: Row(children: [ - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(100), - ), - child: MImage( - list?.avatar ?? "", - isCircle: true, - width: 54.h, - height: 54.h, - fit: BoxFit.cover, - errorSrc: "assets/image/default_1.webp", - fadeSrc: "assets/image/default_1.webp", - ), + margin: EdgeInsets.only( + left: 16.w, + right: 16.w, + bottom: 24.h, ), - Padding( - padding: EdgeInsets.only(left:12.w), - child: Text( - list?.nickname ?? "", - style: TextStyle( - fontSize: 16.sp, - color: Color(0xFF060606), - fontWeight: FontWeight.w500), + child: Row(children: [ + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(100), + ), + child: MImage( + list.avatar ?? "", + isCircle: true, + width: 54.h, + height: 54.h, + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.webp", + fadeSrc: "assets/image/default_1.webp", + ), ), - ) - ]), + Padding( + padding: EdgeInsets.only(left:12.w), + child: Text( + list.nickname ?? "", + style: TextStyle( + fontSize: 16.sp, + color: Color(0xFF060606), + fontWeight: FontWeight.w500, + ), + ), + ) + ], + ), ); } @@ -220,8 +232,10 @@ class _FriendGroupList extends State { behavior: HitTestBehavior.opaque, onTap:(){Navigator.of(context).pushNamed('/router/im_search');}, child: Container( - margin: EdgeInsets.fromLTRB(16.w, 0, 16.w, 24.h), - padding: EdgeInsets.symmetric(vertical: 13.h), + margin: EdgeInsets.fromLTRB( + 16.w, 0, 16.w,12.h, + ), + padding: EdgeInsets.symmetric(vertical: 12.h), decoration: BoxDecoration( color: Color(0xFFFDFCFC), borderRadius: BorderRadius.circular(4), @@ -229,7 +243,10 @@ class _FriendGroupList extends State { child: Row( children: [ Padding( - padding: EdgeInsets.only(left: 15.w, right: 5.w), + padding: EdgeInsets.only( + left: 15.w, + right: 5.w, + ), child: Image.asset( "assets/image/icon_search.webp", width: 14.h, @@ -246,7 +263,7 @@ class _FriendGroupList extends State { ), ), ], - ) + ), ), ); } diff --git a/lib/mine/mine_page.dart b/lib/mine/mine_page.dart index d8719ff0..f2f83a01 100644 --- a/lib/mine/mine_page.dart +++ b/lib/mine/mine_page.dart @@ -43,8 +43,7 @@ class MinePage extends StatefulWidget { } } -class MinePageState extends State - with AutomaticKeepAliveClientMixin, ParseErrorLogger { +class MinePageState extends State with AutomaticKeepAliveClientMixin, ParseErrorLogger { ApiService? apiService; UserInfo? userInfo; List ranks = []; @@ -113,8 +112,7 @@ class MinePageState extends State errorLogger: this, ); - BaseListData? rankData = - await apiService?.rankList().catchError((onError) { + BaseListData? rankData = await apiService?.rankList().catchError((onError) { SmartDialog.showToast(AppUtils.dioErrorTypeToString(onError.type), alignment: Alignment.center); _refreshController.refreshFailed(); @@ -128,7 +126,7 @@ class MinePageState extends State BaseData? baseDate = await apiService?.queryInfo().catchError((onError) { _refreshController.refreshFailed(); - return Future.value(null); + return BaseData()..isSuccess = false; }); if (baseDate?.isSuccess ?? false) { userInfo = baseDate?.data; @@ -181,7 +179,7 @@ class MinePageState extends State "state": 1 }).catchError((error) { _refreshController.refreshFailed(); - return Future.value(null); + return BaseData>()..isSuccess = false; }); if (baseData?.isSuccess ?? false) { couponNum = baseData?.data?.total; @@ -213,7 +211,7 @@ class MinePageState extends State BaseData? baseData = await apiService?.socialInfo().catchError((onError) { _refreshController.refreshFailed(); - return Future.value(null); + return BaseData()..isSuccess = false; }); if (baseData?.isSuccess ?? false) { infoNumber = baseData?.data; @@ -351,9 +349,8 @@ class MinePageState extends State ); }, child: Container( - margin: EdgeInsets.only(left: 16.w, right: 16.w, bottom: 30.h), - padding: - EdgeInsets.only(left: 12.w, top: 12.h, right: 10.w, bottom: 17.h), + margin: EdgeInsets.only(left: 16.w, right: 16.w, bottom: 16.h), + padding: EdgeInsets.only(left: 12.w, top: 12.h, right: 10.w, bottom: 17.h), width: double.infinity, decoration: BoxDecoration( color: Colors.white, @@ -455,7 +452,7 @@ class MinePageState extends State Widget spreadImage() { return Container( width: double.infinity, - margin: EdgeInsets.only(bottom: 24.h), + margin: EdgeInsets.only(bottom: 16.h), height: 85.h, child: activityBannerData.isNotEmpty ? Swiper( diff --git a/lib/mine/mine_view/calendar_page.dart b/lib/mine/mine_view/calendar_page.dart index 9a52183b..0d50ed6a 100644 --- a/lib/mine/mine_view/calendar_page.dart +++ b/lib/mine/mine_view/calendar_page.dart @@ -62,21 +62,33 @@ class _CalendarPage extends State with TickerProviderStateMixin { return TableCalendar( startingDayOfWeek: StartingDayOfWeek.monday, availableGestures: AvailableGestures.none, + daysOfWeekHeight: 22, headerStyle: HeaderStyle( titleCentered: false, + headerMargin: EdgeInsets.only( + left: 12, + ), leftChevronVisible: false, rightChevronVisible: false, formatButtonVisible: false, ), calendarStyle: CalendarStyle( outsideDaysVisible: false, - selectedDecoration: BoxDecoration().copyWith(color: Color(0xFF32A060)), - selectedTextStyle: TextStyle().copyWith(color: Color(0xFF333333)), - todayTextStyle: TextStyle().copyWith(color: Color(0xFFD5EBDE)), + selectedDecoration: BoxDecoration().copyWith( + color: Color(0xFF32A060), + ), + selectedTextStyle: TextStyle().copyWith( + color: Color(0xFF333333), + ), + todayTextStyle: TextStyle().copyWith( + color: Color(0xFFD5EBDE), + ), ), daysOfWeekStyle: DaysOfWeekStyle( - weekendStyle: TextStyle().copyWith(color: Color(0xFF4D4D4D)), - ), + weekendStyle: TextStyle().copyWith( + color: Color(0xFF4D4D4D), + ), + ), onDaySelected: _onDaySelected, // onVisibleDaysChanged: _onVisibleDaysChanged, onCalendarCreated: _onCalendarCreated, diff --git a/lib/mine/mine_view/community_follow.dart b/lib/mine/mine_view/community_follow.dart index 1de4ce81..1187727a 100644 --- a/lib/mine/mine_view/community_follow.dart +++ b/lib/mine/mine_view/community_follow.dart @@ -73,6 +73,8 @@ class _CommunityFollow extends State fontSize: 17.sp, fontWeight: FontWeight.bold, ), + dividerHeight: 0, + dividerColor: Colors.transparent, unselectedLabelStyle: TextStyle( fontSize: 16.sp, fontWeight: MyFontWeight.medium, @@ -86,7 +88,9 @@ class _CommunityFollow extends State MyTab( text: "关注${infoNumber?.follow ?? "0"}", ), - MyTab(text: "粉丝${infoNumber?.fans ?? "0"}"), + MyTab( + text: "粉丝${infoNumber?.fans ?? "0"}", + ), ], ), ), diff --git a/lib/mine/mine_view/mine_calendar.dart b/lib/mine/mine_view/mine_calendar.dart index f956f67c..16caa0ba 100644 --- a/lib/mine/mine_view/mine_calendar.dart +++ b/lib/mine/mine_view/mine_calendar.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:huixiang/utils/constant.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'calendar_page.dart'; @@ -14,10 +15,11 @@ class _MineCalendar extends State { @override Widget build(BuildContext context) { return Container( - margin: EdgeInsets.fromLTRB(14.w, 0.h, 14.w, 30.h), - padding: EdgeInsets.only(top: 12.h,left: 12,), + margin: EdgeInsets.fromLTRB( + 14.w, 0.h, 14.w, 30.h, + ), + alignment: Alignment.center, decoration: BoxDecoration( - // color: Colors.white, image: DecorationImage( fit: BoxFit.cover, image: AssetImage("assets/image/s_bg.webp"), @@ -29,7 +31,7 @@ class _MineCalendar extends State { offset: Offset(0, 2), blurRadius: 4, spreadRadius: 0, - ) + ), ], ), child: Stack( @@ -38,38 +40,25 @@ class _MineCalendar extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ + 12.d, GestureDetector( onTap: (){ // Navigator.of(context).pushNamed('/router/mine_greenery'); }, child: Row( children: [ - Expanded(child: Text( + 12.vd, + Text( "我的${DateTime.now().month}月足迹日历", style: TextStyle( color: Color(0xFF0D0D0D), fontWeight: MyFontWeight.semi_bold, fontSize: 15.sp, ), - ),), - // Text( - // "查看绿叶", - // style: TextStyle( - // color: Color(0xFF000000), - // fontWeight: MyFontWeight.regular, - // fontSize: 15.sp, - // ), - // ), - // Icon( - // Icons.navigate_next, - // size: 24, - // color: Colors.black, - // ), - // SizedBox(width:12,), + ), ], ), ), - SizedBox(height: 12,), CalendarPage(), ], ), @@ -80,7 +69,7 @@ class _MineCalendar extends State { fit: BoxFit.fill, ), ], - ) + ), ); } } diff --git a/lib/mine/mine_view/mine_item.dart b/lib/mine/mine_view/mine_item.dart index 45005eca..d2ce2823 100644 --- a/lib/mine/mine_view/mine_item.dart +++ b/lib/mine/mine_view/mine_item.dart @@ -20,7 +20,7 @@ class _MineItem extends State { @override Widget build(BuildContext context) { return Container( - margin: EdgeInsets.fromLTRB(16.w, 0.h, 16.w, 30.h), + margin: EdgeInsets.fromLTRB(16.w, 0.h, 16.w, 16.h), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(8), @@ -37,7 +37,9 @@ class _MineItem extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - padding: EdgeInsets.only(left: 16, top: 16, bottom: 13, right: 16), + padding: EdgeInsets.only( + left: 16, top: 16, bottom: 13, right: 16, + ), child: Text( S.of(context).qita, style: TextStyle( diff --git a/lib/mine/mine_view/mine_navbar.dart b/lib/mine/mine_view/mine_navbar.dart index 48465537..4d536661 100644 --- a/lib/mine/mine_view/mine_navbar.dart +++ b/lib/mine/mine_view/mine_navbar.dart @@ -13,9 +13,7 @@ class MineNavbar extends StatefulWidget { final SocialInfo? infoNumber; final GestureTapCallback toIntegralPage; final Function queryCoupon; - MineNavbar(this.couponNum,this.userInfo,this.infoNumber,this.toIntegralPage,this.queryCoupon); - @override State createState() { return _MineNavbar(); @@ -26,7 +24,9 @@ class _MineNavbar extends State { @override Widget build(BuildContext context) { return Container( - margin: EdgeInsets.fromLTRB(13.5.w, 15.h, 13.5.w,30.h), + margin: EdgeInsets.fromLTRB( + 13.5.w, 15.h, 13.5.w, 15.h, + ), padding: EdgeInsets.only( top: 26.h, bottom: 24.h, @@ -53,8 +53,7 @@ class _MineNavbar extends State { child: InkWell( onTap: () { SharedPreferences.getInstance().then((value) { - if (value.getString("token") == null || - value.getString("token") == "") { + if (value.getString("token") == null || value.getString("token") == "") { LoginTipsDialog().show(context); return; } @@ -75,8 +74,7 @@ class _MineNavbar extends State { child: InkWell( onTap: () { SharedPreferences.getInstance().then((value) { - if (value.getString("token") == null || - value.getString("token") == "") { + if (value.getString("token") == null || value.getString("token") == "") { LoginTipsDialog().show(context); return; } @@ -133,19 +131,32 @@ class _MineNavbar extends State { ), 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)), - ), + margin: EdgeInsets.symmetric( + vertical: 12, + horizontal: 15, + ), + child: LayoutBuilder( + builder: (BuildContext context, BoxConstraints constraints) { + double width = constraints.constrainWidth(); + return Flex( + children: List.generate(width ~/ 4, (_) { + return Container( + width: 2, + height: 1, + margin: EdgeInsets.symmetric( + horizontal: 1, + ), + child: DecoratedBox( + decoration: BoxDecoration( + color: Color(0xFFEDEDED), + ), + ), + ); + }), + mainAxisAlignment: MainAxisAlignment.spaceBetween, + direction: Axis.horizontal, ); - }), - mainAxisAlignment: MainAxisAlignment.spaceBetween, - direction: Axis.horizontal, + } ), ), Row( @@ -194,15 +205,19 @@ class _MineNavbar extends State { 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 - }); - });}, + 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, @@ -219,9 +234,12 @@ class _MineNavbar extends State { LoginTipsDialog().show(context); return; } - Navigator.of(context).pushNamed('/router/communityFollow',arguments: { - "status":1 - }); + Navigator.of(context).pushNamed( + '/router/communityFollow', + arguments: { + "status":1 + }, + ); }); }, child: mineBottomItem( diff --git a/lib/mine/mine_view/mine_order.dart b/lib/mine/mine_view/mine_order.dart index d8a16318..78d2d32a 100644 --- a/lib/mine/mine_view/mine_order.dart +++ b/lib/mine/mine_view/mine_order.dart @@ -82,12 +82,16 @@ class _MineOrderView extends State { toOrderHistory(int status) { SharedPreferences.getInstance().then((value) { - if (value.getString("token") == null || - value.getString("token") == "") { + if (value.getString("token") == null || value.getString("token") == "") { LoginTipsDialog().show(context); return; } - Navigator.of(context).pushNamed('/router/order_history_page', arguments: {"status":status}); + Navigator.of(context).pushNamed( + '/router/order_history_page', + arguments: { + "status":status, + }, + ); }); } diff --git a/lib/mine/mine_wallet_page.dart b/lib/mine/mine_wallet_page.dart index 78537c08..fff01b6d 100644 --- a/lib/mine/mine_wallet_page.dart +++ b/lib/mine/mine_wallet_page.dart @@ -158,7 +158,7 @@ class _MineWalletPage extends State { Widget balance() { return Container( width: double.infinity, - margin: EdgeInsets.fromLTRB(14.w, 16.h, 14.w, 8.h), + margin: EdgeInsets.fromLTRB(14.w, 16.h, 14.w, 0), padding: EdgeInsets.only(bottom: 12.h), decoration: BoxDecoration( color: Color(0xFF32A060), diff --git a/lib/order/order_history_page.dart b/lib/order/order_history_page.dart index 8c48ae9c..5d4f7ff3 100644 --- a/lib/order/order_history_page.dart +++ b/lib/order/order_history_page.dart @@ -6,6 +6,7 @@ import 'package:huixiang/data/base_data.dart'; import 'package:huixiang/data/order_info.dart'; import 'package:huixiang/data/order_product_vo.dart'; import 'package:huixiang/data/page.dart'; +import 'package:huixiang/data/user_info.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/order/order_utils.dart'; import 'package:huixiang/order/order_view/order_pay_selected.dart'; @@ -26,8 +27,6 @@ import 'package:retrofit/retrofit.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:shimmer/shimmer.dart'; -import '../data/user_info.dart'; - class OrderHistoryPage extends StatefulWidget { final Map? arguments; @@ -67,7 +66,7 @@ class _OrderHistoryPage extends State titleSize: 18.sp, background: Color(0xFFFFFFFF), leadingColor: Colors.black, - toolbarHeight: kToolbarHeight + MediaQuery.of(context).padding.top, + toolbarHeight: kToolbarHeight, bottom: PreferredSize( preferredSize: Size(double.infinity, 38.h), child: Theme( @@ -86,6 +85,8 @@ class _OrderHistoryPage extends State fontSize: 16.sp, fontWeight: FontWeight.normal, ), + dividerHeight: 0, + dividerColor: Colors.transparent, labelStyle: TextStyle( color: Colors.black, fontSize: 16.sp, @@ -176,8 +177,8 @@ class _OrderHistoryList extends State networkStatus = -1; refreshController.refreshFailed(); refreshController.loadFailed(); + return BaseData>()..isSuccess = false; }); - if (baseData?.isSuccess ?? false) { if (baseData!.data != null && (baseData.data!.records?.isNotEmpty ?? false)) { @@ -201,8 +202,10 @@ class _OrderHistoryList extends State networkStatus = 1; } else { if (baseData?.msg?.isNotEmpty ?? false) - SmartDialog.showToast("${baseData!.msg}", - alignment: Alignment.center); + SmartDialog.showToast( + "${baseData!.msg}", + alignment: Alignment.center, + ); refreshController.refreshFailed(); refreshController.loadFailed(); } @@ -215,7 +218,7 @@ class _OrderHistoryList extends State apiService?.minLogin(orderInfo.storeId ?? "").catchError((onError) { debugPrint("${onError}"); }).then((baseData) { - if (baseData?.isSuccess ?? false) { + if (baseData.isSuccess ?? false) { Map minStoreInfo = baseData.data; String minToken = minStoreInfo["token"]; String tenant = orderInfo.tenantCode ?? ""; @@ -228,22 +231,25 @@ class _OrderHistoryList extends State }, ); paySelected( - orderInfo, - MinApiService( - Dio(), - context: context, - token: minToken, - tenant: tenant, - storeId: storeId, - errorLogger: this, - )); + orderInfo, + MinApiService( + Dio(), + context: context, + token: minToken, + tenant: tenant, + storeId: storeId, + errorLogger: this, + ), + ); } }); } queryDetails(id) async { BaseData? baseData = - await apiService?.orderDetail(id).catchError((error) {}); + await apiService?.orderDetail(id).catchError((error) { + return BaseData()..isSuccess = false; + }); if (baseData?.isSuccess ?? false) { return baseData!.data; } @@ -251,7 +257,9 @@ class _OrderHistoryList extends State queryUserBalance() async { BaseData? baseData = - await apiService?.queryInfo().catchError((onError) {}); + await apiService?.queryInfo().catchError((onError) { + return BaseData()..isSuccess = false; + }); if (baseData?.isSuccess ?? false) { userInfo = baseData!.data; if (mounted) setState(() {}); @@ -294,7 +302,9 @@ class _OrderHistoryList extends State orderCancel(String orderId) async { BaseData? baseData = - await apiService?.orderCancel(orderId).catchError((onError) {}); + await apiService?.orderCancel(orderId).catchError((onError) { + return BaseData()..isSuccess = false; + }); if (baseData?.isSuccess ?? false) { SmartDialog.showToast("订单取消成功"); _onRefresh(); @@ -304,15 +314,6 @@ class _OrderHistoryList extends State } aginOrder(OrderInfo orderInfo) { - // Navigator.of(context).pushNamed( - // '/router/union_detail_page', - // arguments: {"id": storeId}, - // ); - // String storeId = (orderInfo != null && - // orderInfo.storeVO != null) - // ? (orderInfo.storeVO.id ?? "") - // : ""; - if (orderInfo.storeVO?.posType?.code == "NORMALSTORE") { Scan.toScan( context, @@ -370,15 +371,18 @@ class _OrderHistoryList extends State itemBuilder: (context, position) { return InkWell( onTap: () { - Navigator.of(context).pushNamed('/router/order_details', - arguments: { - "id": orderInfos[position].id, - "jumpState": 2 - }); + Navigator.of(context).pushNamed( + '/router/order_details', + arguments: { + "id": orderInfos[position].id, + "jumpState": 2 + }, + ); }, child: orderItem(orderInfos[position]), ); - }) + }, + ) : NoDataView( src: "assets/image/ding_dan.webp", isShowBtn: false, diff --git a/lib/qr/invite_friends.dart b/lib/qr/invite_friends.dart index d009920e..b22e27d0 100644 --- a/lib/qr/invite_friends.dart +++ b/lib/qr/invite_friends.dart @@ -1,7 +1,9 @@ import 'dart:convert'; import 'package:dio/dio.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:huixiang/data/base_data.dart'; @@ -10,6 +12,7 @@ import 'package:huixiang/data/page.dart'; import 'package:huixiang/data/user_info.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; +import 'package:huixiang/utils/constant.dart'; import 'package:huixiang/utils/flutter_utils.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/classic_header.dart'; @@ -116,44 +119,30 @@ class _InviteFriends extends State { return Scaffold( backgroundColor: Colors.white, appBar: AppBar( - shadowColor: Colors.white, - backgroundColor: Colors.white, - leading: GestureDetector( - child: Icon( - Icons.clear, - color: Colors.black, - ), - onTap: () { - Navigator.of(context).pop(); - }), - title: Text( - S.of(context).yaoqinghaoyou, - style: TextStyle( - fontWeight: MyFontWeight.semi_bold, - fontSize: 17.sp, - color: Color(0xFF000000), - ), + shadowColor: Colors.white, + backgroundColor: Colors.white, + leading: GestureDetector( + child: Icon( + Icons.arrow_back_ios_new_rounded, + color: Colors.black, ), - centerTitle: true, - elevation: 0.0, - //滑动时颜色不变 - scrolledUnderElevation: 0.0 - // actions: [ - // GestureDetector( - // child: Container( - // margin: EdgeInsets.only(right: 14), - // padding:EdgeInsets.only(left:70,right: 20), - // child: Icon( - // Icons.more_horiz, - // color: Colors.black, - // ), - // ), - // onTap: () { - // // Navigator.of(context).pop(); - // // share(); - // }) - // ], + onTap: () { + Navigator.of(context).pop(); + }, + ), + title: Text( + S.of(context).yaoqinghaoyou, + style: TextStyle( + fontWeight: MyFontWeight.semi_bold, + fontSize: 17.sp, + color: Color(0xFF000000), ), + ), + centerTitle: true, + elevation: 0.0, + //滑动时颜色不变 + scrolledUnderElevation: 0.0, + ), body: SmartRefresher( controller: refreshController, enablePullDown: true, @@ -192,19 +181,20 @@ class _InviteFriends extends State { Widget invite() { return Container( width: double.infinity, - height: 370.h, - margin: EdgeInsets.only(bottom: 20.h), + margin: EdgeInsets.only( + bottom: 16.h, + ), child: Column( children: [ - Image.asset( - "assets/image/invite_friends.webp", - height: 300.h, - width: double.infinity, - fit: BoxFit.fill, - ), - SizedBox( - height: 12.h, + Container( + child: Image.asset( + "assets/image/invite_friends.webp", + width: double.infinity, + fit: BoxFit.fitWidth, + alignment: Alignment.topCenter, + ), ), + 26.d, GestureDetector( onTap: () { widgetToUrl(); @@ -213,7 +203,7 @@ class _InviteFriends extends State { width: double.infinity, height: 52.h, decoration: BoxDecoration( - borderRadius: BorderRadius.circular(26), + borderRadius: BorderRadius.circular(26.h), color: Color(0xFF32A060), ), margin: EdgeInsets.symmetric(horizontal: 14.w), @@ -237,11 +227,11 @@ class _InviteFriends extends State { fontSize: 16.sp, color: Color(0xFFFFFFFF), ), - ) + ), ], ), ), - ) + ), ], ), ); @@ -255,372 +245,216 @@ class _InviteFriends extends State { borderRadius: BorderRadius.circular(6), color: Color(0xFFFFFFFF), ), - margin: EdgeInsets.only(bottom: 12.h, left: 14.h, right: 14.h), + margin: EdgeInsets.only( + bottom: 12.h, + left: 14.h, + right: 14.h, + ), padding: EdgeInsets.all(6), child: Column( // mainAxisAlignment: MainAxisAlignment.spaceAround, crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - decoration: BoxDecoration( - image: DecorationImage( + decoration: BoxDecoration( + image: DecorationImage( + fit: BoxFit.cover, + image: AssetImage("assets/image/invite_bj.webp"), + ), + ), + height: 54.h, + width: double.infinity, + alignment: Alignment.center, + child: Text( + S.of(context).huodongguize, + style: TextStyle( + fontWeight: MyFontWeight.semi_bold, + fontSize: 16.sp, + color: Color(0xFF32A060), + ), + ), + ), + SizedBox( + height: 12.h, + ), + Row( + children: [ + Spacer(), + Image.asset( + "assets/image/invite_wx.webp", + width: 42.h, + height: 42.h, + fit: BoxFit.cover, + ), + Expanded( + child: dashedLine(), + ), + Image.asset( + "assets/image/yq_zt.webp", + width: 42.h, + height: 42.h, + fit: BoxFit.cover, + ), + Expanded( + child: dashedLine(), + ), + Image.asset( + "assets/image/zt_m.webp", + width: 42.h, + height: 42.h, + fit: BoxFit.cover, + ), + Expanded( + child: dashedLine(), + ), + Image.asset( + "assets/image/invite_q.webp", + width: 42.h, + height: 42.h, + fit: BoxFit.cover, + ), + Spacer(), + ], + ), + Row( + children: [ + Spacer(), + Container( + alignment: Alignment.center, + width: 42.h, + child: Image.asset( + "assets/image/invite_1.webp", + width: 24.h, + height: 24.h, + fit: BoxFit.cover, + ), + ), + Spacer(), + Container( + alignment: Alignment.center, + width: 42.h, + child: Image.asset( + "assets/image/invite_2.webp", + width: 24.h, + height: 24.h, + fit: BoxFit.cover, + ), + ), + Spacer(), + Container( + alignment: Alignment.center, + width: 42.h, + child: Image.asset( + "assets/image/invite_3.webp", + width: 24.h, + height: 24.h, + fit: BoxFit.cover, + ), + ), + Spacer(), + Container( + alignment: Alignment.center, + width: 42.h, + child: Image.asset( + "assets/image/invite_4.webp", + width: 24.h, + height: 24.h, fit: BoxFit.cover, - image: AssetImage("assets/image/invite_bj.webp"), ), ), - height: 54.h, - width: double.infinity, - alignment: Alignment.center, - child: Text( - S.of(context).huodongguize, - style: TextStyle( - fontWeight: MyFontWeight.semi_bold, - fontSize: 16.sp, - color: Color(0xFF32A060), - ), - )), - SizedBox( - height: 17.h, + Spacer(), + ], ), - IntrinsicHeight( - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Expanded( - child: Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Image.asset( - "assets/image/invite_wx.webp", - width: 42.h, - height: 42.h, - fit: BoxFit.cover, - ), - Container( - width: 50.w, - child: Flex( - children: List.generate(8, (_) { - return SizedBox( - width: 3, - height: 1, - child: DecoratedBox( - decoration: - BoxDecoration(color: Color(0xFF32A060)), - ), - ); - }), - mainAxisAlignment: MainAxisAlignment.spaceBetween, - direction: Axis.horizontal, - ), - ), - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Image.asset( - "assets/image/invite_1.webp", - width: 24.h, - height: 24.h, - fit: BoxFit.cover, - ), - Container( - width: 44.w, - child: Flex( - children: List.generate(0, (_) { - return SizedBox( - width: 3.w, - height: 1.h, - child: DecoratedBox( - decoration: - BoxDecoration(color: Colors.white), - ), - ); - }), - mainAxisAlignment: MainAxisAlignment.spaceBetween, - direction: Axis.horizontal, - ), - ), - ], - ), - SizedBox(height: 8.h), - Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - width: 50.w, - child: Text( - "分享链接给好友", - style: TextStyle( - fontSize: 12.sp, - height: 1.3.h, - fontWeight: MyFontWeight.regular, - color: Color(0xFF181818), - ), - ), - ), - Container( - width: 43.w, - child: Flex( - children: List.generate(0, (_) { - return SizedBox( - width: 3.w, - height: 1.h, - child: DecoratedBox( - decoration: - BoxDecoration(color: Colors.white), - ), - ); - }), - mainAxisAlignment: MainAxisAlignment.spaceBetween, - direction: Axis.horizontal, - ), - ), - ], - ), - ], - )), - Expanded( - child: Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Image.asset( - "assets/image/yq_zt.webp", - width: 42.h, - height: 42.h, - fit: BoxFit.cover, - ), - Container( - width: 50.w, - child: Flex( - children: List.generate(8, (_) { - return SizedBox( - width: 3.w, - height: 1.w, - child: DecoratedBox( - decoration: - BoxDecoration(color: Color(0xFF32A060)), - ), - ); - }), - mainAxisAlignment: MainAxisAlignment.spaceBetween, - direction: Axis.horizontal, - ), - ), - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Image.asset( - "assets/image/invite_2.webp", - width: 24.h, - height: 24.h, - fit: BoxFit.cover, - ), - Container( - width: 44.w, - child: Flex( - children: List.generate(0, (_) { - return SizedBox( - width: 3.w, - height: 1.h, - child: DecoratedBox( - decoration: - BoxDecoration(color: Colors.white), - ), - ); - }), - mainAxisAlignment: MainAxisAlignment.spaceBetween, - direction: Axis.horizontal, - ), - ), - ], - ), - SizedBox(height: 8.h), - Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - width: 50.w, - child: Text( - "好友注册并获得10元优惠券", - style: TextStyle( - fontSize: 12.sp, - height: 1.3.h, - fontWeight: MyFontWeight.regular, - color: Color(0xFF181818), - ), - ), - ), - Container( - width: 43.w, - child: Flex( - children: List.generate(0, (_) { - return SizedBox( - width: 3.w, - height: 1.h, - child: DecoratedBox( - decoration: - BoxDecoration(color: Colors.white), - ), - ); - }), - mainAxisAlignment: MainAxisAlignment.spaceBetween, - direction: Axis.horizontal, - ), - ), - ], - ), - ], - )), - Expanded( - child: Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Image.asset( - "assets/image/zt_m.webp", - width: 42.h, - height: 42.h, - fit: BoxFit.cover, - ), - Container( - width: 50.w, - child: Flex( - children: List.generate(8, (_) { - return SizedBox( - width: 3.w, - height: 1.h, - child: DecoratedBox( - decoration: - BoxDecoration(color: Color(0xFF32A060)), - ), - ); - }), - mainAxisAlignment: MainAxisAlignment.spaceBetween, - direction: Axis.horizontal, - ), - ), - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Image.asset( - "assets/image/invite_3.webp", - width: 24.h, - height: 24.h, - fit: BoxFit.cover, - ), - Container( - width: 44.w, - child: Flex( - children: List.generate(0, (_) { - return SizedBox( - width: 3.w, - height: 1.h, - child: DecoratedBox( - decoration: - BoxDecoration(color: Colors.white), - ), - ); - }), - mainAxisAlignment: MainAxisAlignment.spaceBetween, - direction: Axis.horizontal, - ), - ), - ], - ), - SizedBox(height: 8.h), - Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - width: 50.w, - child: Text( - "好友完成首单", - style: TextStyle( - fontSize: 12.sp, - height: 1.3.h, - fontWeight: MyFontWeight.regular, - color: Color(0xFF181818), - ), - ), - ), - Container( - width: 43.w, - child: Flex( - children: List.generate(0, (_) { - return SizedBox( - width: 3.w, - height: 1.h, - child: DecoratedBox( - decoration: - BoxDecoration(color: Colors.white), - ), - ); - }), - mainAxisAlignment: MainAxisAlignment.spaceBetween, - direction: Axis.horizontal, - ), - ), - ], - ), - ], - )), - Column( - children: [ - Image.asset( - "assets/image/invite_q.webp", - width: 42.h, - height: 42.h, - fit: BoxFit.cover, - ), - Image.asset( - "assets/image/invite_4.webp", - width: 24.h, - height: 24.h, - fit: BoxFit.cover, - ), - SizedBox(height: 8.h), - Container( - width: 50.w, - child: Text( - "邀请达成获得奖励", - style: TextStyle( - fontSize: 12.sp, - height: 1.3.h, - fontWeight: MyFontWeight.regular, - color: Color(0xFF181818), - ), - ), - ) - ], + SizedBox(height: 8.h), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Spacer(), + Expanded( + flex: 3, + child: Text( + "分享链接给好友", + style: TextStyle( + fontSize: 12.sp, + height: 1.3.h, + fontWeight: MyFontWeight.regular, + color: Color(0xFF181818), + ), ), - ], - ), + ), + Spacer(), + Expanded( + flex: 3, + child: Text( + "好友注册并获得10元优惠券", + style: TextStyle( + fontSize: 12.sp, + height: 1.3.h, + fontWeight: MyFontWeight.regular, + color: Color(0xFF181818), + ), + ), + ), + Spacer(), + Expanded( + flex: 3, + child: Text( + "好友完成首单", + style: TextStyle( + fontSize: 12.sp, + height: 1.3.h, + fontWeight: MyFontWeight.regular, + color: Color(0xFF181818), + ), + ), + ), + Spacer(), + Expanded( + flex: 3, + child: Text( + "邀请达成获得奖励", + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 12.sp, + height: 1.3.h, + fontWeight: MyFontWeight.regular, + color: Color(0xFF181818), + ), + ), + ), + Spacer(), + ], ), ], ), ); } + dashedLine() { + return LayoutBuilder( + builder: (ctx, c) { + double width = c.constrainWidth(); + return Flex( + children: List.generate( + width ~/ 4, + (_) { + return Container( + width: 2, + margin: EdgeInsets.symmetric(horizontal: 1), + height: 1, + child: DecoratedBox( + decoration: BoxDecoration(color: Color(0xFF32A060)), + ), + ); + }, + ), + mainAxisAlignment: MainAxisAlignment.spaceBetween, + direction: Axis.horizontal, + ); + }, + ); + } + ///我的成就 Widget achievement() { return Container( @@ -630,8 +464,17 @@ class _InviteFriends extends State { borderRadius: BorderRadius.circular(6), color: Color(0xFFFFFFFF), ), - margin: EdgeInsets.only(bottom: 12.h, left: 14.h, right: 14.h), - padding: EdgeInsets.only(top: 6.h, left: 6, right: 6, bottom: 16.h), + margin: EdgeInsets.only( + bottom: 12.h, + left: 14.h, + right: 14.h, + ), + padding: EdgeInsets.only( + top: 6.h, + left: 6, + right: 6, + bottom: 16.h, + ), child: Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start,