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>
with TickerProviderStateMixin /*, AutomaticKeepAliveClientMixin*/ {
with TickerProviderStateMixin {
TabController tabcontroller;
ApiService apiService;
MinApiService minService;
@ -125,9 +125,7 @@ class _StoreOrderPage extends State<StoreOrderPage>
await minService.getParentInfo("$tableId").catchError((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
Widget build(BuildContext context) {
return Stack(
@ -173,173 +173,181 @@ class _StoreOrderPage extends State<StoreOrderPage>
right: 0,
top: 0,
bottom: 54.h,
child: DefaultTabController(
length: 2,
child: NestedScrollView(
controller: controller,
dragStartBehavior: DragStartBehavior.start,
physics: BouncingScrollPhysics(),
headerSliverBuilder:
(BuildContext context, bool innerBoxIsScrolled) {
return [
SliverOverlapAbsorber(
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(
context),
sliver: SliverAppBar(
expandedHeight:
(storeInfo != null && storeInfo.couponVOList != null)
? 470.h
: 365.h,
floating: false,
snap: false,
pinned: true,
stretch: false,
brightness: Brightness.light,
leading: GestureDetector(
onTap: () {
Navigator.of(context).pop();
},
child: Container(
alignment: Alignment.centerRight,
margin: EdgeInsets.only(left: 10),
padding: EdgeInsets.all(6),
child: Icon(
Icons.arrow_back_ios,
color: Colors.black,
size: 24,
),
child: NestedScrollView(
controller: controller,
dragStartBehavior: DragStartBehavior.start,
physics: BouncingScrollPhysics(),
headerSliverBuilder: (BuildContext context, bool innerScrolled) {
return [
SliverOverlapAbsorber(
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(
context),
sliver: SliverAppBar(
expandedHeight:
(storeInfo != null && storeInfo.couponVOList != null)
? 470.h
: 365.h,
floating: false,
snap: false,
pinned: true,
stretch: false,
brightness: Brightness.light,
leading: GestureDetector(
onTap: () {
Navigator.of(context).pop();
},
child: Container(
alignment: Alignment.centerRight,
margin: EdgeInsets.only(left: 10),
padding: EdgeInsets.all(6),
child: Icon(
Icons.arrow_back_ios,
color: Colors.black,
size: 24,
),
),
flexibleSpace: FlexibleSpaceBar(
title: Title(
controller,
storeInfo != null ? storeInfo.storeName : '',
),
collapseMode: CollapseMode.pin,
stretchModes: [
StretchMode.zoomBackground,
StretchMode.fadeTitle,
StretchMode.blurBackground,
],
background: Stack(
children: [
Positioned(
),
flexibleSpace: FlexibleSpaceBar(
title: Title(
controller,
storeInfo != null ? storeInfo.storeName : '',
),
collapseMode: CollapseMode.pin,
stretchModes: [
StretchMode.zoomBackground,
StretchMode.fadeTitle,
StretchMode.blurBackground,
],
background: Stack(
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(
children: [
buildSwiper(),
Expanded(
child: Container(
color: Colors.transparent,
///
StoreInfoView(storeInfo),
///
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,
elevation: 0,
bottom: PreferredSize(
preferredSize: Size(
MediaQuery.of(context).size.width,
38,
),
child: Container(
padding: EdgeInsets.symmetric(horizontal: 10.w),
width: MediaQuery.of(context).size.width,
child: TabBar(
controller: tabcontroller,
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: S.of(context).diancan),
MyTab(text: S.of(context).xindianhuodong),
],
),
backgroundColor: Color(0x33FAFAFA),
centerTitle: false,
elevation: 0,
bottom: PreferredSize(
preferredSize: Size(
MediaQuery.of(context).size.width,
38,
),
child: Container(
padding: EdgeInsets.symmetric(horizontal: 10.w),
width: MediaQuery.of(context).size.width,
child: TabBar(
controller: tabcontroller,
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: S.of(context).diancan),
MyTab(text: S.of(context).xindianhuodong),
],
),
),
),
),
];
},
body: TabBarView(
physics: BouncingScrollPhysics(),
children: [
StoreOrderListPage(
widget.arguments,
activitys,
storeInfo,
shopCarGoods,
controller,
_queryMiNiDetail,
),
),
];
},
body: TabBarView(
physics: NeverScrollableScrollPhysics(),
children: [
///
StoreOrderListPage(
widget.arguments,
activitys,
storeInfo,
shopCarGoods,
controller,
_queryMiNiDetail,
),
///,
StoreActivity(
widget.arguments,
activitys,
),
],
controller: tabcontroller,
),
///,
StoreActivity(
widget.arguments,
activitys,
),
],
controller: tabcontroller,
),
),
),/*SmartRefresher(
controller: refreshController =
RefreshController(initialRefresh: false),
enablePullDown: true,
enablePullUp: false,
header: MyHeader(),
physics: BouncingScrollPhysics(),
onRefresh: () {
queryStoreInfo();
},
child:
),*/
),
Positioned(
bottom: 0,
@ -446,9 +454,11 @@ class _StoreOrderPage extends State<StoreOrderPage>
);
}
///
showPeopleNum(String tableName) async {
var people = await showDialog(
context: context,
barrierDismissible: false,
builder: (context) {
return PeopleNumView(tableName);
},
@ -458,6 +468,8 @@ class _StoreOrderPage extends State<StoreOrderPage>
setState(() {
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({
"id": widget.arguments["id"],
}).catchError((error) {
refreshController.refreshFailed();
// refreshController.refreshFailed();
});
if (baseData != null && baseData.isSuccess) {
refreshController.refreshCompleted();
// refreshController.refreshCompleted();
setState(() {
appletProducts = baseData.data;
productListBeans.clear();
@ -81,11 +81,11 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
productListBeans.addAll(appletProducts[isSelected].productList);
});
} else {
refreshController.refreshFailed();
// refreshController.refreshFailed();
}
}
RefreshController refreshController;
// RefreshController refreshController;
@override
Widget build(BuildContext context) {
@ -95,51 +95,38 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
margin: EdgeInsets.only(
top: (MediaQuery.of(context).padding.top + 38 + kToolbarHeight),
),
child: SmartRefresher(
controller: refreshController =
RefreshController(initialRefresh: false),
enablePullDown: true,
enablePullUp: false,
header: MyHeader(),
physics: BouncingScrollPhysics(),
onRefresh: () {
appletGoods();
},
child: SingleChildScrollView(
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
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);
},
),
),
],
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
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);
},
),
),
],
),
);
}

Loading…
Cancel
Save