diff --git a/lib/store/store_order.dart b/lib/store/store_order.dart index f6e8d733..9585219d 100644 --- a/lib/store/store_order.dart +++ b/lib/store/store_order.dart @@ -1,21 +1,30 @@ import 'package:dio/dio.dart'; +import 'package:flutter/cupertino.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/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/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; + final List activitys; + final StoreInfo storeInfo; - StoreOrderPage({this.arguments}); + StoreOrderPage({this.arguments, this.activitys, this.storeInfo}); @override State createState() { @@ -23,19 +32,32 @@ class StoreOrderPage extends StatefulWidget { } } +class testModel{ + String name; + bool isSelected; + testModel(String name){ + this.name = name; + this.isSelected = false; + } +} + class _StoreOrderPage extends State - with TickerProviderStateMixin/*, AutomaticKeepAliveClientMixin */{ + with TickerProviderStateMixin /*, AutomaticKeepAliveClientMixin */ { TabController tabcontroller; ApiService apiService; StoreInfo storeInfo; RefreshController refreshController; + List temperatureStoreList = [testModel("正常冰"),testModel("少冰"),testModel("多冰"),testModel("去冰")]; + List sweetnessStoreList = [testModel("正常糖"),testModel("5分糖")]; + int isSelected = 0; + int isChoice =0; + int tempClickIndex = 0; @override void initState() { super.initState(); queryStoreInfo(); - } queryStoreInfo() async { @@ -64,7 +86,7 @@ class _StoreOrderPage extends State @override Widget build(BuildContext context) { - return Column( + return Stack( children: [ Expanded( child: DefaultTabController( @@ -88,14 +110,19 @@ class _StoreOrderPage extends State context), sliver: SliverAppBar( title: Text( - "百年川椒", + widget.storeInfo != null + ? widget.storeInfo.storeName + : "", style: TextStyle( color: Colors.black, fontWeight: FontWeight.bold, fontSize: 18.sp, ), ), - expandedHeight: (storeInfo != null && storeInfo.couponVOList != null) ? 425.h : 365.h, + expandedHeight: (storeInfo != null && + storeInfo.couponVOList != null) + ? 425.h + : 365.h, floating: false, snap: false, leading: GestureDetector( @@ -147,10 +174,11 @@ class _StoreOrderPage extends State StoreInfoView(), ///门店对应优惠券 - if (storeInfo != null && storeInfo.couponVOList != null) + if (storeInfo != null && + storeInfo.couponVOList != null) UnionCoupon( storeInfo, - (a) {}, + (a) {}, coupon: true, ), @@ -188,7 +216,8 @@ class _StoreOrderPage extends State isScrollable: true, indicatorWeight: 1, indicatorColor: Color(0xFFFAFAFA), - labelPadding: EdgeInsets.only(left: 8.w, right: 8.w), + labelPadding: + EdgeInsets.only(left: 8.w, right: 8.w), indicatorSize: TabBarIndicatorSize.label, unselectedLabelStyle: TextStyle( fontSize: 15.sp, @@ -201,8 +230,8 @@ class _StoreOrderPage extends State ), labelColor: Colors.black, tabs: [ - MyTab(text: "点单"), - MyTab(text: "星店活动"), + MyTab(text: S.current.diancan), + MyTab(text: S.current.xindianhuodong), ], ), ), @@ -218,11 +247,20 @@ class _StoreOrderPage extends State color: Colors.white, width: MediaQuery.of(context).size.width, height: MediaQuery.of(context).size.width, + child: order(), ), Container( - color: Colors.white, + color: Colors.black, width: MediaQuery.of(context).size.width, height: MediaQuery.of(context).size.width, + child: Text( + S.of(context).xindianhuodong, + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.semi_bold, + color: Colors.black, + ), + ), ) ], controller: tabcontroller, @@ -231,14 +269,999 @@ class _StoreOrderPage extends State ), ), ), - Container( - height: 50.h, - color: Colors.blue, - ), + 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), + 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, + ), + ), + 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, + // padding: EdgeInsets.symmetric(vertical: 5.h), + ), + ) + ], + ), + + ], + ), + ) ], ); } - // @override - // bool get wantKeepAlive => true; + Widget starGoodsItem() { + return Container( + child: Text( + S.of(context).xindianhuodong, + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.semi_bold, + color: Colors.black, + ), + ), + ); + return Container( + child: Swiper( + viewportFraction: 0.95, + loop: false, + itemBuilder: (context, position) { + return InkWell( + onTap: () { + if (widget.arguments["source"] != null && + widget.arguments["source"] == widget.activitys[position].id) { + Navigator.of(context).pop(); + } else { + Navigator.of(context).pushNamed('/router/web_page', arguments: { + "activityId": widget.activitys[position].id, + "source": widget.arguments["id"] + }); + } + }, + child: Container( + margin: EdgeInsets.symmetric(horizontal: 5.w), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8), + boxShadow: [ + BoxShadow( + color: Color(0x0D000000), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ) + ], + ), + child: Stack( + children: [ + Container( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: [ + MImage( + (widget.activitys != null && + widget.activitys.length > position) + ? widget.activitys[position].coverImg + : "", + aspectRatio: 2.2, + radius: BorderRadius.vertical( + top: Radius.circular(8), + ), + fit: BoxFit.cover, + errorSrc: "assets/image/default_2_1.png", + fadeSrc: "assets/image/default_2_1.png", + ), + Container( + padding: EdgeInsets.all(8), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + (widget.activitys != null && + widget.activitys.length > position) + ? widget.activitys[position].storeName + : "", + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF000000), + ), + ), + SizedBox( + height: 4.h, + ), + Text( + (widget.activitys != null && + widget.activitys.length > position) + ? widget.activitys[position].mainTitle + : "", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF727272), + ), + ), + ], + ), + ), + ], + ), + ), + Positioned( + top: 0, + right: 0, + child: Container( + padding: EdgeInsets.symmetric( + vertical: 4.h, + horizontal: 8.w, + ), + decoration: BoxDecoration( + color: Colors.black.withAlpha(76), + borderRadius: BorderRadius.only( + bottomLeft: Radius.circular(8), + topRight: Radius.circular(8), + ), + ), + child: Text( + (widget.activitys != null && + widget.activitys.length > position) + ? widget.activitys[position].startTime.split(" ")[0] + : "", + style: TextStyle( + fontWeight: MyFontWeight.semi_bold, + fontSize: 12.sp, + color: Color(0xD9FFFFFF), + ), + ), + ), + ), + ], + ), + ), + ); + }, + itemCount: (widget.activitys != null && widget.activitys.length > 0) + ? widget.activitys.length + : 0, + ), + ); + } + + Widget order() { + return Container( + width: double.infinity, + child: Row( + children: [ + Container( + // decoration: BoxDecoration( + // color: Color(0xFFFAFAFA), + // boxShadow: [ + // BoxShadow( + // color: Color(0x0D000000), + // offset: Offset(0, 3), + // blurRadius: 14, + // spreadRadius: 0, + // ) + // ], + // ), + width: 104.w, + // height: 300.h, + child: ListView.builder( + itemCount: 15, + shrinkWrap: true, + // physics: NeverScrollableScrollPhysics(), + itemBuilder: (context, position) { + return orderItem(position); + }), + ), + Expanded( + flex: 1, + child: Container( + child: ListView.builder( + itemCount: 15, + shrinkWrap: true, + // physics: NeverScrollableScrollPhysics(), + itemBuilder: (context, position) { + return goodsItem(); + }), + )), + ], + ), + ); + } + + Widget orderItem(int index) { + return Container( + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + GestureDetector( + onTap: () { + setState(() { + isSelected = index; + }); + }, + child: Container( + color: isSelected != index ? Color(0xFFFAFAFA) : Colors.white, + child: Padding( + padding: + EdgeInsets.only(left: 16, right: 28, top: 12, bottom: 16), + child: Row( + children: [ + Container( + color: isSelected != index + ? Color(0xFFFAFAFA) + : Color(0xFF32A060), + width: 2.w, + height: 17.h, + ), + SizedBox( + width: 10.w, + ), + Text( + "人气推荐", + textAlign: TextAlign.center, + style: TextStyle( + color: isSelected != index + ? Color(0xFF202020) + : Color(0xFF000000), + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + ), + ), + ], + ), + ), + ), + ), + ], + ), + ); + } + + Widget goodsItem() { + return Container( + color: Colors.white, + padding: EdgeInsets.only(right: 16.w, bottom: 10, top: 10), + child: Row( + // mainAxisAlignment: MainAxisAlignment.spaceAround, + // crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox(width: 12.w), + MImage( + "assets/image/default_1.png", + width: 70, + height: 70, + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", + ), + SizedBox(width: 10), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "手工啵啵奶茶", + style: TextStyle( + color: Colors.black, + fontSize: 13.sp, + fontWeight: MyFontWeight.medium, + ), + ), + SizedBox(height: 2), + Row( + children: [ + Text( + "无香精", + style: TextStyle( + color: Color(0xFF4C4C4C), + fontSize: 10.sp, + fontWeight: MyFontWeight.regular, + ), + ), + SizedBox(width: 10), + Text( + "无香精", + style: TextStyle( + color: Color(0xFF4C4C4C), + fontSize: 10.sp, + fontWeight: MyFontWeight.regular, + ), + ) + ], + ), + SizedBox(height: 7), + Row( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Text( + "会员价", + style: TextStyle( + color: Color(0xFFFF7A1A), + fontSize: 10.sp, + fontWeight: MyFontWeight.medium, + ), + ), + Text( + "¥19.00", + style: TextStyle( + color: Color(0xFFFF7A1A), + fontSize: 11.sp, + fontWeight: MyFontWeight.medium, + ), + ) + ], + ), + Row( + children: [ + Text( + "原价", + style: TextStyle( + color: Color(0xFFA29E9E), + fontSize: 9.sp, + fontWeight: MyFontWeight.regular, + ), + ), + SizedBox(width: 10), + Text( + "¥19.00", + style: TextStyle( + color: Color(0xFFA29E9E), + fontSize: 10.sp, + fontWeight: MyFontWeight.regular, + ), + ) + ], + ), + ], + ), + Spacer(), + true + ? GestureDetector( + onTap: () { + setState(() { + showStoreSelector(); + }); + }, + child: RoundButton( + width: 49.w, + text: "选规格", + textColor: Colors.white, + fontWeight: MyFontWeight.medium, + radius: 11, + backgroup: Color(0xFF32A060), + fontSize: 11.sp, + padding: EdgeInsets.symmetric(vertical: 5.h), + ), + ) + : InkWell( + onTap: () {}, + child: Image.asset( + "assets/image/reduce.png", + width: 22, + height: 22, + ), + ), + if (false) + Padding( + padding: EdgeInsets.only(left: 8, right: 8), + child: Text( + "1", + style: TextStyle( + color: Colors.black, + fontSize: 14.sp, + fontWeight: MyFontWeight.medium, + ), + ), + ), + if (false) + InkWell( + onTap: () {}, + child: Image.asset( + "assets/image/add.png", + width: 22, + height: 22, + ), + ), + ], + ), + ], + ), + ) + ], + ), + ); + } + + ///选规格弹窗 + showStoreSelector() { + showModalBottomSheet( + context: context, + backgroundColor: Colors.transparent, + builder: (context) { + return StatefulBuilder( + builder:(context1, state) { + return Container( + alignment: Alignment.topCenter, + padding: EdgeInsets.only(top: 16, left: 16, right: 16), + width: double.infinity, + decoration: BoxDecoration( + color: Color(0xFFFAFAFA), + borderRadius: BorderRadius.only( + topLeft: Radius.circular(8), topRight: Radius.circular(8)), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + MImage( + "", + width: 70, + height: 70, + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", + ), + SizedBox(width: 10), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "手工啵啵奶茶", + style: TextStyle( + color: Colors.black, + fontSize: 16.sp, + fontWeight: MyFontWeight.medium, + ), + ), + Padding( + padding: EdgeInsets.only(top: 4, bottom: 7), + child: Text( + "已选:正常冰", + style: TextStyle( + color: Color(0xFF727272), + fontSize: 11.sp, + fontWeight: MyFontWeight.regular, + ), + ), + ), + 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: () { + Navigator.of(context).pop(); + }, + child: Image.asset( + "assets/image/cancel.png", + width: 22, + height: 22, + ), + ), + ], + ), + SizedBox( + height: 23, + ), + Text( + "温度", + style: TextStyle( + color: Colors.black, + fontSize: 14.sp, + fontWeight: MyFontWeight.regular, + ), + ), + SizedBox( + height: 15, + ), + sweetnessStore((){state((){ + for(var i = 0;i < temperatureStoreList.length;i++){ + if(tempClickIndex == i) + temperatureStoreList[i].isSelected = true; + else temperatureStoreList[i].isSelected = false; + } + });},temperatureStoreList), + SizedBox( + height: 24, + ), + Text( + "甜度", + style: TextStyle( + color: Colors.black, + fontSize: 14.sp, + fontWeight: MyFontWeight.regular, + ), + ), + SizedBox( + height: 15, + ), + sweetnessStore((){state((){ + for(var i = 0;i < sweetnessStoreList.length;i++){ + if(tempClickIndex == i) + sweetnessStoreList[i].isSelected = true; + else sweetnessStoreList[i].isSelected = false; + } + });},sweetnessStoreList), + SizedBox( + height: 24, + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded(child: Text( + "数量", + style: TextStyle( + color: Colors.black, + fontSize: 14.sp, + fontWeight: MyFontWeight.regular, + ), + )) + , + 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, + ), + ), + ], + ), + SizedBox( + height: 24, + ), + RoundButton( + width:double.infinity, + height: 54.h, + text: "加入购物车", + textColor: Colors.white, + fontWeight: MyFontWeight.semi_bold, + radius:27, + backgroup: Color(0xFF32A060), + fontSize: 16.sp, + // padding: EdgeInsets.symmetric(vertical: 5.h), + ), + ], + ), + );}); + }, + ); + } + + Widget sweetnessStore(Function fc,List arrays) { + return GridView.builder( + itemCount:arrays.length, + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + //一行的Widget数量 + crossAxisCount: 4, + //水平子Widget之间间距 + crossAxisSpacing: 6.w, + //垂直子Widget之间间距 + mainAxisSpacing: 12.w, + //垂直单个子Widget之间间距 + childAspectRatio: 3 / 1), + itemBuilder: (contetx, index) { + return GestureDetector( + onTap: (){ + tempClickIndex = index; + fc(); + }, + child: sweetnessItem(arrays[index].name,arrays[index].isSelected), + ); + }, + ); + } + + Widget sweetnessItem(String name,bool isCheck) { + return Container( + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + RoundButton( + width: 68.w, + height: 29.h, + text: name, + textColor: !isCheck ?Color(0xFF727272):Colors.white, + fontWeight: MyFontWeight.regular, + radius: 4, + backgroup:!isCheck ? Color(0xFFE5E5E5):Color(0xFF32A060), + fontSize: 12.sp, + ), + ], + ), + ); + } + + ///购物车弹窗 + showShoppingCart() { + showModalBottomSheet( + context: context, + backgroundColor: Colors.transparent, + builder: (context) { + return StatefulBuilder( + builder:(context1, state) { + return Container( + alignment: Alignment.topCenter, + width: double.infinity, + decoration: BoxDecoration( + color: Color(0xFFFAFAFA), + borderRadius: BorderRadius.only( + topLeft: Radius.circular(8), topRight: Radius.circular(8)), + ), + child: Stack( + children: [ + Container( + padding: EdgeInsets.only(top: 16, left: 16, right: 16), + child:Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + 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, + ), + ), + ], + ), + SizedBox(height: 24.h), + Expanded(child: + Container( + child: ListView.builder( + itemCount: 10, + shrinkWrap: true, + // physics:NeverScrollableScrollPhysics(), + itemBuilder: (context, position) { + return shoppGoodsItem(); + }), + ),) + ], + ), + ), + Positioned( + bottom: 0, + left: 0, + right: 0, + child: Stack( + alignment: Alignment.bottomLeft, + children: [ + Container( + height: 54.h, + color: Color(0xFFFAFAFA), + child: Row( + // mainAxisAlignment: MainAxisAlignment.end, + // crossAxisAlignment: CrossAxisAlignment.end, + 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), + fontSize: 16.sp, + padding: EdgeInsets.symmetric(vertical: 5.h), + ) + ], + ), + ), + Stack( + children: [ + InkWell( + onTap: () { + setState(() { + 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, + // padding: EdgeInsets.symmetric(vertical: 5.h), + ), + ) + ], + ), + + ], + ), + ) + ], + ), + );}); + }, + ); + } + + Widget shoppGoodsItem() { + return Container( + padding: EdgeInsets.only(bottom: 10), + child: Row( + children: [ + MImage( + "assets/image/default_1.png", + width: 60, + height:60, + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", + ), + 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, + ), + ), + ], + ), + ], + ), + ) + ], + ), + ); + } + + +// @override +// bool get wantKeepAlive => true; } diff --git a/lib/union/union_details_page.dart b/lib/union/union_details_page.dart index c5727101..9846ed31 100644 --- a/lib/union/union_details_page.dart +++ b/lib/union/union_details_page.dart @@ -21,7 +21,6 @@ import 'package:huixiang/union/union_view/vip.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/min.dart'; import 'package:huixiang/view_widget/classic_header.dart'; -import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/receive_success.dart'; import 'package:path_provider/path_provider.dart'; @@ -45,8 +44,6 @@ class _UnionDetailsPage extends State { @override void dispose() { - SmartDialog.dismiss(); - EasyLoading.dismiss(); super.dispose(); refreshController.dispose(); } @@ -83,105 +80,73 @@ class _UnionDetailsPage extends State { future: queryStoreInfo(), builder: (context, snapshot) { return Scaffold( - // appBar: MyAppBar( - // background: Color(0xFFF7F7F7), - // // title: storeInfo == null - // // ? (widget.arguments["storeName"] ?? "") - // // : storeInfo.storeName, - // title: "", - // titleColor: Colors.black87, - // titleSize: 18.sp, - // leadingColor: Colors.black, - // ), - body: - Stack( - children: [ - MImage( - storeInfo != null && storeInfo.bannerList != null? - storeInfo.bannerList.first.imgUrl:"", - width: double.infinity, - height: 190.h, - fit: BoxFit.cover, - errorSrc: "assets/image/default_1.png", - fadeSrc: "assets/image/default_1.png", - ), - Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox(height:54.h,), - Padding(padding:EdgeInsets.only(left: 17.w), - child: GestureDetector( - onTap: () { - Navigator.of(context).pop(); - }, - child:Icon( - Icons.arrow_back_ios, - color: Colors.black, - size: 24, - ) - ),), - SizedBox(height:29.h,), - Expanded( - child: SmartRefresher( - controller: refreshController, - enablePullDown: true, - enablePullUp: false, - header: MyHeader(), - physics: BouncingScrollPhysics(), - onRefresh: () { - setState(() {}); - }, - child: SingleChildScrollView( - physics: NeverScrollableScrollPhysics(), - child: Column( - children: [ - ///门店信息 - StoreInfos(storeInfo), - - ///门店对应优惠券 - UnionCoupon(storeInfo, _receiveCoupon), + appBar: MyAppBar( + background: Color(0xFFF7F7F7), + title: storeInfo == null + ? (widget.arguments["storeName"] ?? "") + : storeInfo.storeName, + titleColor: Colors.black87, + titleSize: 18.sp, + leadingColor: Colors.black, + ), + body: Column( + children: [ + Expanded( + child: SmartRefresher( + controller: refreshController, + enablePullDown: true, + enablePullUp: false, + header: MyHeader(), + physics: BouncingScrollPhysics(), + onRefresh: () { + setState(() {}); + }, + child: SingleChildScrollView( + physics: NeverScrollableScrollPhysics(), + child: Column( + children: [ + ///门店信息 + StoreInfos(storeInfo), - ///门店对应VIP信息 - Vip(storeInfo, _receiveVip, isReceive), + ///门店对应VIP信息 + Vip(storeInfo, _receiveVip, isReceive), - /// 门店对应的活动 - StoreActivity(widget.arguments, activitys), + ///门店对应优惠券 + UnionCoupon(storeInfo, _receiveCoupon), - ], - ), - ), - ), - // flex: 1, - ), - // InkWell( - // onTap: _loginMin, - // child: Container( - // padding: EdgeInsets.only(top: 16.h, bottom: 16.h), - // decoration: BoxDecoration( - // color: isEnable() ? Color(0xFF32A060) : Color(0xFFD8D8D8), - // borderRadius: BorderRadius.vertical( - // top: Radius.circular(4), - // ), - // ), - // alignment: Alignment.center, - // child: Text( - // isEnable() - // ? S.of(context).jinrushangdian - // : S.of(context).zanwuxianshangjindian, - // style: TextStyle( - // fontSize: 16.sp, - // color: isEnable() ? Colors.white : Color(0xFFA0A0A0), - // fontWeight: MyFontWeight.semi_bold, - // ), - // ), - // ), - // ), - ], + /// 门店对应的活动 + StoreActivity(widget.arguments, activitys), + ], + ), ), - ], + ), + flex: 1, ), - + InkWell( + onTap: _loginMin, + child: Container( + padding: EdgeInsets.only(top: 16.h, bottom: 16.h), + decoration: BoxDecoration( + color: isEnable() ? Color(0xFF32A060) : Color(0xFFD8D8D8), + borderRadius: BorderRadius.vertical( + top: Radius.circular(4), + ), + ), + alignment: Alignment.center, + child: Text( + isEnable() + ? S.of(context).jinrushangdian + : S.of(context).zanwuxianshangjindian, + style: TextStyle( + fontSize: 16.sp, + color: isEnable() ? Colors.white : Color(0xFFA0A0A0), + fontWeight: MyFontWeight.semi_bold, + ), + ), + ), + ), + ], + ), ); }, ); @@ -339,7 +304,7 @@ class _UnionDetailsPage extends State { } else { print("print 下载失败"); } - Future.delayed(Duration(seconds: 1), (){ + Future.delayed(Duration(seconds: 1), () { EasyLoading.dismiss(); }); } diff --git a/lib/union/union_view/store_activity.dart b/lib/union/union_view/store_activity.dart index 6241cfb2..147431ad 100644 --- a/lib/union/union_view/store_activity.dart +++ b/lib/union/union_view/store_activity.dart @@ -5,6 +5,7 @@ import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/retrofit/data/activity.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/custom_image.dart'; +import 'package:huixiang/view_widget/item_title.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:huixiang/view_widget/round_button.dart'; @@ -23,51 +24,17 @@ class StoreActivity extends StatefulWidget { } class _StoreActivity extends State { - int page = 0; - int isSelected =0; - @override Widget build(BuildContext context) { return Column( children: [ Container( - alignment:Alignment.centerLeft, - margin: EdgeInsets.only(top: 20.h, bottom: 20.h,left: 17.w), - child: Row( - children: [ - GestureDetector( - onTap: (){setState(() { - page = 0; - });}, - child: Text( - S.of(context).diandan, - textAlign: TextAlign.center, - style: TextStyle( - color: page==0?Colors.black:Colors.grey, - fontSize: page==0?16.sp:14.sp, - fontWeight: page==0?FontWeight.bold:FontWeight.normal, - ), - ), - ), - Padding(padding: EdgeInsets.only(left: 10)), - GestureDetector( - onTap: (){setState(() { - page = 1; - });}, - child: Text( - S.of(context).xindianhuodong, - textAlign: TextAlign.center, - style: TextStyle( - color: page==1?Colors.black:Colors.grey, - fontSize: page==1?16.sp:14.sp, - fontWeight: page==1?FontWeight.bold:FontWeight.normal, - ), - ), - ), - ], + margin: EdgeInsets.only(top: 20.h, bottom: 20.h), + child: ItemTitle( + text: S.of(context).xindianhuodong, + imgPath: "assets/image/icon_union_start_store.png", ), ), - page == 0 ? order(): (widget.activitys != null && widget.activitys.length > 0) ? Container( margin: EdgeInsets.only(bottom: 30.h), @@ -94,45 +61,6 @@ class _StoreActivity extends State { ); } - Widget order(){ - return Container( - width: double.infinity, - child: Row( - children: [ - Container( - // decoration: BoxDecoration( - // color: Color(0xFFFAFAFA), - // boxShadow: [ - // BoxShadow( - // color: Color(0x0D000000), - // offset: Offset(0, 3), - // blurRadius: 14, - // spreadRadius: 0, - // ) - // ], - // ), - width: 104.w, - child:ListView.builder( - itemCount:5, - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - itemBuilder: (context, position) { - return orderItem(position); - }), - ), - Expanded(flex:1,child:Container( - child:ListView.builder( - itemCount:5, - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - itemBuilder: (context, position) { - return goodsItem(); - }), - )), - - ],), - ); - } Widget buildSwiper2Bottom() { return Container( @@ -263,195 +191,4 @@ class _StoreActivity extends State { } - Widget orderItem(int index) { - return Container( - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - GestureDetector( - onTap: (){setState(() { - isSelected = index; - });}, - child: Container( - color: isSelected != index ?Color(0xFFFAFAFA):Colors.white, - child: Padding(padding: EdgeInsets.only(left: 16,right: 28,top:8,bottom: 16), - child: Row( - children: [ - Container( - color: isSelected != index ? Color(0xFFFAFAFA):Color(0xFF32A060), - width: 2.w, - height: 17.h, - ), - SizedBox(width: 10.w,), - Text( - "人气推荐", - textAlign: TextAlign.center, - style: TextStyle( - color:isSelected != index ?Color(0xFF202020):Color(0xFF000000), - fontSize:12.sp, - fontWeight: MyFontWeight.medium, - ), - ), - ], - ),), - ), - ), - ], - ), - ); - } - - Widget goodsItem() { - return Container( - color: Colors.white, - padding: EdgeInsets.only(right: 16.w), - child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceAround, - // crossAxisAlignment: CrossAxisAlignment.center, - children: [ - SizedBox(width: 12.w - ), - MImage( - "assets/image/default_1.png", - width: 70, - height: 70, - fit: BoxFit.cover, - errorSrc: "assets/image/default_1.png", - fadeSrc: "assets/image/default_1.png", - ), - SizedBox(width:10), - Expanded(child: - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "手工啵啵奶茶", - style: TextStyle( - color:Colors.black, - fontSize:13.sp, - fontWeight: MyFontWeight.medium, - ), - ), - SizedBox(height:2), - Row( - children: [ - Text( - "无香精", - style: TextStyle( - color:Color(0xFF4C4C4C), - fontSize:10.sp, - fontWeight: MyFontWeight.regular, - ), - ), - SizedBox(width:10), - Text( - "无香精", - style: TextStyle( - color:Color(0xFF4C4C4C), - fontSize:10.sp, - fontWeight: MyFontWeight.regular, - ), - ) - ], - ), - SizedBox(height:7), - Row( - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Text( - "会员价", - style: TextStyle( - color:Color(0xFFFF7A1A), - fontSize:10.sp, - fontWeight: MyFontWeight.medium, - ), - ), - Text( - "¥19.00", - style: TextStyle( - color:Color(0xFFFF7A1A), - fontSize:11.sp, - fontWeight: MyFontWeight.medium, - ), - ) - ], - ), - Row( - children: [ - Text( - "原价", - style: TextStyle( - color:Color(0xFFA29E9E), - fontSize:9.sp, - fontWeight: MyFontWeight.regular, - ), - ), - SizedBox(width:10), - Text( - "¥19.00", - style: TextStyle( - color:Color(0xFFA29E9E), - fontSize:10.sp, - fontWeight: MyFontWeight.regular, - ), - ) - ], - ), - ], - ), - Spacer(), - true?RoundButton( - width: 49.w, - text: "选规格", - textColor: Colors.white, - fontWeight: MyFontWeight.medium, - radius: 11, - backgroup: Color(0xFF32A060), - fontSize: 11.sp, - padding: EdgeInsets.symmetric(vertical: 5.h), - ): - InkWell( - onTap: () { - }, - child: Image.asset( - "assets/image/reduce.png", - width: 22, - height: 22, - ), - ), - if(false) - Padding(padding: EdgeInsets.only(left: 8,right: 8), - child:Text( - "1", - style: TextStyle( - color:Colors.black, - fontSize:14.sp, - fontWeight: MyFontWeight.medium, - ), - ),), - if(false) - InkWell( - onTap: () { - }, - child: Image.asset( - "assets/image/add.png", - width: 22, - height: 22, - ), - ), - ], - ), - ], - ),) - ], - ), - ); - } - - } \ No newline at end of file