fmk
3 years ago
9 changed files with 1811 additions and 114 deletions
@ -0,0 +1,37 @@
|
||||
// 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, |
||||
}; |
@ -0,0 +1,41 @@
|
||||
// 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(), |
||||
}; |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,221 @@
|
||||
import 'package:dio/dio.dart'; |
||||
import 'package:flutter/material.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
import 'package:huixiang/retrofit/data/base_data.dart'; |
||||
import 'package:huixiang/retrofit/data/store_info.dart'; |
||||
import 'package:huixiang/retrofit/retrofit_api.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'; |
||||
import 'package:huixiang/view_widget/classic_header.dart'; |
||||
import 'package:huixiang/view_widget/my_tab.dart'; |
||||
import 'package:pull_to_refresh/pull_to_refresh.dart'; |
||||
import 'package:shared_preferences/shared_preferences.dart'; |
||||
|
||||
class StoreOrderPage extends StatefulWidget { |
||||
final Map arguments; |
||||
|
||||
StoreOrderPage({this.arguments}); |
||||
|
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _StoreOrderPage(); |
||||
} |
||||
} |
||||
|
||||
class _StoreOrderPage extends State<StoreOrderPage> |
||||
with TickerProviderStateMixin, AutomaticKeepAliveClientMixin { |
||||
TabController tabcontroller; |
||||
ApiService apiService; |
||||
StoreInfo storeInfo; |
||||
RefreshController refreshController; |
||||
|
||||
@override |
||||
void initState() { |
||||
super.initState(); |
||||
|
||||
refreshController = RefreshController(initialRefresh: false); |
||||
|
||||
queryStoreInfo(); |
||||
|
||||
} |
||||
|
||||
queryStoreInfo() async { |
||||
final SharedPreferences value = await SharedPreferences.getInstance(); |
||||
apiService = ApiService( |
||||
Dio(), |
||||
context: context, |
||||
token: value.getString('token'), |
||||
); |
||||
|
||||
BaseData baseData = await apiService |
||||
.queryStoreInfo(widget.arguments["id"]) |
||||
.catchError((error) { |
||||
refreshController.refreshFailed(); |
||||
}); |
||||
if (baseData != null && baseData.isSuccess) { |
||||
refreshController.refreshCompleted(); |
||||
storeInfo = StoreInfo.fromJson(baseData.data); |
||||
if (mounted) { |
||||
setState(() {}); |
||||
} |
||||
} else { |
||||
refreshController.refreshFailed(); |
||||
} |
||||
} |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Column( |
||||
children: [ |
||||
Expanded( |
||||
child: DefaultTabController( |
||||
length: 2, |
||||
child: SmartRefresher( |
||||
controller: refreshController, |
||||
enablePullDown: true, |
||||
enablePullUp: false, |
||||
header: MyHeader(), |
||||
physics: BouncingScrollPhysics(), |
||||
onRefresh: () { |
||||
setState(() {}); |
||||
}, |
||||
child: NestedScrollView( |
||||
headerSliverBuilder: |
||||
(BuildContext context, bool innerBoxIsScrolled) { |
||||
return [ |
||||
SliverOverlapAbsorber( |
||||
handle: NestedScrollView.sliverOverlapAbsorberHandleFor( |
||||
context), |
||||
sliver: SliverAppBar( |
||||
title: Text(""), |
||||
expandedHeight: 365.h, |
||||
floating: false, |
||||
snap: false, |
||||
pinned: true, |
||||
flexibleSpace: FlexibleSpaceBar( |
||||
background: 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(), |
||||
|
||||
///门店对应优惠券 |
||||
if (storeInfo != null && storeInfo.couponVOList != null) |
||||
UnionCoupon( |
||||
storeInfo, |
||||
(a) {}, |
||||
coupon: true, |
||||
), |
||||
|
||||
///门店对应VIP信息 |
||||
Vip(storeInfo, () {}, false), |
||||
], |
||||
), |
||||
), |
||||
top: 110.h, |
||||
bottom: 0, |
||||
left: 0, |
||||
right: 0, |
||||
), |
||||
], |
||||
), |
||||
collapseMode: CollapseMode.pin, |
||||
), |
||||
backgroundColor: Color(0xFFFAFAFA), |
||||
centerTitle: false, |
||||
elevation: 0, |
||||
bottom: PreferredSize( |
||||
preferredSize: Size( |
||||
MediaQuery.of(context).size.width, |
||||
38.h, |
||||
), |
||||
child: Container( |
||||
padding: EdgeInsets.symmetric(horizontal: 10.w), |
||||
width: MediaQuery.of(context).size.width, |
||||
child: TabBar( |
||||
controller: tabcontroller = TabController( |
||||
length: 2, |
||||
vsync: this, |
||||
), |
||||
automaticIndicatorColorAdjustment: true, |
||||
isScrollable: true, |
||||
indicatorWeight: 1, |
||||
indicatorColor: Color(0xFFFAFAFA), |
||||
labelPadding: EdgeInsets.only(left: 8.w, right: 8.w), |
||||
indicatorSize: TabBarIndicatorSize.label, |
||||
unselectedLabelStyle: TextStyle( |
||||
fontSize: 15.sp, |
||||
fontWeight: FontWeight.w400, |
||||
), |
||||
labelStyle: TextStyle( |
||||
color: Colors.black, |
||||
fontSize: 18.sp, |
||||
fontWeight: FontWeight.bold, |
||||
), |
||||
labelColor: Colors.black, |
||||
tabs: [ |
||||
MyTab(text: "点单"), |
||||
MyTab(text: "星店活动"), |
||||
], |
||||
), |
||||
), |
||||
), |
||||
), |
||||
), |
||||
]; |
||||
}, |
||||
body: TabBarView( |
||||
physics: BouncingScrollPhysics(), |
||||
children: [ |
||||
Container( |
||||
width: MediaQuery.of(context).size.width, |
||||
height: MediaQuery.of(context).size.width, |
||||
), |
||||
Container( |
||||
width: MediaQuery.of(context).size.width, |
||||
height: MediaQuery.of(context).size.width, |
||||
) |
||||
], |
||||
controller: tabcontroller, |
||||
), |
||||
), |
||||
), |
||||
), |
||||
), |
||||
Container( |
||||
height: 50.h, |
||||
color: Colors.blue, |
||||
), |
||||
], |
||||
); |
||||
} |
||||
|
||||
@override |
||||
bool get wantKeepAlive => true; |
||||
} |
@ -0,0 +1,166 @@
|
||||
import 'package:flutter/material.dart'; |
||||
import 'package:huixiang/generated/l10n.dart'; |
||||
import 'package:huixiang/utils/flutter_utils.dart'; |
||||
import 'package:huixiang/utils/font_weight.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
import 'package:huixiang/view_widget/round_button.dart'; |
||||
|
||||
class StoreInfoView extends StatefulWidget { |
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _StoreInfoView(); |
||||
} |
||||
} |
||||
|
||||
class _StoreInfoView extends State<StoreInfoView> { |
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Container( |
||||
margin: EdgeInsets.only( |
||||
left: 16.w, |
||||
right: 16.w, |
||||
top: 5.h, |
||||
bottom: 6.h, |
||||
), |
||||
height: 138.h, |
||||
padding: EdgeInsets.all(12.w), |
||||
decoration: BoxDecoration( |
||||
color: Colors.white, |
||||
borderRadius: BorderRadius.circular(8.w), |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(25), |
||||
offset: Offset(0, 3), |
||||
blurRadius: 3, |
||||
spreadRadius: 0, |
||||
), |
||||
], |
||||
), |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Expanded( |
||||
child: Row( |
||||
children: [ |
||||
Expanded( |
||||
child: Column( |
||||
children: [ |
||||
Container( |
||||
alignment: Alignment.centerLeft, |
||||
child: Text( |
||||
"百年川椒", |
||||
overflow: TextOverflow.ellipsis, |
||||
style: TextStyle( |
||||
fontSize: 18.sp, |
||||
color: Colors.black, |
||||
fontWeight: MyFontWeight.medium, |
||||
), |
||||
), |
||||
), |
||||
Row( |
||||
children: [ |
||||
Text( |
||||
S.of(context).ren("1"), |
||||
overflow: TextOverflow.ellipsis, |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
color: Color(0xFF353535), |
||||
), |
||||
), |
||||
SizedBox( |
||||
width: 20.w, |
||||
), |
||||
]..addAll(itemServer("11,22")), |
||||
), |
||||
Text( |
||||
"地址:武昌区楚河汉界第一街区万达总部国际C座对面", |
||||
maxLines: 2, |
||||
textAlign: TextAlign.justify, |
||||
style: TextStyle( |
||||
color: Color(0xFF353535), |
||||
fontWeight: MyFontWeight.regular, |
||||
fontSize: 12.sp, |
||||
), |
||||
), |
||||
], |
||||
mainAxisAlignment: MainAxisAlignment.spaceAround, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
), |
||||
), |
||||
Image.asset( |
||||
"assets/image/icon_vip_name.png", |
||||
width: 70.w, |
||||
height: 70.w, |
||||
) |
||||
], |
||||
mainAxisAlignment: MainAxisAlignment.spaceAround, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
), |
||||
flex: 1, |
||||
), |
||||
Row( |
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
||||
crossAxisAlignment: CrossAxisAlignment.end, |
||||
children: [ |
||||
Expanded( |
||||
child: Text( |
||||
S.of(context).yingyeshijian("10:00-22:00"), |
||||
style: TextStyle( |
||||
color: Color(0xFF353535), |
||||
fontWeight: MyFontWeight.regular, |
||||
fontSize: 12.sp, |
||||
), |
||||
), |
||||
), |
||||
SizedBox( |
||||
width: 16.w, |
||||
), |
||||
InkWell( |
||||
onTap: () {}, |
||||
child: Image.asset( |
||||
"assets/image/icon_union_location.png", |
||||
width: 24.w, |
||||
height: 24.h, |
||||
), |
||||
), |
||||
SizedBox( |
||||
width: 16.w, |
||||
), |
||||
InkWell( |
||||
onTap: () {}, |
||||
child: Image.asset( |
||||
"assets/image/icon_union_call.png", |
||||
width: 24, |
||||
height: 24, |
||||
), |
||||
), |
||||
], |
||||
), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
List<Widget> itemServer(String businessService) { |
||||
if (businessService == null || businessService == "") return []; |
||||
var list = businessService.split(","); |
||||
return list |
||||
.map((e) => Container( |
||||
margin: EdgeInsets.only(right: 8.w), |
||||
child: RoundButton( |
||||
height: 14.h * AppUtils.textScale(context), |
||||
text: "$e", |
||||
backgroup: Color(0xFFFF7A1A), |
||||
padding: EdgeInsets.only( |
||||
left: 2.w, |
||||
right: 2.w, |
||||
), |
||||
fontSize: 10.sp, |
||||
textColor: Colors.white, |
||||
), |
||||
)) |
||||
.toList(); |
||||
} |
||||
} |
Loading…
Reference in new issue