From 9362b67dd4f28681a95253229b9cfe7fb7499008 Mon Sep 17 00:00:00 2001 From: fmk Date: Thu, 19 Aug 2021 11:30:15 +0800 Subject: [PATCH] UI --- lib/mine/recharge_page.dart | 42 ++++--------------- lib/mine/vip_detail_page.dart | 67 +++++++++++++++---------------- lib/order/order_history_page.dart | 4 +- lib/retrofit/data/activity.dart | 3 ++ lib/retrofit/data/article.dart | 5 +++ lib/retrofit/retrofit_api.dart | 12 ++---- lib/union/union_page.dart | 12 ++---- 7 files changed, 57 insertions(+), 88 deletions(-) diff --git a/lib/mine/recharge_page.dart b/lib/mine/recharge_page.dart index c44492fd..84f55143 100644 --- a/lib/mine/recharge_page.dart +++ b/lib/mine/recharge_page.dart @@ -118,39 +118,11 @@ class _RechargePage extends State { S.of(context).zhifufangshi, style: TextStyle( fontSize: 16.sp, - color: color, + color: Colors.black, fontWeight: FontWeight.bold, ), ), ), - // GestureDetector( - // onTap: () { - // setState(() { - // checkIndex = 0; - // }); - // }, - // child: Row( - // mainAxisAlignment: MainAxisAlignment.start, - // crossAxisAlignment: CrossAxisAlignment.start, - // children: [ - // Image.asset("assets/image/icon_alipay.png"), - // Expanded( - // flex: 1, - // child: Padding( - // padding: EdgeInsets.only(left: 8.w, bottom: 20.h), - // child: Text( - // S.of(context).zhifubao, - // style: TextStyle( - // fontSize: 14.sp, - // color: Color(0xff353535), - // ), - // ), - // ), - // ), - // checkView(0), - // ], - // ), - // ), GestureDetector( onTap: () { setState(() { @@ -166,11 +138,13 @@ class _RechargePage extends State { flex: 1, child: Padding( padding: EdgeInsets.only(left: 8.w), - child: Text(S.of(context).weixinzhifu, - style: TextStyle( - fontSize: 14.sp, - color: Color(0xff353535), - )), + child: Text( + S.of(context).weixinzhifu, + style: TextStyle( + fontSize: 14.sp, + color: Color(0xff353535), + ), + ), ), ), checkView(1), diff --git a/lib/mine/vip_detail_page.dart b/lib/mine/vip_detail_page.dart index 099f2484..ded12871 100644 --- a/lib/mine/vip_detail_page.dart +++ b/lib/mine/vip_detail_page.dart @@ -1,11 +1,9 @@ import 'package:barcode_widget/barcode_widget.dart'; import 'package:dio/dio.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_baidu_mapapi_utils/flutter_baidu_mapapi_utils.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/order_info.dart'; -import 'package:huixiang/retrofit/data/page.dart'; import 'package:huixiang/retrofit/data/vip_card.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/utils/location.dart'; @@ -42,12 +40,18 @@ class _VipDetailPage extends State { void initState() { super.initState(); - Location.getInstance().aMapFlutterLocation.onResultCallback().listen((event) { + vipDetail("", ""); + + Location.getInstance() + .aMapFlutterLocation + .onResultCallback() + .listen((event) { if (event != null && event["latitude"] != null && event["longitude"] != null) { SharedPreferences.getInstance().then((value) { - apiService = ApiService(Dio(), context: context, token: value.getString("token")); + apiService = ApiService(Dio(), + context: context, token: value.getString("token")); vipDetail(event["latitude"], event["longitude"]); }); } @@ -102,7 +106,7 @@ class _VipDetailPage extends State { ], ), Padding( - padding: EdgeInsets.only(left: 16.w, top: 35.h, bottom: 16.h), + padding: EdgeInsets.only(left: 16.w, top: 32.h, bottom: 8.h), child: Row( children: [ Text( @@ -141,9 +145,9 @@ class _VipDetailPage extends State { child: shopItem(vipCard.storeList[position]), ); }, + padding: EdgeInsets.symmetric(vertical: 1), itemCount: (vipCard != null && vipCard.storeList != null) - ? vipCard.storeList.length - : 0, + ? vipCard.storeList.length : 0, ), ), ), @@ -379,7 +383,7 @@ class _VipDetailPage extends State { height: 30.h, color: Colors.black, drawText: false, - ) + ), ], ) ], @@ -392,7 +396,7 @@ class _VipDetailPage extends State { Widget shopItem(StoreListBean store) { return Container( - margin: EdgeInsets.all(16.w), + margin: EdgeInsets.symmetric(horizontal: 16.w, vertical: 8.h), child: Column( mainAxisAlignment: MainAxisAlignment.spaceAround, crossAxisAlignment: CrossAxisAlignment.start, @@ -445,15 +449,18 @@ class _VipDetailPage extends State { color: Color(0xff353535), ), ), - Text( - store.address, - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontSize: 12.sp, - fontWeight: FontWeight.w400, - color: Color(0xff353535), + Expanded( + child: Text( + store.address, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 12.sp, + fontWeight: FontWeight.w400, + color: Color(0xff353535), + ), ), - ), + flex: 1, + ) ], ), SizedBox( @@ -477,15 +484,10 @@ class _VipDetailPage extends State { ), ), ), - Text(// "3.9km" - (store.distance ?? 0) > 1000 - ? S.of(context).gongli( - ((store.distance ?? 0) / 1000 * 100) - .toInt() / - 100.0) - : S.of(context).mi( - ((store.distance ?? 0) * 100).toInt() / - 100.0), + Text( + (store.distance ?? 0) > 1000 + ? S.of(context).gongli(((store.distance ?? 0) / 1000 * 100).toInt() / 100.0) + : S.of(context).mi(((store.distance ?? 0) * 100).toInt() / 100.0), style: TextStyle( fontSize: 12.sp, fontWeight: FontWeight.w400, @@ -503,10 +505,8 @@ class _VipDetailPage extends State { String totalPrice(orderInfo) { if (orderInfo == null) return ""; - double totalPrice = (double.tryParse(orderInfo.orderSum) + - double.tryParse(orderInfo.postFee)); - if (orderInfo.orderDetail != null && - orderInfo.orderDetail.couponDTO != null) { + double totalPrice = (double.tryParse(orderInfo.orderSum) + double.tryParse(orderInfo.postFee)); + if (orderInfo.orderDetail != null && orderInfo.orderDetail.couponDTO != null) { totalPrice -= double.tryParse(orderInfo.orderDetail.couponDTO.money); } return "$totalPrice"; @@ -517,9 +517,7 @@ class _VipDetailPage extends State { if (products.length > 3) { products = products.sublist(0, 3); } - return products - .map( - (e) => Container( + return products.map((e) => Container( margin: EdgeInsets.symmetric(horizontal: 2.w), child: Column( mainAxisAlignment: MainAxisAlignment.spaceAround, @@ -553,7 +551,6 @@ class _VipDetailPage extends State { ], ), ), - ) - .toList(); + ).toList(); } } diff --git a/lib/order/order_history_page.dart b/lib/order/order_history_page.dart index ebd940ce..9a30b44d 100644 --- a/lib/order/order_history_page.dart +++ b/lib/order/order_history_page.dart @@ -473,8 +473,8 @@ class _OrderHistoryList extends State children: [ MImage( e.skuImg, - width: 75, - height: 75, + width: 75.w, + height: 75.w, fit: BoxFit.cover, errorSrc: "assets/image/default_1.png", fadeSrc: "assets/image/default_1.png", diff --git a/lib/retrofit/data/activity.dart b/lib/retrofit/data/activity.dart index e769ba24..b49bd053 100644 --- a/lib/retrofit/data/activity.dart +++ b/lib/retrofit/data/activity.dart @@ -16,6 +16,7 @@ class Activity { int state; int isDelete; int likes; + bool liked; int viewers; String storeName; @@ -35,6 +36,7 @@ class Activity { ..state = json['state'] ..isDelete = json['isDelete'] ..likes = json["likes"] + ..liked = json["liked"] ..viewers = json["viewers"] ..storeName = json['storeName']; @@ -54,6 +56,7 @@ class Activity { 'state': this.state, 'isDelete': this.isDelete, 'likes': this.likes, + 'liked': this.liked, 'viewers': this.viewers, 'storeName': this.storeName }; diff --git a/lib/retrofit/data/article.dart b/lib/retrofit/data/article.dart index d7e39a8e..ffd0ecb2 100644 --- a/lib/retrofit/data/article.dart +++ b/lib/retrofit/data/article.dart @@ -39,6 +39,7 @@ class Article { int _isDelete; int _likes; bool _isHot; + bool _liked; int _viewers; dynamic _storeName; @@ -60,6 +61,7 @@ class Article { int get isDelete => _isDelete; int get likes => _likes; bool get isHot => _isHot; + bool get liked => _liked; int get viewers => _viewers; dynamic get storeName => _storeName; @@ -110,6 +112,7 @@ class Article { _isDelete = isDelete; _likes = likes; _isHot = isHot; + _liked = liked; _viewers = viewers; _storeName = storeName; } @@ -133,6 +136,7 @@ class Article { _isDelete = json["isDelete"]; _likes = json["likes"]; _isHot = json["isHot"]; + _liked = json["liked"]; _viewers = json["viewers"]; _storeName = json["storeName"]; } @@ -157,6 +161,7 @@ class Article { map["isDelete"] = _isDelete; map["likes"] = _likes; map["isHot"] = _isHot; + map["liked"] = _liked; map["viewers"] = _viewers; map["storeName"] = _storeName; return map; diff --git a/lib/retrofit/retrofit_api.dart b/lib/retrofit/retrofit_api.dart index 7968a414..3e52c8ac 100644 --- a/lib/retrofit/retrofit_api.dart +++ b/lib/retrofit/retrofit_api.dart @@ -14,12 +14,8 @@ import 'package:shared_preferences/shared_preferences.dart'; part 'retrofit_api.g.dart'; -const base_url = "https://pos.platform.lotus-wallet.com/app/"; - -///正式 -const baseUrl = "https://pos.platform.lotus-wallet.com/app/"; - -///正式 +const base_url = "https://pos.platform.lotus-wallet.com/app/"; ///正式 +const baseUrl = "https://pos.platform.lotus-wallet.com/app/"; ///正式 // const base_url = "http://192.168.10.236:8766/app/"; // const baseUrl = "http://192.168.10.236:8766/app/"; @@ -326,6 +322,6 @@ abstract class ApiService { ///查询物流轨迹 @GET("/order/getShippingTrace/{shipperCode}/{logisticCode}") - Future shippingTrace(@Path("shipperCode") String shipperCode, - @Path("logisticCode") String logisticCode); + Future shippingTrace(@Path("shipperCode") String shipperCode, @Path("logisticCode") String logisticCode); + } diff --git a/lib/union/union_page.dart b/lib/union/union_page.dart index 319fbf95..3d784eef 100644 --- a/lib/union/union_page.dart +++ b/lib/union/union_page.dart @@ -554,8 +554,7 @@ class _UnionPage extends State crossAxisAlignment: CrossAxisAlignment.center, children: [ IconText( - (store.openStartTime == null && - store.openEndTime == null) + (store.openStartTime == null && store.openEndTime == null) ? S.of(context).quantian : "${store.openStartTime.substring(0, store.openStartTime.lastIndexOf(":"))} - ${store.openEndTime.substring(0, store.openEndTime.lastIndexOf(":"))}", textStyle: TextStyle( @@ -568,13 +567,8 @@ class _UnionPage extends State Visibility( child: Text( (store.distance ?? 0) > 1000 - ? S.of(context).gongli( - ((store.distance ?? 0) / 1000 * 100) - .toInt() / - 100.0) - : S.of(context).mi( - ((store.distance ?? 0) * 100).toInt() / - 100.0), + ? S.of(context).gongli(((store.distance ?? 0) / 1000 * 100) .toInt() / 100.0) + : S.of(context).mi(((store.distance ?? 0) * 100).toInt() / 100.0), style: TextStyle( color: Color(0xFF4C4C4C), fontSize: 12,