Browse Source

UI

null_safety
fmk 3 years ago
parent
commit
9362b67dd4
  1. 36
      lib/mine/recharge_page.dart
  2. 51
      lib/mine/vip_detail_page.dart
  3. 4
      lib/order/order_history_page.dart
  4. 3
      lib/retrofit/data/activity.dart
  5. 5
      lib/retrofit/data/article.dart
  6. 12
      lib/retrofit/retrofit_api.dart
  7. 12
      lib/union/union_page.dart

36
lib/mine/recharge_page.dart

@ -118,39 +118,11 @@ class _RechargePage extends State<RechargePage> {
S.of(context).zhifufangshi, S.of(context).zhifufangshi,
style: TextStyle( style: TextStyle(
fontSize: 16.sp, fontSize: 16.sp,
color: color, color: Colors.black,
fontWeight: FontWeight.bold, 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( GestureDetector(
onTap: () { onTap: () {
setState(() { setState(() {
@ -166,11 +138,13 @@ class _RechargePage extends State<RechargePage> {
flex: 1, flex: 1,
child: Padding( child: Padding(
padding: EdgeInsets.only(left: 8.w), padding: EdgeInsets.only(left: 8.w),
child: Text(S.of(context).weixinzhifu, child: Text(
S.of(context).weixinzhifu,
style: TextStyle( style: TextStyle(
fontSize: 14.sp, fontSize: 14.sp,
color: Color(0xff353535), color: Color(0xff353535),
)), ),
),
), ),
), ),
checkView(1), checkView(1),

51
lib/mine/vip_detail_page.dart

@ -1,11 +1,9 @@
import 'package:barcode_widget/barcode_widget.dart'; import 'package:barcode_widget/barcode_widget.dart';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:flutter/material.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/generated/l10n.dart';
import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/order_info.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/data/vip_card.dart';
import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/location.dart'; import 'package:huixiang/utils/location.dart';
@ -42,12 +40,18 @@ class _VipDetailPage extends State<VipDetailPage> {
void initState() { void initState() {
super.initState(); super.initState();
Location.getInstance().aMapFlutterLocation.onResultCallback().listen((event) { vipDetail("", "");
Location.getInstance()
.aMapFlutterLocation
.onResultCallback()
.listen((event) {
if (event != null && if (event != null &&
event["latitude"] != null && event["latitude"] != null &&
event["longitude"] != null) { event["longitude"] != null) {
SharedPreferences.getInstance().then((value) { 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"]); vipDetail(event["latitude"], event["longitude"]);
}); });
} }
@ -102,7 +106,7 @@ class _VipDetailPage extends State<VipDetailPage> {
], ],
), ),
Padding( 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( child: Row(
children: [ children: [
Text( Text(
@ -141,9 +145,9 @@ class _VipDetailPage extends State<VipDetailPage> {
child: shopItem(vipCard.storeList[position]), child: shopItem(vipCard.storeList[position]),
); );
}, },
padding: EdgeInsets.symmetric(vertical: 1),
itemCount: (vipCard != null && vipCard.storeList != null) itemCount: (vipCard != null && vipCard.storeList != null)
? vipCard.storeList.length ? vipCard.storeList.length : 0,
: 0,
), ),
), ),
), ),
@ -379,7 +383,7 @@ class _VipDetailPage extends State<VipDetailPage> {
height: 30.h, height: 30.h,
color: Colors.black, color: Colors.black,
drawText: false, drawText: false,
) ),
], ],
) )
], ],
@ -392,7 +396,7 @@ class _VipDetailPage extends State<VipDetailPage> {
Widget shopItem(StoreListBean store) { Widget shopItem(StoreListBean store) {
return Container( return Container(
margin: EdgeInsets.all(16.w), margin: EdgeInsets.symmetric(horizontal: 16.w, vertical: 8.h),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@ -445,7 +449,8 @@ class _VipDetailPage extends State<VipDetailPage> {
color: Color(0xff353535), color: Color(0xff353535),
), ),
), ),
Text( Expanded(
child: Text(
store.address, store.address,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
@ -454,6 +459,8 @@ class _VipDetailPage extends State<VipDetailPage> {
color: Color(0xff353535), color: Color(0xff353535),
), ),
), ),
flex: 1,
)
], ],
), ),
SizedBox( SizedBox(
@ -477,15 +484,10 @@ class _VipDetailPage extends State<VipDetailPage> {
), ),
), ),
), ),
Text(// "3.9km" Text(
(store.distance ?? 0) > 1000 (store.distance ?? 0) > 1000
? S.of(context).gongli( ? S.of(context).gongli(((store.distance ?? 0) / 1000 * 100).toInt() / 100.0)
((store.distance ?? 0) / 1000 * 100) : S.of(context).mi(((store.distance ?? 0) * 100).toInt() / 100.0),
.toInt() /
100.0)
: S.of(context).mi(
((store.distance ?? 0) * 100).toInt() /
100.0),
style: TextStyle( style: TextStyle(
fontSize: 12.sp, fontSize: 12.sp,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
@ -503,10 +505,8 @@ class _VipDetailPage extends State<VipDetailPage> {
String totalPrice(orderInfo) { String totalPrice(orderInfo) {
if (orderInfo == null) return ""; if (orderInfo == null) return "";
double totalPrice = (double.tryParse(orderInfo.orderSum) + double totalPrice = (double.tryParse(orderInfo.orderSum) + double.tryParse(orderInfo.postFee));
double.tryParse(orderInfo.postFee)); if (orderInfo.orderDetail != null && orderInfo.orderDetail.couponDTO != null) {
if (orderInfo.orderDetail != null &&
orderInfo.orderDetail.couponDTO != null) {
totalPrice -= double.tryParse(orderInfo.orderDetail.couponDTO.money); totalPrice -= double.tryParse(orderInfo.orderDetail.couponDTO.money);
} }
return "$totalPrice"; return "$totalPrice";
@ -517,9 +517,7 @@ class _VipDetailPage extends State<VipDetailPage> {
if (products.length > 3) { if (products.length > 3) {
products = products.sublist(0, 3); products = products.sublist(0, 3);
} }
return products return products.map((e) => Container(
.map(
(e) => Container(
margin: EdgeInsets.symmetric(horizontal: 2.w), margin: EdgeInsets.symmetric(horizontal: 2.w),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
@ -553,7 +551,6 @@ class _VipDetailPage extends State<VipDetailPage> {
], ],
), ),
), ),
) ).toList();
.toList();
} }
} }

4
lib/order/order_history_page.dart

@ -473,8 +473,8 @@ class _OrderHistoryList extends State<OrderHistoryList>
children: [ children: [
MImage( MImage(
e.skuImg, e.skuImg,
width: 75, width: 75.w,
height: 75, height: 75.w,
fit: BoxFit.cover, fit: BoxFit.cover,
errorSrc: "assets/image/default_1.png", errorSrc: "assets/image/default_1.png",
fadeSrc: "assets/image/default_1.png", fadeSrc: "assets/image/default_1.png",

3
lib/retrofit/data/activity.dart

@ -16,6 +16,7 @@ class Activity {
int state; int state;
int isDelete; int isDelete;
int likes; int likes;
bool liked;
int viewers; int viewers;
String storeName; String storeName;
@ -35,6 +36,7 @@ class Activity {
..state = json['state'] ..state = json['state']
..isDelete = json['isDelete'] ..isDelete = json['isDelete']
..likes = json["likes"] ..likes = json["likes"]
..liked = json["liked"]
..viewers = json["viewers"] ..viewers = json["viewers"]
..storeName = json['storeName']; ..storeName = json['storeName'];
@ -54,6 +56,7 @@ class Activity {
'state': this.state, 'state': this.state,
'isDelete': this.isDelete, 'isDelete': this.isDelete,
'likes': this.likes, 'likes': this.likes,
'liked': this.liked,
'viewers': this.viewers, 'viewers': this.viewers,
'storeName': this.storeName 'storeName': this.storeName
}; };

5
lib/retrofit/data/article.dart

@ -39,6 +39,7 @@ class Article {
int _isDelete; int _isDelete;
int _likes; int _likes;
bool _isHot; bool _isHot;
bool _liked;
int _viewers; int _viewers;
dynamic _storeName; dynamic _storeName;
@ -60,6 +61,7 @@ class Article {
int get isDelete => _isDelete; int get isDelete => _isDelete;
int get likes => _likes; int get likes => _likes;
bool get isHot => _isHot; bool get isHot => _isHot;
bool get liked => _liked;
int get viewers => _viewers; int get viewers => _viewers;
dynamic get storeName => _storeName; dynamic get storeName => _storeName;
@ -110,6 +112,7 @@ class Article {
_isDelete = isDelete; _isDelete = isDelete;
_likes = likes; _likes = likes;
_isHot = isHot; _isHot = isHot;
_liked = liked;
_viewers = viewers; _viewers = viewers;
_storeName = storeName; _storeName = storeName;
} }
@ -133,6 +136,7 @@ class Article {
_isDelete = json["isDelete"]; _isDelete = json["isDelete"];
_likes = json["likes"]; _likes = json["likes"];
_isHot = json["isHot"]; _isHot = json["isHot"];
_liked = json["liked"];
_viewers = json["viewers"]; _viewers = json["viewers"];
_storeName = json["storeName"]; _storeName = json["storeName"];
} }
@ -157,6 +161,7 @@ class Article {
map["isDelete"] = _isDelete; map["isDelete"] = _isDelete;
map["likes"] = _likes; map["likes"] = _likes;
map["isHot"] = _isHot; map["isHot"] = _isHot;
map["liked"] = _liked;
map["viewers"] = _viewers; map["viewers"] = _viewers;
map["storeName"] = _storeName; map["storeName"] = _storeName;
return map; return map;

12
lib/retrofit/retrofit_api.dart

@ -14,12 +14,8 @@ import 'package:shared_preferences/shared_preferences.dart';
part 'retrofit_api.g.dart'; part 'retrofit_api.g.dart';
const base_url = "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 baseUrl = "https://pos.platform.lotus-wallet.com/app/";
///
// const base_url = "http://192.168.10.236:8766/app/"; // const base_url = "http://192.168.10.236:8766/app/";
// const baseUrl = "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}") @GET("/order/getShippingTrace/{shipperCode}/{logisticCode}")
Future<BaseData> shippingTrace(@Path("shipperCode") String shipperCode, Future<BaseData> shippingTrace(@Path("shipperCode") String shipperCode, @Path("logisticCode") String logisticCode);
@Path("logisticCode") String logisticCode);
} }

12
lib/union/union_page.dart

@ -554,8 +554,7 @@ class _UnionPage extends State<UnionPage>
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
IconText( IconText(
(store.openStartTime == null && (store.openStartTime == null && store.openEndTime == null)
store.openEndTime == null)
? S.of(context).quantian ? S.of(context).quantian
: "${store.openStartTime.substring(0, store.openStartTime.lastIndexOf(":"))} - ${store.openEndTime.substring(0, store.openEndTime.lastIndexOf(":"))}", : "${store.openStartTime.substring(0, store.openStartTime.lastIndexOf(":"))} - ${store.openEndTime.substring(0, store.openEndTime.lastIndexOf(":"))}",
textStyle: TextStyle( textStyle: TextStyle(
@ -568,13 +567,8 @@ class _UnionPage extends State<UnionPage>
Visibility( Visibility(
child: Text( child: Text(
(store.distance ?? 0) > 1000 (store.distance ?? 0) > 1000
? S.of(context).gongli( ? S.of(context).gongli(((store.distance ?? 0) / 1000 * 100) .toInt() / 100.0)
((store.distance ?? 0) / 1000 * 100) : S.of(context).mi(((store.distance ?? 0) * 100).toInt() / 100.0),
.toInt() /
100.0)
: S.of(context).mi(
((store.distance ?? 0) * 100).toInt() /
100.0),
style: TextStyle( style: TextStyle(
color: Color(0xFF4C4C4C), color: Color(0xFF4C4C4C),
fontSize: 12, fontSize: 12,

Loading…
Cancel
Save