Browse Source

safety

master
fmk 3 years ago
parent
commit
8d1f3e08be
  1. 322
      lib/store/store_order.dart
  2. 83
      lib/store/store_view/store_order_list.dart

322
lib/store/store_order.dart

@ -43,7 +43,7 @@ class StoreOrderPage extends StatefulWidget {
} }
class _StoreOrderPage extends State<StoreOrderPage> class _StoreOrderPage extends State<StoreOrderPage>
with TickerProviderStateMixin /*, AutomaticKeepAliveClientMixin*/ { with TickerProviderStateMixin {
TabController tabcontroller; TabController tabcontroller;
ApiService apiService; ApiService apiService;
MinApiService minService; MinApiService minService;
@ -125,9 +125,7 @@ class _StoreOrderPage extends State<StoreOrderPage>
await minService.getParentInfo("$tableId").catchError((error) { await minService.getParentInfo("$tableId").catchError((error) {
debugPrint(error); debugPrint(error);
}); });
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {}
}
} }
/// ///
@ -164,6 +162,8 @@ class _StoreOrderPage extends State<StoreOrderPage>
} }
} }
RefreshController refreshController;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Stack( return Stack(
@ -173,173 +173,181 @@ class _StoreOrderPage extends State<StoreOrderPage>
right: 0, right: 0,
top: 0, top: 0,
bottom: 54.h, bottom: 54.h,
child: DefaultTabController( child: NestedScrollView(
length: 2, controller: controller,
child: NestedScrollView( dragStartBehavior: DragStartBehavior.start,
controller: controller, physics: BouncingScrollPhysics(),
dragStartBehavior: DragStartBehavior.start, headerSliverBuilder: (BuildContext context, bool innerScrolled) {
physics: BouncingScrollPhysics(), return [
headerSliverBuilder: SliverOverlapAbsorber(
(BuildContext context, bool innerBoxIsScrolled) { handle: NestedScrollView.sliverOverlapAbsorberHandleFor(
return [ context),
SliverOverlapAbsorber( sliver: SliverAppBar(
handle: NestedScrollView.sliverOverlapAbsorberHandleFor( expandedHeight:
context), (storeInfo != null && storeInfo.couponVOList != null)
sliver: SliverAppBar( ? 470.h
expandedHeight: : 365.h,
(storeInfo != null && storeInfo.couponVOList != null) floating: false,
? 470.h snap: false,
: 365.h, pinned: true,
floating: false, stretch: false,
snap: false, brightness: Brightness.light,
pinned: true, leading: GestureDetector(
stretch: false, onTap: () {
brightness: Brightness.light, Navigator.of(context).pop();
leading: GestureDetector( },
onTap: () { child: Container(
Navigator.of(context).pop(); alignment: Alignment.centerRight,
}, margin: EdgeInsets.only(left: 10),
child: Container( padding: EdgeInsets.all(6),
alignment: Alignment.centerRight, child: Icon(
margin: EdgeInsets.only(left: 10), Icons.arrow_back_ios,
padding: EdgeInsets.all(6), color: Colors.black,
child: Icon( size: 24,
Icons.arrow_back_ios,
color: Colors.black,
size: 24,
),
), ),
), ),
flexibleSpace: FlexibleSpaceBar( ),
title: Title( flexibleSpace: FlexibleSpaceBar(
controller, title: Title(
storeInfo != null ? storeInfo.storeName : '', controller,
), storeInfo != null ? storeInfo.storeName : '',
collapseMode: CollapseMode.pin, ),
stretchModes: [ collapseMode: CollapseMode.pin,
StretchMode.zoomBackground, stretchModes: [
StretchMode.fadeTitle, StretchMode.zoomBackground,
StretchMode.blurBackground, StretchMode.fadeTitle,
], StretchMode.blurBackground,
background: Stack( ],
children: [ background: Stack(
Positioned( children: [
Positioned(
child: Column(
children: [
buildSwiper(),
Expanded(
child: Container(
color: Colors.transparent,
),
flex: 1,
),
],
),
top: 0,
bottom: 0,
left: 0,
right: 0,
),
Positioned(
child: Container(
child: Column( child: Column(
children: [ children: [
buildSwiper(), ///
Expanded( StoreInfoView(storeInfo),
child: Container(
color: Colors.transparent, ///
if (storeInfo != null &&
storeInfo.couponVOList != null)
UnionCoupon(
storeInfo,
_receiveCoupon,
coupon: true,
), ),
flex: 1,
), if (storeInfo == null ||
storeInfo.couponVOList == null)
SizedBox(
height: 8,
),
///VIP信息
Vip(storeInfo, () {}, false),
], ],
), ),
top: 0,
bottom: 0,
left: 0,
right: 0,
),
Positioned(
child: Container(
child: Column(
children: [
///
StoreInfoView(storeInfo),
///
if (storeInfo != null &&
storeInfo.couponVOList != null)
UnionCoupon(
storeInfo,
_receiveCoupon,
coupon: true,
),
if (storeInfo == null ||
storeInfo.couponVOList == null)
SizedBox(
height: 8,
),
///VIP信息
Vip(storeInfo, () {}, false),
],
),
),
top: 110.h,
bottom: 0,
left: 0,
right: 0,
), ),
], top: 110.h,
), bottom: 0,
left: 0,
right: 0,
),
],
), ),
backgroundColor: Color(0x33FAFAFA), ),
centerTitle: false, backgroundColor: Color(0x33FAFAFA),
elevation: 0, centerTitle: false,
bottom: PreferredSize( elevation: 0,
preferredSize: Size( bottom: PreferredSize(
MediaQuery.of(context).size.width, preferredSize: Size(
38, MediaQuery.of(context).size.width,
), 38,
child: Container( ),
padding: EdgeInsets.symmetric(horizontal: 10.w), child: Container(
width: MediaQuery.of(context).size.width, padding: EdgeInsets.symmetric(horizontal: 10.w),
child: TabBar( width: MediaQuery.of(context).size.width,
controller: tabcontroller, child: TabBar(
automaticIndicatorColorAdjustment: true, controller: tabcontroller,
isScrollable: true, automaticIndicatorColorAdjustment: true,
indicatorWeight: 1, isScrollable: true,
indicatorColor: Color(0xFFFAFAFA), indicatorWeight: 1,
labelPadding: EdgeInsets.only( indicatorColor: Color(0xFFFAFAFA),
left: 8.w, labelPadding: EdgeInsets.only(
right: 8.w, left: 8.w,
), right: 8.w,
indicatorSize: TabBarIndicatorSize.label, ),
unselectedLabelStyle: TextStyle( indicatorSize: TabBarIndicatorSize.label,
fontSize: 15.sp, unselectedLabelStyle: TextStyle(
fontWeight: FontWeight.w400, fontSize: 15.sp,
), fontWeight: FontWeight.w400,
labelStyle: TextStyle( ),
color: Colors.black, labelStyle: TextStyle(
fontSize: 18.sp, color: Colors.black,
fontWeight: FontWeight.bold, fontSize: 18.sp,
), fontWeight: FontWeight.bold,
labelColor: Colors.black,
tabs: [
MyTab(text: S.of(context).diancan),
MyTab(text: S.of(context).xindianhuodong),
],
), ),
labelColor: Colors.black,
tabs: [
MyTab(text: S.of(context).diancan),
MyTab(text: S.of(context).xindianhuodong),
],
), ),
), ),
), ),
), ),
]; ),
}, ];
body: TabBarView( },
physics: BouncingScrollPhysics(), body: TabBarView(
children: [ physics: NeverScrollableScrollPhysics(),
StoreOrderListPage( children: [
widget.arguments, ///
activitys, StoreOrderListPage(
storeInfo, widget.arguments,
shopCarGoods, activitys,
controller, storeInfo,
_queryMiNiDetail, shopCarGoods,
), controller,
_queryMiNiDetail,
),
///, ///,
StoreActivity( StoreActivity(
widget.arguments, widget.arguments,
activitys, activitys,
), ),
], ],
controller: tabcontroller, controller: tabcontroller,
),
), ),
), ),/*SmartRefresher(
controller: refreshController =
RefreshController(initialRefresh: false),
enablePullDown: true,
enablePullUp: false,
header: MyHeader(),
physics: BouncingScrollPhysics(),
onRefresh: () {
queryStoreInfo();
},
child:
),*/
), ),
Positioned( Positioned(
bottom: 0, bottom: 0,
@ -446,9 +454,11 @@ class _StoreOrderPage extends State<StoreOrderPage>
); );
} }
///
showPeopleNum(String tableName) async { showPeopleNum(String tableName) async {
var people = await showDialog( var people = await showDialog(
context: context, context: context,
barrierDismissible: false,
builder: (context) { builder: (context) {
return PeopleNumView(tableName); return PeopleNumView(tableName);
}, },
@ -458,6 +468,8 @@ class _StoreOrderPage extends State<StoreOrderPage>
setState(() { setState(() {
this.numberOfPeople = people; this.numberOfPeople = people;
}); });
} else {
Navigator.of(context).pop();
} }
} }

83
lib/store/store_view/store_order_list.dart

@ -70,10 +70,10 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
await minService.findMiNiGroupList({ await minService.findMiNiGroupList({
"id": widget.arguments["id"], "id": widget.arguments["id"],
}).catchError((error) { }).catchError((error) {
refreshController.refreshFailed(); // refreshController.refreshFailed();
}); });
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
refreshController.refreshCompleted(); // refreshController.refreshCompleted();
setState(() { setState(() {
appletProducts = baseData.data; appletProducts = baseData.data;
productListBeans.clear(); productListBeans.clear();
@ -81,11 +81,11 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
productListBeans.addAll(appletProducts[isSelected].productList); productListBeans.addAll(appletProducts[isSelected].productList);
}); });
} else { } else {
refreshController.refreshFailed(); // refreshController.refreshFailed();
} }
} }
RefreshController refreshController; // RefreshController refreshController;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -95,51 +95,38 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
margin: EdgeInsets.only( margin: EdgeInsets.only(
top: (MediaQuery.of(context).padding.top + 38 + kToolbarHeight), top: (MediaQuery.of(context).padding.top + 38 + kToolbarHeight),
), ),
child: SmartRefresher( child: Row(
controller: refreshController = mainAxisAlignment: MainAxisAlignment.start,
RefreshController(initialRefresh: false), crossAxisAlignment: CrossAxisAlignment.start,
enablePullDown: true, mainAxisSize: MainAxisSize.max,
enablePullUp: false, children: [
header: MyHeader(), Container(
physics: BouncingScrollPhysics(), width: 100.w,
onRefresh: () { child: ListView.builder(
appletGoods(); itemCount: appletProducts == null ? 0 : appletProducts.length,
}, controller: controller1,
child: SingleChildScrollView( physics: BouncingScrollPhysics(),
child: Row( shrinkWrap: true,
mainAxisAlignment: MainAxisAlignment.start, padding: EdgeInsets.only(top: 0, bottom: 25),
crossAxisAlignment: CrossAxisAlignment.start, itemBuilder: (context, position) {
mainAxisSize: MainAxisSize.max, return orderItem(appletProducts[position], position);
children: [ },
Container( ),
width: 100.w,
child: ListView.builder(
itemCount: appletProducts == null ? 0 : appletProducts.length,
controller: controller1,
physics: BouncingScrollPhysics(),
shrinkWrap: true,
padding: EdgeInsets.only(top: 0, bottom: 25),
itemBuilder: (context, position) {
return orderItem(appletProducts[position], position);
},
),
),
Container(
width: MediaQuery.of(context).size.width - 100.w,
child: ListView.builder(
itemCount:
productListBeans == null ? 0 : productListBeans.length,
physics: BouncingScrollPhysics(),
shrinkWrap: true,
padding: EdgeInsets.zero,
itemBuilder: (context, position) {
return goodsItem(position);
},
),
),
],
), ),
), Container(
width: MediaQuery.of(context).size.width - 100.w,
child: ListView.builder(
itemCount:
productListBeans == null ? 0 : productListBeans.length,
physics: BouncingScrollPhysics(),
shrinkWrap: true,
padding: EdgeInsets.zero,
itemBuilder: (context, position) {
return goodsItem(position);
},
),
),
],
), ),
); );
} }

Loading…
Cancel
Save