|
|
|
import 'package:dio/dio.dart';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/gestures.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
import 'package:flutter_swiper/flutter_swiper.dart';
|
|
|
|
import 'package:huixiang/generated/l10n.dart';
|
|
|
|
import 'package:huixiang/retrofit/data/activity.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/store_info.dart';
|
|
|
|
import 'package:huixiang/retrofit/data/user_entity.dart';
|
|
|
|
import 'package:huixiang/retrofit/min_api.dart';
|
|
|
|
import 'package:huixiang/retrofit/retrofit_api.dart';
|
|
|
|
import 'package:huixiang/store/store_view/store_activity.dart';
|
|
|
|
import 'package:huixiang/store/store_view/store_info.dart';
|
|
|
|
import 'package:huixiang/store/store_view/store_order_list.dart';
|
|
|
|
import 'package:huixiang/union/union_view/union_coupon.dart';
|
|
|
|
import 'package:huixiang/union/union_view/vip.dart';
|
|
|
|
import 'package:huixiang/utils/font_weight.dart';
|
|
|
|
import 'package:huixiang/view_widget/classic_header.dart';
|
|
|
|
import 'package:huixiang/view_widget/custom_image.dart';
|
|
|
|
import 'package:huixiang/view_widget/my_tab.dart';
|
|
|
|
import 'package:huixiang/view_widget/round_button.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;
|
|
|
|
MinApiService minService;
|
|
|
|
StoreInfo storeInfo;
|
|
|
|
List<Activity> activitys;
|
|
|
|
RefreshController refreshController;
|
|
|
|
List<Widget> _widgetOptions;
|
|
|
|
|
|
|
|
ScrollController controller = ScrollController();
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
|
|
|
|
if (tabcontroller == null)
|
|
|
|
tabcontroller = TabController(
|
|
|
|
length: 2,
|
|
|
|
vsync: this,
|
|
|
|
);
|
|
|
|
|
|
|
|
_widgetOptions = [
|
|
|
|
StoreOrderListPage(
|
|
|
|
widget.arguments,
|
|
|
|
activitys,
|
|
|
|
storeInfo,
|
|
|
|
controller,
|
|
|
|
),
|
|
|
|
|
|
|
|
///星店活动,
|
|
|
|
StoreActivity(
|
|
|
|
widget.arguments,
|
|
|
|
activitys,
|
|
|
|
),
|
|
|
|
];
|
|
|
|
|
|
|
|
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);
|
|
|
|
activitys = storeInfo.informationVOPageVO.list
|
|
|
|
.map((e) => Activity.fromJson(e))
|
|
|
|
.toList();
|
|
|
|
if (mounted) {
|
|
|
|
setState(() {});
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
refreshController.refreshFailed();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Stack(
|
|
|
|
children: [
|
|
|
|
Positioned(
|
|
|
|
left: 0,
|
|
|
|
right: 0,
|
|
|
|
top: 0,
|
|
|
|
bottom: 54.h,
|
|
|
|
child: DefaultTabController(
|
|
|
|
length: 2,
|
|
|
|
child: SmartRefresher(
|
|
|
|
controller: refreshController =
|
|
|
|
RefreshController(initialRefresh: false),
|
|
|
|
enablePullDown: true,
|
|
|
|
enablePullUp: false,
|
|
|
|
header: MyHeader(),
|
|
|
|
physics: BouncingScrollPhysics(),
|
|
|
|
onRefresh: () {
|
|
|
|
queryStoreInfo();
|
|
|
|
},
|
|
|
|
child: NestedScrollView(
|
|
|
|
controller: controller,
|
|
|
|
dragStartBehavior: DragStartBehavior.start,
|
|
|
|
headerSliverBuilder:
|
|
|
|
(BuildContext context, bool innerBoxIsScrolled) {
|
|
|
|
return [
|
|
|
|
SliverOverlapAbsorber(
|
|
|
|
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(
|
|
|
|
context),
|
|
|
|
sliver: SliverAppBar(
|
|
|
|
expandedHeight: (storeInfo != null &&
|
|
|
|
storeInfo.couponVOList != null)
|
|
|
|
? 425.h
|
|
|
|
: 365.h,
|
|
|
|
floating: false,
|
|
|
|
snap: false,
|
|
|
|
pinned: true,
|
|
|
|
stretch: false,
|
|
|
|
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(
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
// Image.asset(
|
|
|
|
// "assets/image/share_image_bg.png",
|
|
|
|
// fit: BoxFit.cover,
|
|
|
|
// width: MediaQuery.of(context).size.width,
|
|
|
|
// height: 180.h,
|
|
|
|
// ),
|
|
|
|
buildSwiper(),
|
|
|
|
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,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
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.current.diancan),
|
|
|
|
MyTab(text: S.current.xindianhuodong),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
];
|
|
|
|
},
|
|
|
|
body: TabBarView(
|
|
|
|
physics: BouncingScrollPhysics(),
|
|
|
|
children: _widgetOptions,
|
|
|
|
controller: tabcontroller,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Positioned(
|
|
|
|
bottom: 0,
|
|
|
|
left: 0,
|
|
|
|
right: 0,
|
|
|
|
child: Stack(
|
|
|
|
alignment: Alignment.bottomLeft,
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
height: 54.h,
|
|
|
|
color: Color(0xFFFAFAFA),
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
Spacer(),
|
|
|
|
Text(
|
|
|
|
S.of(context).heji,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12.sp,
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
color: Colors.black,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
"¥19.00",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 20.sp,
|
|
|
|
fontWeight: MyFontWeight.medium,
|
|
|
|
color: Color(0xFF32A060),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Spacer(),
|
|
|
|
GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
Navigator.of(context).pushNamed(
|
|
|
|
'/router/settlement',
|
|
|
|
arguments: {},
|
|
|
|
);
|
|
|
|
},
|
|
|
|
child: RoundButton(
|
|
|
|
width: 103.w,
|
|
|
|
height: 54.h,
|
|
|
|
text: S.current.jiesuan,
|
|
|
|
textColor: Colors.white,
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
backgroup: Color(0xFF32A060),
|
|
|
|
radius: 0,
|
|
|
|
fontSize: 16.sp,
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 5.h),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Stack(
|
|
|
|
children: [
|
|
|
|
InkWell(
|
|
|
|
onTap: () {
|
|
|
|
setState(() {
|
|
|
|
showShoppingCart();
|
|
|
|
});
|
|
|
|
},
|
|
|
|
child: Image.asset(
|
|
|
|
"assets/image/shopp.png",
|
|
|
|
width: 88,
|
|
|
|
height: 88,
|
|
|
|
fit: BoxFit.fitWidth,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Positioned(
|
|
|
|
right: 15,
|
|
|
|
top: 14,
|
|
|
|
child: RoundButton(
|
|
|
|
width: 17,
|
|
|
|
height: 17,
|
|
|
|
text: "1",
|
|
|
|
textColor: Colors.white,
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
backgroup: Color(0xFF32A060),
|
|
|
|
fontSize: 12.sp,
|
|
|
|
radius: 100,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
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(
|
|
|
|
child: MImage(
|
|
|
|
(storeInfo != null &&
|
|
|
|
storeInfo.bannerList != null &&
|
|
|
|
position < storeInfo.bannerList.length)
|
|
|
|
? storeInfo.bannerList[position].imgUrl
|
|
|
|
: "",
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
radius: BorderRadius.zero,
|
|
|
|
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() {
|
|
|
|
showModalBottomSheet(
|
|
|
|
context: context,
|
|
|
|
backgroundColor: Colors.transparent,
|
|
|
|
builder: (context) {
|
|
|
|
return StatefulBuilder(builder: (context1, state) {
|
|
|
|
return Container(
|
|
|
|
alignment: Alignment.topCenter,
|
|
|
|
width: double.infinity,
|
|
|
|
height: MediaQuery.of(context).size.height / 2,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Colors.white,
|
|
|
|
borderRadius: BorderRadius.only(
|
|
|
|
topLeft: Radius.circular(8),
|
|
|
|
topRight: Radius.circular(8),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
top: 16,
|
|
|
|
left: 16,
|
|
|
|
right: 16,
|
|
|
|
bottom: 8,
|
|
|
|
),
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
"已选商品",
|
|
|
|
style: TextStyle(
|
|
|
|
color: Colors.black,
|
|
|
|
fontSize: 14.sp,
|
|
|
|
fontWeight: MyFontWeight.medium,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
InkWell(
|
|
|
|
onTap: () {},
|
|
|
|
child: Image.asset(
|
|
|
|
"assets/image/delete.png",
|
|
|
|
width: 22,
|
|
|
|
height: 22,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
child: Container(
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
top: 8,
|
|
|
|
left: 16,
|
|
|
|
right: 16,
|
|
|
|
),
|
|
|
|
child: ListView.builder(
|
|
|
|
itemCount: productLists == null ? 0 : productLists.length,
|
|
|
|
physics: BouncingScrollPhysics(),
|
|
|
|
itemBuilder: (context, position) {
|
|
|
|
// return shoppGoodsItem();
|
|
|
|
return GestureDetector(
|
|
|
|
onTap: () {},
|
|
|
|
child: shoppGoodsItem(productLists[position], position),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Stack(
|
|
|
|
alignment: Alignment.bottomLeft,
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
height: 54.h,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Color(0xFFFAFAFA),
|
|
|
|
boxShadow: [
|
|
|
|
BoxShadow(
|
|
|
|
color: Colors.black.withAlpha(8),
|
|
|
|
offset: Offset(0, -1),
|
|
|
|
blurRadius: 3,
|
|
|
|
spreadRadius: 0,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
Spacer(),
|
|
|
|
Text(
|
|
|
|
S.of(context).heji,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12.sp,
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
color: Colors.black,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
"¥19.00",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 20.sp,
|
|
|
|
fontWeight: MyFontWeight.medium,
|
|
|
|
color: Color(0xFF32A060),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Spacer(),
|
|
|
|
RoundButton(
|
|
|
|
width: 103.w,
|
|
|
|
height: 54.h,
|
|
|
|
text: S.current.jiesuan,
|
|
|
|
textColor: Colors.white,
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
backgroup: Color(0xFF32A060),
|
|
|
|
radius: 0,
|
|
|
|
fontSize: 16.sp,
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 5.h),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Stack(
|
|
|
|
children: [
|
|
|
|
InkWell(
|
|
|
|
onTap: () {
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
},
|
|
|
|
child: Image.asset(
|
|
|
|
"assets/image/shopp.png",
|
|
|
|
width: 88,
|
|
|
|
height: 88,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Positioned(
|
|
|
|
right: 15,
|
|
|
|
top: 14,
|
|
|
|
child: RoundButton(
|
|
|
|
width: 17,
|
|
|
|
height: 17,
|
|
|
|
text: "1",
|
|
|
|
textColor: Colors.white,
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
backgroup: Color(0xFF32A060),
|
|
|
|
fontSize: 12.sp,
|
|
|
|
radius: 100,
|
|
|
|
callback: () {
|
|
|
|
Navigator.of(context)
|
|
|
|
.pushNamed('/router/test_page');
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget shoppGoodsItem(ProductList pro, position) {
|
|
|
|
return Container(
|
|
|
|
padding: EdgeInsets.only(bottom: 10),
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
Image.asset(
|
|
|
|
"assets/image/default_1.png",
|
|
|
|
width: 60,
|
|
|
|
height: 60,
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
),
|
|
|
|
SizedBox(width: 10),
|
|
|
|
Expanded(
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
"手工啵啵奶茶",
|
|
|
|
style: TextStyle(
|
|
|
|
color: Colors.black,
|
|
|
|
fontSize: 12.sp,
|
|
|
|
fontWeight: MyFontWeight.medium,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(height: 2),
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
"无香精",
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color(0xFF4C4C4C),
|
|
|
|
fontSize: 11.sp,
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(width: 10),
|
|
|
|
Text(
|
|
|
|
"无香精",
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color(0xFF4C4C4C),
|
|
|
|
fontSize: 11.sp,
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
SizedBox(height: 6),
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
"会员价",
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color(0xFFFF7A1A),
|
|
|
|
fontSize: 13.sp,
|
|
|
|
fontWeight: MyFontWeight.medium,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
"¥19.00",
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color(0xFFFF7A1A),
|
|
|
|
fontSize: 14.sp,
|
|
|
|
fontWeight: MyFontWeight.medium,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Spacer(),
|
|
|
|
InkWell(
|
|
|
|
onTap: () {},
|
|
|
|
child: Image.asset(
|
|
|
|
"assets/image/reduce.png",
|
|
|
|
width: 22,
|
|
|
|
height: 22,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(left: 8, right: 8),
|
|
|
|
child: Text(
|
|
|
|
"1",
|
|
|
|
style: TextStyle(
|
|
|
|
color: Colors.black,
|
|
|
|
fontSize: 14.sp,
|
|
|
|
fontWeight: MyFontWeight.medium,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
InkWell(
|
|
|
|
onTap: () {},
|
|
|
|
child: Image.asset(
|
|
|
|
"assets/image/add.png",
|
|
|
|
width: 22,
|
|
|
|
height: 22,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
flex: 1,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
bool get wantKeepAlive => true;
|
|
|
|
}
|
|
|
|
|
|
|
|
class Title extends StatefulWidget {
|
|
|
|
final ScrollController controller;
|
|
|
|
final String title;
|
|
|
|
|
|
|
|
Title(this.controller, this.title);
|
|
|
|
|
|
|
|
@override
|
|
|
|
State<StatefulWidget> createState() {
|
|
|
|
return _Title();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class _Title extends State<Title> {
|
|
|
|
double alpha = 0;
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
|
|
|
|
widget.controller.addListener(() {
|
|
|
|
double maxScrollExtent = widget.controller.position.maxScrollExtent;
|
|
|
|
double alphaHeight = (kToolbarHeight) / 2;
|
|
|
|
double alphaProgress = maxScrollExtent - widget.controller.offset;
|
|
|
|
double alphatemp = 0;
|
|
|
|
if (alphaProgress <= 1) {
|
|
|
|
alphatemp = 1;
|
|
|
|
} else if (alphaProgress <= alphaHeight) {
|
|
|
|
alphatemp =
|
|
|
|
(((alphaHeight - alphaProgress) / alphaHeight) > 0.5) ? 1 : 0;
|
|
|
|
} else {
|
|
|
|
alphatemp = 0;
|
|
|
|
}
|
|
|
|
if (alpha != alphatemp && mounted) {
|
|
|
|
alpha = alphatemp;
|
|
|
|
print("object: $alpha");
|
|
|
|
setState(() {});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Container(
|
|
|
|
margin: EdgeInsets.only(bottom: 38),
|
|
|
|
child: Text(
|
|
|
|
widget.title ?? "",
|
|
|
|
style: TextStyle(
|
|
|
|
color: Colors.black.withOpacity(alpha),
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
fontSize: 18.sp,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|