|
|
@ -3,9 +3,11 @@ import 'package:flutter/cupertino.dart'; |
|
|
|
import 'package:flutter/gestures.dart'; |
|
|
|
import 'package:flutter/gestures.dart'; |
|
|
|
import 'package:flutter/material.dart'; |
|
|
|
import 'package:flutter/material.dart'; |
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|
|
|
|
|
|
|
import 'package:flutter_swiper/flutter_swiper.dart'; |
|
|
|
import 'package:huixiang/generated/l10n.dart'; |
|
|
|
import 'package:huixiang/generated/l10n.dart'; |
|
|
|
import 'package:huixiang/retrofit/data/activity.dart'; |
|
|
|
import 'package:huixiang/retrofit/data/activity.dart'; |
|
|
|
import 'package:huixiang/retrofit/data/base_data.dart'; |
|
|
|
import 'package:huixiang/retrofit/data/base_data.dart'; |
|
|
|
|
|
|
|
import 'package:huixiang/retrofit/data/findMiNiGroupList.dart'; |
|
|
|
import 'package:huixiang/retrofit/data/order_info.dart'; |
|
|
|
import 'package:huixiang/retrofit/data/order_info.dart'; |
|
|
|
import 'package:huixiang/retrofit/data/store_info.dart'; |
|
|
|
import 'package:huixiang/retrofit/data/store_info.dart'; |
|
|
|
import 'package:huixiang/retrofit/data/user_entity.dart'; |
|
|
|
import 'package:huixiang/retrofit/data/user_entity.dart'; |
|
|
@ -26,12 +28,8 @@ import 'package:shared_preferences/shared_preferences.dart'; |
|
|
|
|
|
|
|
|
|
|
|
class StoreOrderPage extends StatefulWidget { |
|
|
|
class StoreOrderPage extends StatefulWidget { |
|
|
|
final Map arguments; |
|
|
|
final Map arguments; |
|
|
|
final List<Activity> activitys; |
|
|
|
|
|
|
|
final StoreInfo storeInfo; |
|
|
|
|
|
|
|
final List<ProductList> productList; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
StoreOrderPage({this.arguments}); |
|
|
|
StoreOrderPage({this.arguments, this.activitys, this.storeInfo,this.productList}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
|
State<StatefulWidget> createState() { |
|
|
|
State<StatefulWidget> createState() { |
|
|
@ -40,11 +38,12 @@ class StoreOrderPage extends StatefulWidget { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
class _StoreOrderPage extends State<StoreOrderPage> |
|
|
|
class _StoreOrderPage extends State<StoreOrderPage> |
|
|
|
with TickerProviderStateMixin /*, AutomaticKeepAliveClientMixin */ { |
|
|
|
with TickerProviderStateMixin, AutomaticKeepAliveClientMixin { |
|
|
|
TabController tabcontroller; |
|
|
|
TabController tabcontroller; |
|
|
|
ApiService apiService; |
|
|
|
ApiService apiService; |
|
|
|
MinApiService minService; |
|
|
|
MinApiService minService; |
|
|
|
StoreInfo storeInfo; |
|
|
|
StoreInfo storeInfo; |
|
|
|
|
|
|
|
List<Activity> activitys; |
|
|
|
RefreshController refreshController; |
|
|
|
RefreshController refreshController; |
|
|
|
List<Widget> _widgetOptions; |
|
|
|
List<Widget> _widgetOptions; |
|
|
|
|
|
|
|
|
|
|
@ -62,12 +61,16 @@ class _StoreOrderPage extends State<StoreOrderPage> |
|
|
|
|
|
|
|
|
|
|
|
_widgetOptions = [ |
|
|
|
_widgetOptions = [ |
|
|
|
StoreOrderListPage( |
|
|
|
StoreOrderListPage( |
|
|
|
widget.arguments, widget.activitys, storeInfo, controller), |
|
|
|
widget.arguments, |
|
|
|
|
|
|
|
activitys, |
|
|
|
|
|
|
|
storeInfo, |
|
|
|
|
|
|
|
controller, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
|
|
|
|
///星店活动, |
|
|
|
///星店活动, |
|
|
|
StoreActivity( |
|
|
|
StoreActivity( |
|
|
|
widget.arguments, |
|
|
|
widget.arguments, |
|
|
|
widget.activitys, |
|
|
|
activitys, |
|
|
|
), |
|
|
|
), |
|
|
|
]; |
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
@ -82,7 +85,6 @@ class _StoreOrderPage extends State<StoreOrderPage> |
|
|
|
context: context, |
|
|
|
context: context, |
|
|
|
token: value.getString('token'), |
|
|
|
token: value.getString('token'), |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
BaseData baseData = await apiService |
|
|
|
BaseData baseData = await apiService |
|
|
|
.queryStoreInfo(widget.arguments["id"]) |
|
|
|
.queryStoreInfo(widget.arguments["id"]) |
|
|
|
.catchError((error) { |
|
|
|
.catchError((error) { |
|
|
@ -91,6 +93,9 @@ class _StoreOrderPage extends State<StoreOrderPage> |
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
refreshController.refreshCompleted(); |
|
|
|
refreshController.refreshCompleted(); |
|
|
|
storeInfo = StoreInfo.fromJson(baseData.data); |
|
|
|
storeInfo = StoreInfo.fromJson(baseData.data); |
|
|
|
|
|
|
|
activitys = storeInfo.informationVOPageVO.list |
|
|
|
|
|
|
|
.map((e) => Activity.fromJson(e)) |
|
|
|
|
|
|
|
.toList(); |
|
|
|
if (mounted) { |
|
|
|
if (mounted) { |
|
|
|
setState(() {}); |
|
|
|
setState(() {}); |
|
|
|
} |
|
|
|
} |
|
|
@ -127,7 +132,8 @@ class _StoreOrderPage extends State<StoreOrderPage> |
|
|
|
(BuildContext context, bool innerBoxIsScrolled) { |
|
|
|
(BuildContext context, bool innerBoxIsScrolled) { |
|
|
|
return [ |
|
|
|
return [ |
|
|
|
SliverOverlapAbsorber( |
|
|
|
SliverOverlapAbsorber( |
|
|
|
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context), |
|
|
|
handle: NestedScrollView.sliverOverlapAbsorberHandleFor( |
|
|
|
|
|
|
|
context), |
|
|
|
sliver: SliverAppBar( |
|
|
|
sliver: SliverAppBar( |
|
|
|
expandedHeight: (storeInfo != null && |
|
|
|
expandedHeight: (storeInfo != null && |
|
|
|
storeInfo.couponVOList != null) |
|
|
|
storeInfo.couponVOList != null) |
|
|
@ -168,12 +174,13 @@ class _StoreOrderPage extends State<StoreOrderPage> |
|
|
|
Positioned( |
|
|
|
Positioned( |
|
|
|
child: Column( |
|
|
|
child: Column( |
|
|
|
children: [ |
|
|
|
children: [ |
|
|
|
Image.asset( |
|
|
|
// Image.asset( |
|
|
|
"assets/image/share_image_bg.png", |
|
|
|
// "assets/image/share_image_bg.png", |
|
|
|
fit: BoxFit.cover, |
|
|
|
// fit: BoxFit.cover, |
|
|
|
width: MediaQuery.of(context).size.width, |
|
|
|
// width: MediaQuery.of(context).size.width, |
|
|
|
height: 180.h, |
|
|
|
// height: 180.h, |
|
|
|
), |
|
|
|
// ), |
|
|
|
|
|
|
|
buildSwiper(), |
|
|
|
Expanded( |
|
|
|
Expanded( |
|
|
|
child: Container( |
|
|
|
child: Container( |
|
|
|
color: Colors.transparent, |
|
|
|
color: Colors.transparent, |
|
|
@ -360,6 +367,45 @@ class _StoreOrderPage extends State<StoreOrderPage> |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Widget buildSwiper() { |
|
|
|
|
|
|
|
return Container( |
|
|
|
|
|
|
|
width: double.infinity, |
|
|
|
|
|
|
|
height: 180.h, |
|
|
|
|
|
|
|
child: Swiper( |
|
|
|
|
|
|
|
pagination: SwiperPagination( |
|
|
|
|
|
|
|
alignment: Alignment.bottomCenter, |
|
|
|
|
|
|
|
builder: DotSwiperPaginationBuilder( |
|
|
|
|
|
|
|
size: 8.w, |
|
|
|
|
|
|
|
activeSize: 8.w, |
|
|
|
|
|
|
|
space: 5.w, |
|
|
|
|
|
|
|
activeColor: Colors.white, |
|
|
|
|
|
|
|
color: Colors.white.withAlpha(76), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
itemBuilder: (context, position) { |
|
|
|
|
|
|
|
return Container( |
|
|
|
|
|
|
|
margin: EdgeInsets.only(left: 10.w, right: 10.w), |
|
|
|
|
|
|
|
child: MImage( |
|
|
|
|
|
|
|
(storeInfo != null && |
|
|
|
|
|
|
|
storeInfo.bannerList != null && |
|
|
|
|
|
|
|
position < storeInfo.bannerList.length) |
|
|
|
|
|
|
|
? storeInfo.bannerList[position].imgUrl |
|
|
|
|
|
|
|
: "", |
|
|
|
|
|
|
|
fit: BoxFit.cover, |
|
|
|
|
|
|
|
radius: BorderRadius.circular(4), |
|
|
|
|
|
|
|
errorSrc: "assets/image/default_2_1.png", |
|
|
|
|
|
|
|
fadeSrc: "assets/image/default_2_1.png", |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
itemCount: (storeInfo != null && storeInfo.bannerList != null) |
|
|
|
|
|
|
|
? storeInfo.bannerList.length |
|
|
|
|
|
|
|
: 1), |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<ProductList> productLists = []; |
|
|
|
|
|
|
|
|
|
|
|
///购物车弹窗 |
|
|
|
///购物车弹窗 |
|
|
|
showShoppingCart() { |
|
|
|
showShoppingCart() { |
|
|
|
showModalBottomSheet( |
|
|
|
showModalBottomSheet( |
|
|
@ -420,14 +466,13 @@ class _StoreOrderPage extends State<StoreOrderPage> |
|
|
|
right: 16, |
|
|
|
right: 16, |
|
|
|
), |
|
|
|
), |
|
|
|
child: ListView.builder( |
|
|
|
child: ListView.builder( |
|
|
|
itemCount: widget.productList == null ? 0 : widget.productList.length, |
|
|
|
itemCount: productLists == null ? 0 : productLists.length, |
|
|
|
physics: BouncingScrollPhysics(), |
|
|
|
physics: BouncingScrollPhysics(), |
|
|
|
itemBuilder: (context, position) { |
|
|
|
itemBuilder: (context, position) { |
|
|
|
// return shoppGoodsItem(); |
|
|
|
// return shoppGoodsItem(); |
|
|
|
return GestureDetector( |
|
|
|
return GestureDetector( |
|
|
|
onTap: () { |
|
|
|
onTap: () {}, |
|
|
|
}, |
|
|
|
child: shoppGoodsItem(productLists[position], position), |
|
|
|
child: shoppGoodsItem(widget.productList[position], position), |
|
|
|
|
|
|
|
); |
|
|
|
); |
|
|
|
}, |
|
|
|
}, |
|
|
|
), |
|
|
|
), |
|
|
@ -638,8 +683,8 @@ class _StoreOrderPage extends State<StoreOrderPage> |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// @override |
|
|
|
@override |
|
|
|
// bool get wantKeepAlive => true; |
|
|
|
bool get wantKeepAlive => true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
class Title extends StatefulWidget { |
|
|
|
class Title extends StatefulWidget { |
|
|
@ -669,7 +714,8 @@ class _Title extends State<Title> { |
|
|
|
if (alphaProgress <= 1) { |
|
|
|
if (alphaProgress <= 1) { |
|
|
|
alphatemp = 1; |
|
|
|
alphatemp = 1; |
|
|
|
} else if (alphaProgress <= alphaHeight) { |
|
|
|
} else if (alphaProgress <= alphaHeight) { |
|
|
|
alphatemp = (((alphaHeight - alphaProgress) / alphaHeight) > 0.5) ? 1 : 0; |
|
|
|
alphatemp = |
|
|
|
|
|
|
|
(((alphaHeight - alphaProgress) / alphaHeight) > 0.5) ? 1 : 0; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
alphatemp = 0; |
|
|
|
alphatemp = 0; |
|
|
|
} |
|
|
|
} |
|
|
|