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,
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<RechargePage> {
flex: 1,
child: Padding(
padding: EdgeInsets.only(left: 8.w),
child: Text(S.of(context).weixinzhifu,
child: Text(
S.of(context).weixinzhifu,
style: TextStyle(
fontSize: 14.sp,
color: Color(0xff353535),
)),
),
),
),
),
checkView(1),

51
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<VipDetailPage> {
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<VipDetailPage> {
],
),
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<VipDetailPage> {
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<VipDetailPage> {
height: 30.h,
color: Colors.black,
drawText: false,
)
),
],
)
],
@ -392,7 +396,7 @@ class _VipDetailPage extends State<VipDetailPage> {
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,7 +449,8 @@ class _VipDetailPage extends State<VipDetailPage> {
color: Color(0xff353535),
),
),
Text(
Expanded(
child: Text(
store.address,
overflow: TextOverflow.ellipsis,
style: TextStyle(
@ -454,6 +459,8 @@ class _VipDetailPage extends State<VipDetailPage> {
color: Color(0xff353535),
),
),
flex: 1,
)
],
),
SizedBox(
@ -477,15 +484,10 @@ class _VipDetailPage extends State<VipDetailPage> {
),
),
),
Text(// "3.9km"
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(
fontSize: 12.sp,
fontWeight: FontWeight.w400,
@ -503,10 +505,8 @@ class _VipDetailPage extends State<VipDetailPage> {
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<VipDetailPage> {
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<VipDetailPage> {
],
),
),
)
.toList();
).toList();
}
}

4
lib/order/order_history_page.dart

@ -473,8 +473,8 @@ class _OrderHistoryList extends State<OrderHistoryList>
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",

3
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
};

5
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;

12
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<BaseData> shippingTrace(@Path("shipperCode") String shipperCode,
@Path("logisticCode") String logisticCode);
Future<BaseData> shippingTrace(@Path("shipperCode") String shipperCode, @Path("logisticCode") String logisticCode);
}

12
lib/union/union_page.dart

@ -554,8 +554,7 @@ class _UnionPage extends State<UnionPage>
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<UnionPage>
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,

Loading…
Cancel
Save