Browse Source
# Conflicts: # lib/generated/l10n.dart # lib/l10n/intl_zh_CN.arb # lib/l10n/intl_zh_Hans_CN.arbmaster
w-R
3 years ago
18 changed files with 758 additions and 1770 deletions
@ -1,37 +0,0 @@ |
|||||||
// GENERATED CODE - DO NOT MODIFY BY HAND |
|
||||||
|
|
||||||
part of 'base_data.dart'; |
|
||||||
|
|
||||||
// ************************************************************************** |
|
||||||
// JsonSerializableGenerator |
|
||||||
// ************************************************************************** |
|
||||||
|
|
||||||
BaseData<T> _$BaseDataFromJson<T>( |
|
||||||
Map<String, dynamic> json, |
|
||||||
T Function(Object json) fromJsonT, |
|
||||||
) { |
|
||||||
return BaseData<T>() |
|
||||||
..code = json['code'] as int |
|
||||||
..data = fromJsonT(json['data']) |
|
||||||
..extra = json['extra'] |
|
||||||
..isError = json['isError'] as bool |
|
||||||
..isSuccess = json['isSuccess'] as bool |
|
||||||
..msg = json['msg'] as String |
|
||||||
..path = json['path'] as String |
|
||||||
..timestamp = json['timestamp'] as String; |
|
||||||
} |
|
||||||
|
|
||||||
Map<String, dynamic> _$BaseDataToJson<T>( |
|
||||||
BaseData<T> instance, |
|
||||||
Object Function(T value) toJsonT, |
|
||||||
) => |
|
||||||
<String, dynamic>{ |
|
||||||
'code': instance.code, |
|
||||||
'data': toJsonT(instance.data), |
|
||||||
'extra': instance.extra, |
|
||||||
'isError': instance.isError, |
|
||||||
'isSuccess': instance.isSuccess, |
|
||||||
'msg': instance.msg, |
|
||||||
'path': instance.path, |
|
||||||
'timestamp': instance.timestamp, |
|
||||||
}; |
|
@ -1,41 +0,0 @@ |
|||||||
// GENERATED CODE - DO NOT MODIFY BY HAND |
|
||||||
|
|
||||||
part of 'page.dart'; |
|
||||||
|
|
||||||
// ************************************************************************** |
|
||||||
// JsonSerializableGenerator |
|
||||||
// ************************************************************************** |
|
||||||
|
|
||||||
PageInfo<D> _$PageInfoFromJson<D>( |
|
||||||
Map<String, dynamic> json, |
|
||||||
D Function(Object json) fromJsonD, |
|
||||||
) { |
|
||||||
return PageInfo<D>() |
|
||||||
..pageNum = json['pageNum'] as int |
|
||||||
..current = json['current'] |
|
||||||
..pageSize = json['pageSize'] as int |
|
||||||
..size = json['size'] |
|
||||||
..pages = json['pages'] |
|
||||||
..hasPreviousPage = json['hasPreviousPage'] as bool |
|
||||||
..hasNextPage = json['hasNextPage'] as bool |
|
||||||
..total = json['total'] as String |
|
||||||
..list = (json['list'] as List)?.map(fromJsonD)?.toList() |
|
||||||
..records = (json['records'] as List)?.map(fromJsonD)?.toList(); |
|
||||||
} |
|
||||||
|
|
||||||
Map<String, dynamic> _$PageInfoToJson<D>( |
|
||||||
PageInfo<D> instance, |
|
||||||
Object Function(D value) toJsonD, |
|
||||||
) => |
|
||||||
<String, dynamic>{ |
|
||||||
'pageNum': instance.pageNum, |
|
||||||
'current': instance.current, |
|
||||||
'pageSize': instance.pageSize, |
|
||||||
'size': instance.size, |
|
||||||
'pages': instance.pages, |
|
||||||
'hasPreviousPage': instance.hasPreviousPage, |
|
||||||
'hasNextPage': instance.hasNextPage, |
|
||||||
'total': instance.total, |
|
||||||
'list': instance.list?.map(toJsonD)?.toList(), |
|
||||||
'records': instance.records?.map(toJsonD)?.toList(), |
|
||||||
}; |
|
@ -0,0 +1,112 @@ |
|||||||
|
import 'dart:convert'; |
||||||
|
|
||||||
|
import 'package:dio/dio.dart'; |
||||||
|
import 'package:flutter/foundation.dart'; |
||||||
|
import 'package:flutter/material.dart'; |
||||||
|
import 'package:flutter_easyloading/flutter_easyloading.dart'; |
||||||
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; |
||||||
|
import 'package:huixiang/generated/l10n.dart'; |
||||||
|
import 'package:huixiang/view_widget/login_tips_dialog.dart'; |
||||||
|
import 'package:retrofit/retrofit.dart'; |
||||||
|
|
||||||
|
part 'min_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 = "http://192.168.10.236:8766/app/"; ///费韬 |
||||||
|
// const baseUrl = "http://192.168.10.236:8766/app/"; ///费韬 |
||||||
|
|
||||||
|
// const base_url = "http://192.168.10.37:8766/app/"; |
||||||
|
// const baseUrl = "http://192.168.10.37:8766/app/"; |
||||||
|
|
||||||
|
///调用小程序的接口 |
||||||
|
@RestApi(baseUrl: baseUrl) |
||||||
|
abstract class MinApiService { |
||||||
|
factory MinApiService(Dio dio, { |
||||||
|
String baseUrl, |
||||||
|
BuildContext context, |
||||||
|
String token, |
||||||
|
bool showLoading = true, |
||||||
|
bool pay = false, |
||||||
|
}) { |
||||||
|
Map<String, dynamic> headers = |
||||||
|
(token == null || token == "") ? {} : {'token': "Bearer $token"}; |
||||||
|
if (pay) { |
||||||
|
headers["Environment"] = "app"; |
||||||
|
} |
||||||
|
dio.options = BaseOptions( |
||||||
|
connectTimeout: 60000, |
||||||
|
receiveTimeout: 60000, |
||||||
|
headers: headers, |
||||||
|
responseType: ResponseType.json, |
||||||
|
); |
||||||
|
dio.interceptors.add( |
||||||
|
InterceptorsWrapper(onRequest: (RequestOptions options) { |
||||||
|
debugPrint("\n======================= Min_请求数据 ======================="); |
||||||
|
debugPrint("method = ${options.method.toString()}"); |
||||||
|
debugPrint("url = ${options.uri.toString()}"); |
||||||
|
debugPrint("headers = ${options.headers}"); |
||||||
|
if (showLoading && !EasyLoading.isShow) { |
||||||
|
//是否显示loading |
||||||
|
EasyLoading.show(status: S.of(context).zhengzaijiazai); |
||||||
|
} |
||||||
|
if (options.data is FormData) { |
||||||
|
debugPrint("params data = FormData"); |
||||||
|
} else { |
||||||
|
debugPrint("params data = ${jsonEncode(options.data)}"); |
||||||
|
} |
||||||
|
debugPrint("params queryParameters = ${options.queryParameters}"); |
||||||
|
}, onResponse: (Response response) { |
||||||
|
debugPrint("\n======================= Min_响应数据开始 ======================="); |
||||||
|
if (showLoading && EasyLoading.isShow) { |
||||||
|
EasyLoading.dismiss(); |
||||||
|
} |
||||||
|
debugPrint("code = ${response.statusCode}"); |
||||||
|
p(jsonEncode(response.data)); |
||||||
|
Map map = response.data; |
||||||
|
if (map["code"] != 0) { |
||||||
|
EasyLoading.dismiss(); |
||||||
|
} |
||||||
|
if (map["code"] == 40005 || map["code"] == 40001) { |
||||||
|
if (!LoginTipsDialog().isShow) { |
||||||
|
print("show: ${LoginTipsDialog().isShow}"); |
||||||
|
LoginTipsDialog().show(context); |
||||||
|
} |
||||||
|
} else if (map["code"] != 0 && response.request.baseUrl == baseUrl) { |
||||||
|
///高德地图的poi服务请求不需要toast |
||||||
|
SmartDialog.showToast(map["msg"], alignment: Alignment.center); |
||||||
|
} |
||||||
|
debugPrint("======================= Min_响应数据结束 =======================\n"); |
||||||
|
}, onError: (DioError e) { |
||||||
|
if (EasyLoading.isShow) { |
||||||
|
EasyLoading.dismiss(); |
||||||
|
} |
||||||
|
debugPrint("\n======================= Min_错误响应数据 ======================="); |
||||||
|
debugPrint("type = ${e.type}"); |
||||||
|
debugPrint("message = ${e.message}"); |
||||||
|
debugPrint("\n"); |
||||||
|
}), |
||||||
|
); |
||||||
|
|
||||||
|
if (kReleaseMode) { |
||||||
|
baseUrl = base_url; |
||||||
|
} |
||||||
|
return _MinApiService(dio, baseUrl: baseUrl); |
||||||
|
} |
||||||
|
|
||||||
|
static void p(String msg) { |
||||||
|
//因为String的length是字符数量不是字节数量所以为了防止中文字符过多, |
||||||
|
// 把4*1024的MAX字节打印长度改为1000字符数 |
||||||
|
int maxStrLength = 900; |
||||||
|
//大于1000时 |
||||||
|
while (msg.length > maxStrLength) { |
||||||
|
debugPrint(msg.substring(0, maxStrLength)); |
||||||
|
msg = msg.substring(maxStrLength); |
||||||
|
} |
||||||
|
//剩余部分 |
||||||
|
print(msg); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,168 @@ |
|||||||
|
import 'package:flutter/material.dart'; |
||||||
|
import 'package:flutter_swiper/flutter_swiper.dart'; |
||||||
|
import 'package:huixiang/retrofit/data/activity.dart'; |
||||||
|
import 'package:huixiang/utils/font_weight.dart'; |
||||||
|
import 'package:huixiang/view_widget/custom_image.dart'; |
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||||
|
import 'package:huixiang/view_widget/no_data_view.dart'; |
||||||
|
|
||||||
|
class StoreActivity extends StatefulWidget { |
||||||
|
final Map<String, dynamic> arguments; |
||||||
|
final List<Activity> activitys; |
||||||
|
|
||||||
|
StoreActivity(this.arguments, this.activitys); |
||||||
|
|
||||||
|
@override |
||||||
|
State<StatefulWidget> createState() { |
||||||
|
return _StoreActivity(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
class _StoreActivity extends State<StoreActivity> { |
||||||
|
@override |
||||||
|
Widget build(BuildContext context) { |
||||||
|
return (widget.activitys == null || widget.activitys.length == 0) |
||||||
|
? NoDataView( |
||||||
|
isShowBtn: false, |
||||||
|
text: "还没有活动~", |
||||||
|
fontSize: 16.sp, |
||||||
|
margin: EdgeInsets.only(top: 180.h), |
||||||
|
) |
||||||
|
: Container( |
||||||
|
width: MediaQuery.of(context).size.width, |
||||||
|
height: MediaQuery.of(context).size.height, |
||||||
|
color: Colors.white, |
||||||
|
child: Swiper( |
||||||
|
viewportFraction: 0.95, |
||||||
|
loop: false, |
||||||
|
itemBuilder: (context, position) { |
||||||
|
return InkWell( |
||||||
|
onTap: () { |
||||||
|
if (widget.arguments["source"] != null && |
||||||
|
widget.arguments["source"] == |
||||||
|
widget.activitys[position].id) { |
||||||
|
Navigator.of(context).pop(); |
||||||
|
} else { |
||||||
|
Navigator.of(context).pushNamed('/router/web_page', |
||||||
|
arguments: { |
||||||
|
"activityId": widget.activitys[position].id, |
||||||
|
"source": widget.arguments["id"] |
||||||
|
}); |
||||||
|
} |
||||||
|
}, |
||||||
|
child: Container( |
||||||
|
margin: EdgeInsets.symmetric(horizontal: 5.w), |
||||||
|
decoration: BoxDecoration( |
||||||
|
color: Colors.white, |
||||||
|
borderRadius: BorderRadius.circular(8), |
||||||
|
boxShadow: [ |
||||||
|
BoxShadow( |
||||||
|
color: Color(0x0D000000), |
||||||
|
offset: Offset(0, 3), |
||||||
|
blurRadius: 14, |
||||||
|
spreadRadius: 0, |
||||||
|
), |
||||||
|
], |
||||||
|
), |
||||||
|
child: Stack( |
||||||
|
children: [ |
||||||
|
Container( |
||||||
|
child: Column( |
||||||
|
mainAxisAlignment: MainAxisAlignment.start, |
||||||
|
crossAxisAlignment: CrossAxisAlignment.start, |
||||||
|
mainAxisSize: MainAxisSize.max, |
||||||
|
children: [ |
||||||
|
MImage( |
||||||
|
(widget.activitys != null && |
||||||
|
widget.activitys.length > position) |
||||||
|
? widget.activitys[position].coverImg |
||||||
|
: "", |
||||||
|
aspectRatio: 2.2, |
||||||
|
radius: BorderRadius.vertical( |
||||||
|
top: Radius.circular(8), |
||||||
|
), |
||||||
|
fit: BoxFit.cover, |
||||||
|
errorSrc: "assets/image/default_2_1.png", |
||||||
|
fadeSrc: "assets/image/default_2_1.png", |
||||||
|
), |
||||||
|
Container( |
||||||
|
padding: EdgeInsets.all(8), |
||||||
|
child: Column( |
||||||
|
mainAxisAlignment: MainAxisAlignment.start, |
||||||
|
crossAxisAlignment: CrossAxisAlignment.start, |
||||||
|
children: [ |
||||||
|
Text( |
||||||
|
(widget.activitys != null && |
||||||
|
widget.activitys.length > |
||||||
|
position) |
||||||
|
? widget.activitys[position].storeName |
||||||
|
: "", |
||||||
|
style: TextStyle( |
||||||
|
fontSize: 14.sp, |
||||||
|
fontWeight: MyFontWeight.semi_bold, |
||||||
|
color: Color(0xFF000000), |
||||||
|
), |
||||||
|
), |
||||||
|
SizedBox( |
||||||
|
height: 4.h, |
||||||
|
), |
||||||
|
Text( |
||||||
|
(widget.activitys != null && |
||||||
|
widget.activitys.length > |
||||||
|
position) |
||||||
|
? widget.activitys[position].mainTitle |
||||||
|
: "", |
||||||
|
style: TextStyle( |
||||||
|
fontSize: 12.sp, |
||||||
|
fontWeight: MyFontWeight.semi_bold, |
||||||
|
color: Color(0xFF727272), |
||||||
|
), |
||||||
|
), |
||||||
|
], |
||||||
|
), |
||||||
|
), |
||||||
|
], |
||||||
|
), |
||||||
|
), |
||||||
|
Positioned( |
||||||
|
top: 0, |
||||||
|
right: 0, |
||||||
|
child: Container( |
||||||
|
padding: EdgeInsets.symmetric( |
||||||
|
vertical: 4.h, |
||||||
|
horizontal: 8.w, |
||||||
|
), |
||||||
|
decoration: BoxDecoration( |
||||||
|
color: Colors.black.withAlpha(76), |
||||||
|
borderRadius: BorderRadius.only( |
||||||
|
bottomLeft: Radius.circular(8), |
||||||
|
topRight: Radius.circular(8), |
||||||
|
), |
||||||
|
), |
||||||
|
child: Text( |
||||||
|
(widget.activitys != null && |
||||||
|
widget.activitys.length > position) |
||||||
|
? widget.activitys[position].startTime |
||||||
|
.split(" ")[0] |
||||||
|
: "", |
||||||
|
style: TextStyle( |
||||||
|
fontWeight: MyFontWeight.semi_bold, |
||||||
|
fontSize: 12.sp, |
||||||
|
color: Color(0xD9FFFFFF), |
||||||
|
), |
||||||
|
), |
||||||
|
), |
||||||
|
), |
||||||
|
], |
||||||
|
), |
||||||
|
), |
||||||
|
); |
||||||
|
}, |
||||||
|
itemCount: |
||||||
|
(widget.activitys != null && widget.activitys.length > 0) |
||||||
|
? widget.activitys.length |
||||||
|
: 0, |
||||||
|
), |
||||||
|
); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,85 @@ |
|||||||
|
import 'package:flutter/material.dart'; |
||||||
|
import 'package:huixiang/retrofit/data/store_info.dart'; |
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||||
|
import 'package:huixiang/store/store_view/store_info.dart'; |
||||||
|
import 'package:huixiang/union/union_view/union_coupon.dart'; |
||||||
|
import 'package:huixiang/union/union_view/vip.dart'; |
||||||
|
|
||||||
|
class StoreHeader extends SliverPersistentHeaderDelegate { |
||||||
|
final StoreInfo storeInfo; |
||||||
|
final double minHeight; |
||||||
|
|
||||||
|
StoreHeader(this.storeInfo, this.minHeight); |
||||||
|
|
||||||
|
@override |
||||||
|
Widget build(BuildContext context, double shrinkOffset, bool overlapsContent) { |
||||||
|
print("overlapsContent: $overlapsContent"); |
||||||
|
return Stack( |
||||||
|
children: [ |
||||||
|
Positioned( |
||||||
|
child: Column( |
||||||
|
children: [ |
||||||
|
Image.asset( |
||||||
|
"assets/image/share_image_bg.png", |
||||||
|
fit: BoxFit.cover, |
||||||
|
width: MediaQuery.of(context).size.width, |
||||||
|
height: 180.h, |
||||||
|
), |
||||||
|
Expanded( |
||||||
|
child: Container( |
||||||
|
color: Colors.transparent, |
||||||
|
), |
||||||
|
flex: 1, |
||||||
|
), |
||||||
|
], |
||||||
|
), |
||||||
|
top: 0, |
||||||
|
bottom: 0, |
||||||
|
left: 0, |
||||||
|
right: 0, |
||||||
|
), |
||||||
|
Positioned( |
||||||
|
child: Container( |
||||||
|
child: Column( |
||||||
|
children: [ |
||||||
|
///门店信息 |
||||||
|
StoreInfoView(storeInfo), |
||||||
|
|
||||||
|
///门店对应优惠券 |
||||||
|
if (storeInfo != null && storeInfo.couponVOList != null) |
||||||
|
UnionCoupon( |
||||||
|
storeInfo, |
||||||
|
(a) {}, |
||||||
|
coupon: true, |
||||||
|
), |
||||||
|
|
||||||
|
SizedBox( |
||||||
|
height: 8, |
||||||
|
), |
||||||
|
|
||||||
|
///门店对应VIP信息 |
||||||
|
Vip(storeInfo, () {}, false), |
||||||
|
], |
||||||
|
), |
||||||
|
), |
||||||
|
top: 110.h, |
||||||
|
bottom: 0, |
||||||
|
left: 0, |
||||||
|
right: 0, |
||||||
|
), |
||||||
|
], |
||||||
|
); |
||||||
|
} // 头部展示内容 |
||||||
|
|
||||||
|
@override |
||||||
|
double get maxExtent => (storeInfo != null && storeInfo.couponVOList != null) |
||||||
|
? 425.h |
||||||
|
: 365.h; // 最大高度 |
||||||
|
|
||||||
|
@override |
||||||
|
double get minExtent => kToolbarHeight + minHeight; // 最小高度 |
||||||
|
|
||||||
|
@override |
||||||
|
bool shouldRebuild(SliverPersistentHeaderDelegate oldDelegate) => false; |
||||||
|
|
||||||
|
} |
Loading…
Reference in new issue