After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 297 B |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 5.1 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 4.4 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 493 B |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 9.3 KiB |
After Width: | Height: | Size: 6.6 KiB |
After Width: | Height: | Size: 8.4 KiB |
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 4.5 KiB |
After Width: | Height: | Size: 6.5 KiB |
After Width: | Height: | Size: 6.1 KiB |
After Width: | Height: | Size: 4.7 KiB |
After Width: | Height: | Size: 498 B |
After Width: | Height: | Size: 852 B |
After Width: | Height: | Size: 197 B |
After Width: | Height: | Size: 898 B |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 859 B |
After Width: | Height: | Size: 733 B |
After Width: | Height: | Size: 843 B |
After Width: | Height: | Size: 614 B |
After Width: | Height: | Size: 735 B |
After Width: | Height: | Size: 763 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 1.1 KiB |
@ -0,0 +1,439 @@
|
||||
import 'package:dio/dio.dart'; |
||||
import 'package:flutter/cupertino.dart'; |
||||
import 'package:flutter/material.dart'; |
||||
import 'package:huixiang/generated/l10n.dart'; |
||||
import 'package:huixiang/retrofit/data/base_data.dart'; |
||||
import 'package:huixiang/retrofit/data/exchange_order.dart'; |
||||
import 'package:huixiang/retrofit/data/page.dart'; |
||||
import 'package:huixiang/retrofit/retrofit_api.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/icon_text.dart'; |
||||
import 'package:huixiang/view_widget/my_appbar.dart'; |
||||
import 'package:huixiang/view_widget/my_footer.dart'; |
||||
import 'package:huixiang/view_widget/my_tab.dart'; |
||||
import 'package:huixiang/view_widget/no_data_view.dart'; |
||||
import 'package:huixiang/view_widget/round_button.dart'; |
||||
import 'package:pull_to_refresh/pull_to_refresh.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
import 'package:shared_preferences/shared_preferences.dart'; |
||||
|
||||
class BargainGroupOrder extends StatefulWidget { |
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _BargainGroupOrder(); |
||||
} |
||||
} |
||||
|
||||
class _BargainGroupOrder extends State<BargainGroupOrder> |
||||
with SingleTickerProviderStateMixin { |
||||
List<Widget> tabs; |
||||
List<Widget> _pages; |
||||
TabController tabcontroller; |
||||
|
||||
@override |
||||
void initState() { |
||||
super.initState(); |
||||
} |
||||
|
||||
@override |
||||
void didChangeDependencies() { |
||||
super.didChangeDependencies(); |
||||
if (tabcontroller == null) |
||||
tabcontroller = TabController(length: 4, vsync: this); |
||||
tabs = [ |
||||
MyTab( |
||||
text: S.of(context).quanbu, |
||||
), |
||||
MyTab( |
||||
text: "进行中", |
||||
), |
||||
MyTab( |
||||
text: "成功", |
||||
), |
||||
MyTab( |
||||
text: "失败", |
||||
) |
||||
]; |
||||
_pages = [ |
||||
ExchangeHistoryList(0), |
||||
ExchangeHistoryList(1), |
||||
ExchangeHistoryList(2), |
||||
ExchangeHistoryList(3) |
||||
]; |
||||
} |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return DefaultTabController( |
||||
length: 4, |
||||
child: Scaffold( |
||||
appBar: MyAppBar( |
||||
title: S.of(context).wodekanjia, |
||||
titleColor: Colors.black, |
||||
titleSize: 18.sp, |
||||
background: Color(0xFFFFFFFF), |
||||
leadingColor: Colors.black, |
||||
toolbarHeight: kToolbarHeight + MediaQuery.of(context).padding.top, |
||||
bottom: PreferredSize( |
||||
preferredSize: Size(double.infinity, 38.h), |
||||
child: TabBar( |
||||
controller: tabcontroller, |
||||
indicatorWeight: 2, |
||||
indicatorColor: Color(0xFF39B54A), |
||||
indicatorSize: TabBarIndicatorSize.label, |
||||
indicatorPadding: EdgeInsets.only(top: 3), |
||||
unselectedLabelStyle: TextStyle( |
||||
fontSize: 16.sp, |
||||
fontWeight: FontWeight.normal, |
||||
), |
||||
labelStyle: TextStyle( |
||||
color: Colors.black, |
||||
fontSize: 16.sp, |
||||
fontWeight: MyFontWeight.semi_bold), |
||||
labelColor: Colors.black, |
||||
tabs: tabs, |
||||
), |
||||
), |
||||
), |
||||
body: TabBarView( |
||||
children: _pages, |
||||
controller: tabcontroller, |
||||
), |
||||
), |
||||
); |
||||
} |
||||
} |
||||
|
||||
class ExchangeHistoryList extends StatefulWidget { |
||||
final int orderStatus; |
||||
|
||||
ExchangeHistoryList(this.orderStatus); |
||||
|
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _ExchangeHistoryList(); |
||||
} |
||||
} |
||||
|
||||
class _ExchangeHistoryList extends State<ExchangeHistoryList> { |
||||
ApiService apiService; |
||||
|
||||
RefreshController _refreshController = |
||||
RefreshController(initialRefresh: false); |
||||
|
||||
@override |
||||
void initState() { |
||||
super.initState(); |
||||
SharedPreferences.getInstance().then((value) => { |
||||
apiService = ApiService(Dio(), |
||||
context: context, token: value.getString('token')), |
||||
}); |
||||
} |
||||
|
||||
int pageNum = 1; |
||||
|
||||
_refresh() { |
||||
pageNum = 1; |
||||
} |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return SmartRefresher( |
||||
enablePullDown: true, |
||||
enablePullUp: true, |
||||
header: MyHeader(), |
||||
footer: CustomFooter( |
||||
builder: (BuildContext context, LoadStatus mode) { |
||||
return MyFooter(mode); |
||||
}, |
||||
), |
||||
controller: _refreshController, |
||||
onRefresh: _refresh, |
||||
// onLoading: queryHistory, |
||||
child: |
||||
// orders == null || orders.length == 0 |
||||
// ? NoDataView( |
||||
// isShowBtn: false, |
||||
// text: "还没有订单,快去下一单吧~", |
||||
// fontSize: 16.sp, |
||||
// margin: EdgeInsets.only(top: 120.h), |
||||
// ) |
||||
// : |
||||
ListView.builder( |
||||
// itemCount: orders == null ? 0 : orders.length, |
||||
itemCount: 5, |
||||
itemBuilder: (context, position) { |
||||
return bargainOrder(); |
||||
}, |
||||
), |
||||
); |
||||
} |
||||
|
||||
String orderStatus(state) { |
||||
String orderStatus = ""; |
||||
switch (state) { |
||||
case 1: |
||||
orderStatus = S.of(context).weiwancheng; |
||||
break; |
||||
case 2: |
||||
orderStatus = S.of(context).yiwancheng; |
||||
break; |
||||
case 9: |
||||
orderStatus = S.of(context).yiquxiao; |
||||
break; |
||||
} |
||||
return orderStatus; |
||||
} |
||||
|
||||
Widget bargainOrder() { |
||||
return Container( |
||||
margin: EdgeInsets.fromLTRB(16.w, 8.h, 16.w, 8.h), |
||||
decoration: BoxDecoration( |
||||
color: Colors.white, |
||||
borderRadius: BorderRadius.circular(4), |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(25), |
||||
offset: Offset(0, 1), |
||||
blurRadius: 12, |
||||
spreadRadius: 0, |
||||
), |
||||
], |
||||
), |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.spaceAround, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Row( |
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Container( |
||||
width: 19.w, |
||||
height:21.h, |
||||
margin: EdgeInsets.only(left: 12.w, top: 12.h), |
||||
alignment: Alignment.center, |
||||
decoration: BoxDecoration( |
||||
color: Color(0xff32A060), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
child: Text( |
||||
// (orderInfo != null && orderInfo.isTakeOut == 0) ? "自" : "外", |
||||
"自", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
fontWeight: FontWeight.bold, |
||||
color: Colors.white, |
||||
), |
||||
), |
||||
), |
||||
Expanded( |
||||
child: Container( |
||||
width: double.infinity, |
||||
margin: EdgeInsets.only(left: 6.w, top: 12.h), |
||||
alignment: Alignment.centerLeft, |
||||
child: Text( |
||||
// (orderInfo != null) ? orderInfo.storeName : "", |
||||
"一心回乡商城", |
||||
style: TextStyle( |
||||
fontWeight: FontWeight.bold, |
||||
fontSize: 14.sp, |
||||
color: Color(0xFF353535), |
||||
), |
||||
), |
||||
), |
||||
flex: 1, |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.only(top: 12.h, right: 12.w), |
||||
child: Text( |
||||
// (orderInfo != null && |
||||
// orderInfo.storeVO != null && |
||||
// orderInfo.storeVO.posType != null) |
||||
// ? StatusUtils.statusText( |
||||
// context, |
||||
// orderInfo.refundStatus, |
||||
// orderInfo.orderStatus, |
||||
// orderInfo.payStatus, |
||||
// orderInfo.sendStatus, |
||||
// orderInfo.isTakeOut) |
||||
// : "", |
||||
"还差¥23.4砍价成功", |
||||
style: TextStyle( |
||||
fontSize: 14.sp, |
||||
fontWeight: FontWeight.bold, |
||||
color: |
||||
// (orderInfo == null) |
||||
// ? Color(0xFF32A060) |
||||
// : (orderInfo.refundStatus == 1 || |
||||
// orderInfo.orderStatus >= 5) |
||||
// ? Colors.grey |
||||
// : (orderInfo.orderStatus == 4) |
||||
// ? Color(0xFF32A060) |
||||
// : |
||||
Color(0xffFE951E), |
||||
), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
Container( |
||||
margin: EdgeInsets.only(left: 37.w), |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.start, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Text( |
||||
S.of(context).xiadanshijian_("下单时间:2020.01.20 10:50:22"), |
||||
style: TextStyle( |
||||
fontSize: 10.sp, |
||||
color: Color(0xFF727272), |
||||
), |
||||
), |
||||
SizedBox( |
||||
height: 8.h, |
||||
), |
||||
Container( |
||||
height: 81.h, |
||||
margin: EdgeInsets.only(right: 12), |
||||
child: Row( |
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
// MImage( |
||||
// "", |
||||
// width: 81.w, |
||||
// height: 81.h, |
||||
// fit: BoxFit.cover, |
||||
// errorSrc: "assets/image/default_1.png", |
||||
// fadeSrc: "assets/image/default_1.png", |
||||
// ), |
||||
Image.asset( |
||||
"assets/image/icon_story_td.png", |
||||
width: 81, |
||||
height: 81, |
||||
), |
||||
SizedBox( |
||||
width: 10, |
||||
), |
||||
Expanded( |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.spaceAround, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Text( |
||||
"[生态小农]山林放养鸡蛋30枚/盒", |
||||
maxLines: 2, |
||||
overflow: TextOverflow.ellipsis, |
||||
style: TextStyle( |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
color: Color(0xFF353535), |
||||
), |
||||
), |
||||
Text( |
||||
"套盒装", |
||||
style: TextStyle( |
||||
fontSize: 10.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
color: Color(0xFF727272), |
||||
), |
||||
), |
||||
Row( |
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Text( |
||||
"x1", |
||||
style: TextStyle( |
||||
fontSize: 10.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color: Color(0xFF727272), |
||||
), |
||||
), |
||||
Text.rich( |
||||
TextSpan( |
||||
children: [ |
||||
TextSpan( |
||||
text: "已砍至:", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFF868686), |
||||
), |
||||
), |
||||
TextSpan( |
||||
text: "58.2", |
||||
style: TextStyle( |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color: Color(0xFF32A060), |
||||
), |
||||
), |
||||
TextSpan( |
||||
text: "元", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFF868686), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
], |
||||
), |
||||
], |
||||
)), |
||||
], |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
SizedBox( |
||||
height: 12.h, |
||||
), |
||||
Container( |
||||
margin: EdgeInsets.only(right: 12.w, bottom: 16.h), |
||||
child: Directionality( |
||||
textDirection: TextDirection.rtl, |
||||
child: Row( |
||||
children: [ |
||||
GestureDetector( |
||||
onTap: () {}, |
||||
child: RoundButton( |
||||
height: 25.h, |
||||
text: "查看详情", |
||||
textColor: Colors.white, |
||||
fontSize: 12.sp, |
||||
backgroup: Color(0xFF32A060), |
||||
radius: 2, |
||||
padding: EdgeInsets.fromLTRB(17.w,0, 17.w,0), |
||||
), |
||||
), |
||||
// GestureDetector( |
||||
// onTap: () { |
||||
// |
||||
// }, |
||||
// child:RoundButton( |
||||
// height: 25.h, |
||||
// padding: EdgeInsets.fromLTRB(8, 4, 8, 4), |
||||
// text: S.of(context).chakanxiangqing, |
||||
// textColor: Colors.white, |
||||
// fontSize: 12, |
||||
// backgroup: Color(0xFF32A060), |
||||
// radius: 2, |
||||
// ), |
||||
// ), |
||||
], |
||||
), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
} |
@ -0,0 +1,307 @@
|
||||
import 'package:huixiang/retrofit/data/product.dart'; |
||||
|
||||
/// actTemplate : {"id":"1473198577613275136","createTime":"2021-12-21 15:48:06","createUser":"1333246101196636160","updateTime":"2021-12-21 15:48:06","updateUser":"1333246101196636160","storeId":"1333246101343436800","type":2,"limitTime":null,"limitNumber":0,"coverImg":"https://pos.upload.gznl.top/1175/2021/12/5bf7a846-768b-4a17-872f-e927988c24c9.jpg","shareImg":"https://pos.upload.gznl.top/1175/2021/12/65f6a0f7-14d1-4393-902e-42e5dc464800.jpg","bannerImg":"https://pos.upload.gznl.top/1175/2021/12/9ee395eb-718c-40c0-bfe0-673dbbade4cf.jpg","state":1,"allDay":false,"startTime":"2021-12-20 00:00:00","endTime":"2021-12-30 00:00:00","isDelete":0} |
||||
/// timeProductList : [{"actTime":{"id":"1473198590141661184","createTime":"2021-12-21 15:48:09","createUser":"1333246101196636160","updateTime":"2021-12-21 15:48:09","updateUser":"1333246101196636160","storeId":"1333246101343436800","templateId":"1473198577613275136","allDay":false,"startHour":"09:00:00","endHour":"10:00:00","isDelete":0},"productList":[]},{"actTime":{"id":"1473570616966643712","createTime":"2021-12-22 16:26:27","createUser":"1333246101196636160","updateTime":"2021-12-22 16:26:27","updateUser":"1333246101196636160","storeId":"1333246101343436800","templateId":"1473198577613275136","allDay":false,"startHour":"11:00:00","endHour":"17:00:00","isDelete":0},"productList":[{"id":"1473570776908038144","createTime":"2021-12-22 16:27:05","createUser":"1333246101196636160","updateTime":"2021-12-22 16:27:05","updateUser":"1333246101196636160","storeId":"1333246101343436800","templateId":"1473198577613275136","timeId":"1473570616966643712","productId":"1456500820571848704","productName":"毛毛虫面包","productImg":"https://pos.upload.gznl.top/1175/2021/11/4a6ffabd-0e10-4720-ac93-57ec6855c5cf.jpg","productPrice":"8.00","promotionPrice":"8.00","productStock":-20,"sellCount":0,"skuJson":[{"skuId":"1456500821968551936","skuPrice":8,"skuStock":-20}],"isDelete":0}]}] |
||||
|
||||
class ActivityAreaList { |
||||
ActivityAreaList({ |
||||
ActTemplate actTemplate, |
||||
List<TimeProductList> timeProductList,}){ |
||||
_actTemplate = actTemplate; |
||||
_timeProductList = timeProductList; |
||||
} |
||||
|
||||
ActivityAreaList.fromJson(dynamic json) { |
||||
_actTemplate = json['actTemplate'] != null ? ActTemplate.fromJson(json['actTemplate']) : null; |
||||
if (json['timeProductList'] != null) { |
||||
_timeProductList = []; |
||||
json['timeProductList'].forEach((v) { |
||||
_timeProductList.add(TimeProductList.fromJson(v)); |
||||
}); |
||||
} |
||||
} |
||||
ActTemplate _actTemplate; |
||||
List<TimeProductList> _timeProductList; |
||||
|
||||
ActTemplate get actTemplate => _actTemplate; |
||||
List<TimeProductList> get timeProductList => _timeProductList; |
||||
|
||||
Map<String, dynamic> toJson() { |
||||
final map = <String, dynamic>{}; |
||||
if (_actTemplate != null) { |
||||
map['actTemplate'] = _actTemplate.toJson(); |
||||
} |
||||
if (_timeProductList != null) { |
||||
map['timeProductList'] = _timeProductList.map((v) => v.toJson()).toList(); |
||||
} |
||||
return map; |
||||
} |
||||
|
||||
} |
||||
|
||||
/// actTime : {"id":"1473198590141661184","createTime":"2021-12-21 15:48:09","createUser":"1333246101196636160","updateTime":"2021-12-21 15:48:09","updateUser":"1333246101196636160","storeId":"1333246101343436800","templateId":"1473198577613275136","allDay":false,"startHour":"09:00:00","endHour":"10:00:00","isDelete":0} |
||||
/// productList : [] |
||||
|
||||
class TimeProductList { |
||||
TimeProductList({ |
||||
ActTime actTime, |
||||
List<dynamic> productList,}){ |
||||
_actTime = actTime; |
||||
_productList = productList; |
||||
} |
||||
|
||||
TimeProductList.fromJson(dynamic json) { |
||||
_actTime = json['actTime'] != null ? ActTime.fromJson(json['actTime']) : null; |
||||
if (json['productList'] != null) { |
||||
_productList = []; |
||||
json['productList'].forEach((v) { |
||||
_productList.add(ProductList.fromJson(v)); |
||||
}); |
||||
} |
||||
} |
||||
ActTime _actTime; |
||||
List<dynamic> _productList; |
||||
|
||||
ActTime get actTime => _actTime; |
||||
List<dynamic> get productList => _productList; |
||||
|
||||
Map<String, dynamic> toJson() { |
||||
final map = <String, dynamic>{}; |
||||
if (_actTime != null) { |
||||
map['actTime'] = _actTime.toJson(); |
||||
} |
||||
if (_productList != null) { |
||||
map['productList'] = _productList.map((v) => v.toJson()).toList(); |
||||
} |
||||
return map; |
||||
} |
||||
|
||||
} |
||||
|
||||
/// id : "1473198590141661184" |
||||
/// createTime : "2021-12-21 15:48:09" |
||||
/// createUser : "1333246101196636160" |
||||
/// updateTime : "2021-12-21 15:48:09" |
||||
/// updateUser : "1333246101196636160" |
||||
/// storeId : "1333246101343436800" |
||||
/// templateId : "1473198577613275136" |
||||
/// allDay : false |
||||
/// startHour : "09:00:00" |
||||
/// endHour : "10:00:00" |
||||
/// isDelete : 0 |
||||
|
||||
class ActTime { |
||||
ActTime({ |
||||
String id, |
||||
String createTime, |
||||
String createUser, |
||||
String updateTime, |
||||
String updateUser, |
||||
String storeId, |
||||
String templateId, |
||||
bool allDay, |
||||
String startHour, |
||||
String endHour, |
||||
int isDelete,}){ |
||||
_id = id; |
||||
_createTime = createTime; |
||||
_createUser = createUser; |
||||
_updateTime = updateTime; |
||||
_updateUser = updateUser; |
||||
_storeId = storeId; |
||||
_templateId = templateId; |
||||
_allDay = allDay; |
||||
_startHour = startHour; |
||||
_endHour = endHour; |
||||
_isDelete = isDelete; |
||||
} |
||||
|
||||
ActTime.fromJson(dynamic json) { |
||||
_id = json['id']; |
||||
_createTime = json['createTime']; |
||||
_createUser = json['createUser']; |
||||
_updateTime = json['updateTime']; |
||||
_updateUser = json['updateUser']; |
||||
_storeId = json['storeId']; |
||||
_templateId = json['templateId']; |
||||
_allDay = json['allDay']; |
||||
_startHour = json['startHour']; |
||||
_endHour = json['endHour']; |
||||
_isDelete = json['isDelete']; |
||||
} |
||||
String _id; |
||||
String _createTime; |
||||
String _createUser; |
||||
String _updateTime; |
||||
String _updateUser; |
||||
String _storeId; |
||||
String _templateId; |
||||
bool _allDay; |
||||
String _startHour; |
||||
String _endHour; |
||||
int _isDelete; |
||||
|
||||
String get id => _id; |
||||
String get createTime => _createTime; |
||||
String get createUser => _createUser; |
||||
String get updateTime => _updateTime; |
||||
String get updateUser => _updateUser; |
||||
String get storeId => _storeId; |
||||
String get templateId => _templateId; |
||||
bool get allDay => _allDay; |
||||
String get startHour => _startHour; |
||||
String get endHour => _endHour; |
||||
int get isDelete => _isDelete; |
||||
|
||||
Map<String, dynamic> toJson() { |
||||
final map = <String, dynamic>{}; |
||||
map['id'] = _id; |
||||
map['createTime'] = _createTime; |
||||
map['createUser'] = _createUser; |
||||
map['updateTime'] = _updateTime; |
||||
map['updateUser'] = _updateUser; |
||||
map['storeId'] = _storeId; |
||||
map['templateId'] = _templateId; |
||||
map['allDay'] = _allDay; |
||||
map['startHour'] = _startHour; |
||||
map['endHour'] = _endHour; |
||||
map['isDelete'] = _isDelete; |
||||
return map; |
||||
} |
||||
|
||||
} |
||||
|
||||
/// id : "1473198577613275136" |
||||
/// createTime : "2021-12-21 15:48:06" |
||||
/// createUser : "1333246101196636160" |
||||
/// updateTime : "2021-12-21 15:48:06" |
||||
/// updateUser : "1333246101196636160" |
||||
/// storeId : "1333246101343436800" |
||||
/// type : 2 |
||||
/// limitTime : null |
||||
/// limitNumber : 0 |
||||
/// coverImg : "https://pos.upload.gznl.top/1175/2021/12/5bf7a846-768b-4a17-872f-e927988c24c9.jpg" |
||||
/// shareImg : "https://pos.upload.gznl.top/1175/2021/12/65f6a0f7-14d1-4393-902e-42e5dc464800.jpg" |
||||
/// bannerImg : "https://pos.upload.gznl.top/1175/2021/12/9ee395eb-718c-40c0-bfe0-673dbbade4cf.jpg" |
||||
/// state : 1 |
||||
/// allDay : false |
||||
/// startTime : "2021-12-20 00:00:00" |
||||
/// endTime : "2021-12-30 00:00:00" |
||||
/// isDelete : 0 |
||||
|
||||
class ActTemplate { |
||||
ActTemplate({ |
||||
String id, |
||||
String createTime, |
||||
String createUser, |
||||
String updateTime, |
||||
String updateUser, |
||||
String storeId, |
||||
int type, |
||||
dynamic limitTime, |
||||
int limitNumber, |
||||
String coverImg, |
||||
String shareImg, |
||||
String bannerImg, |
||||
int state, |
||||
bool allDay, |
||||
String startTime, |
||||
String endTime, |
||||
int isDelete,}){ |
||||
_id = id; |
||||
_createTime = createTime; |
||||
_createUser = createUser; |
||||
_updateTime = updateTime; |
||||
_updateUser = updateUser; |
||||
_storeId = storeId; |
||||
_type = type; |
||||
_limitTime = limitTime; |
||||
_limitNumber = limitNumber; |
||||
_coverImg = coverImg; |
||||
_shareImg = shareImg; |
||||
_bannerImg = bannerImg; |
||||
_state = state; |
||||
_allDay = allDay; |
||||
_startTime = startTime; |
||||
_endTime = endTime; |
||||
_isDelete = isDelete; |
||||
} |
||||
|
||||
ActTemplate.fromJson(dynamic json) { |
||||
_id = json['id']; |
||||
_createTime = json['createTime']; |
||||
_createUser = json['createUser']; |
||||
_updateTime = json['updateTime']; |
||||
_updateUser = json['updateUser']; |
||||
_storeId = json['storeId']; |
||||
_type = json['type']; |
||||
_limitTime = json['limitTime']; |
||||
_limitNumber = json['limitNumber']; |
||||
_coverImg = json['coverImg']; |
||||
_shareImg = json['shareImg']; |
||||
_bannerImg = json['bannerImg']; |
||||
_state = json['state']; |
||||
_allDay = json['allDay']; |
||||
_startTime = json['startTime']; |
||||
_endTime = json['endTime']; |
||||
_isDelete = json['isDelete']; |
||||
} |
||||
String _id; |
||||
String _createTime; |
||||
String _createUser; |
||||
String _updateTime; |
||||
String _updateUser; |
||||
String _storeId; |
||||
int _type; |
||||
dynamic _limitTime; |
||||
int _limitNumber; |
||||
String _coverImg; |
||||
String _shareImg; |
||||
String _bannerImg; |
||||
int _state; |
||||
bool _allDay; |
||||
String _startTime; |
||||
String _endTime; |
||||
int _isDelete; |
||||
|
||||
String get id => _id; |
||||
String get createTime => _createTime; |
||||
String get createUser => _createUser; |
||||
String get updateTime => _updateTime; |
||||
String get updateUser => _updateUser; |
||||
String get storeId => _storeId; |
||||
int get type => _type; |
||||
dynamic get limitTime => _limitTime; |
||||
int get limitNumber => _limitNumber; |
||||
String get coverImg => _coverImg; |
||||
String get shareImg => _shareImg; |
||||
String get bannerImg => _bannerImg; |
||||
int get state => _state; |
||||
bool get allDay => _allDay; |
||||
String get startTime => _startTime; |
||||
String get endTime => _endTime; |
||||
int get isDelete => _isDelete; |
||||
|
||||
Map<String, dynamic> toJson() { |
||||
final map = <String, dynamic>{}; |
||||
map['id'] = _id; |
||||
map['createTime'] = _createTime; |
||||
map['createUser'] = _createUser; |
||||
map['updateTime'] = _updateTime; |
||||
map['updateUser'] = _updateUser; |
||||
map['storeId'] = _storeId; |
||||
map['type'] = _type; |
||||
map['limitTime'] = _limitTime; |
||||
map['limitNumber'] = _limitNumber; |
||||
map['coverImg'] = _coverImg; |
||||
map['shareImg'] = _shareImg; |
||||
map['bannerImg'] = _bannerImg; |
||||
map['state'] = _state; |
||||
map['allDay'] = _allDay; |
||||
map['startTime'] = _startTime; |
||||
map['endTime'] = _endTime; |
||||
map['isDelete'] = _isDelete; |
||||
return map; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,683 @@
|
||||
import 'package:dio/dio.dart'; |
||||
import 'package:flutter/cupertino.dart'; |
||||
import 'package:flutter/material.dart'; |
||||
import 'package:huixiang/retrofit/data/activity_area_list.dart'; |
||||
import 'package:huixiang/retrofit/data/base_data.dart'; |
||||
import 'package:huixiang/retrofit/retrofit_api.dart'; |
||||
import 'package:huixiang/utils/font_weight.dart'; |
||||
import 'package:huixiang/view_widget/custom_image.dart'; |
||||
import 'package:pull_to_refresh/pull_to_refresh.dart'; |
||||
import 'package:shared_preferences/shared_preferences.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
|
||||
class ActivityPrefectureDetails extends StatefulWidget { |
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _ActivityPrefectureDetails(); |
||||
} |
||||
} |
||||
|
||||
class _ActivityPrefectureDetails extends State<ActivityPrefectureDetails> { |
||||
ApiService apiService; |
||||
int seckillIndex = 0; |
||||
RefreshController refreshController = RefreshController(); |
||||
List<ActivityAreaList> activityAreaList = []; |
||||
ScrollController _scrollController; |
||||
ScrollPhysics _scrollPhysics = NeverScrollableScrollPhysics(); |
||||
bool scrollFlag = false; |
||||
|
||||
|
||||
|
||||
@override |
||||
void initState() { |
||||
super.initState(); |
||||
_scrollController = ScrollController(); |
||||
_scrollController.addListener(() { |
||||
setState(() { |
||||
if(_scrollController.offset < (325.h-MediaQuery.of(context).padding.top)){ |
||||
_scrollPhysics = NeverScrollableScrollPhysics(); |
||||
} |
||||
else{ |
||||
_scrollPhysics = BouncingScrollPhysics(); |
||||
} |
||||
}); |
||||
}); |
||||
SharedPreferences.getInstance().then((value) { |
||||
apiService = |
||||
ApiService(Dio(), context: context, token: value.getString("token")); |
||||
queryFindActListByType(false,2); |
||||
}); |
||||
} |
||||
|
||||
///秒杀/砍价/拼团列表 |
||||
queryFindActListByType(allDay,type) async { |
||||
if (apiService == null) { |
||||
SharedPreferences value = await SharedPreferences.getInstance(); |
||||
apiService = ApiService( |
||||
Dio(), |
||||
context: context, |
||||
token: value.getString("token"), |
||||
); |
||||
} |
||||
BaseData<List<ActivityAreaList>> baseData = |
||||
await apiService.findActListByType(allDay,type).catchError((error) { |
||||
refreshController.refreshFailed(); |
||||
}); |
||||
if (baseData != null && baseData.isSuccess) { |
||||
activityAreaList.clear(); |
||||
activityAreaList.addAll(baseData.data); |
||||
setState(() { |
||||
refreshController.refreshCompleted(); |
||||
}); |
||||
} else { |
||||
refreshController.refreshFailed(); |
||||
} |
||||
} |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return SingleChildScrollView( |
||||
physics: BouncingScrollPhysics(), |
||||
controller: _scrollController, |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.start, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
seckillProduct(), |
||||
seckilList(), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
Widget seckillProduct() { |
||||
return Container( |
||||
decoration: BoxDecoration( |
||||
borderRadius: BorderRadius.vertical( |
||||
bottom: Radius.circular(8.h), |
||||
), |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(12), |
||||
offset: Offset(0, 3), |
||||
blurRadius: 14, |
||||
spreadRadius: 0, |
||||
) |
||||
], |
||||
color: Colors.white), |
||||
child: Column( |
||||
children: [ |
||||
swiper(), |
||||
seckillIndex == 0 ? |
||||
Container( |
||||
width: double.infinity, |
||||
alignment: Alignment.center, |
||||
height: 62.h, |
||||
padding: EdgeInsets.only(left: 16.w,right: 16.w), |
||||
decoration: BoxDecoration( |
||||
color: Color(0xFFFFEED9)), |
||||
child: Row( |
||||
mainAxisAlignment: MainAxisAlignment.start, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
Image.asset( |
||||
"assets/image/ms.png", |
||||
width:38, |
||||
height:38, |
||||
fit: BoxFit.contain, |
||||
), |
||||
SizedBox(width: 14.w,), |
||||
Expanded(child:ListView.builder( |
||||
scrollDirection: Axis.horizontal, |
||||
physics: BouncingScrollPhysics(), |
||||
itemCount:activityAreaList != null ? activityAreaList.length : 0, |
||||
itemBuilder: (context, position) { |
||||
return GestureDetector( |
||||
onTap: () { |
||||
setState(() { |
||||
}); |
||||
}, |
||||
child: timeItem(activityAreaList[position],position), |
||||
); |
||||
}, |
||||
)) |
||||
, |
||||
], |
||||
), |
||||
) |
||||
: Container( |
||||
width: double.infinity, |
||||
alignment: Alignment.center, |
||||
height: 62.h, |
||||
padding: EdgeInsets.only(left: 16.w,right: 16.w), |
||||
decoration: BoxDecoration( |
||||
color: Color(0xFFFFEED9)), |
||||
child: Row( |
||||
mainAxisAlignment: MainAxisAlignment.start, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
Image.asset( |
||||
"assets/image/ms_t.png", |
||||
width:38, |
||||
height:38, |
||||
fit: BoxFit.contain, |
||||
), |
||||
Spacer(), |
||||
Text.rich( |
||||
TextSpan( |
||||
children: [ |
||||
TextSpan( |
||||
text: "距秒杀结束还有", |
||||
style: TextStyle( |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color: Colors.black, |
||||
), |
||||
), |
||||
TextSpan( |
||||
text: "0", |
||||
style: TextStyle( |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color: Color(0xFFFB312B), |
||||
), |
||||
), |
||||
TextSpan( |
||||
text: "天", |
||||
style: TextStyle( |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color: Colors.black, |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
SizedBox(width: 4.w), |
||||
Row( |
||||
mainAxisAlignment: MainAxisAlignment.center, |
||||
crossAxisAlignment: CrossAxisAlignment.center,children: [ |
||||
InkWell( |
||||
onTap: () { |
||||
setState(() { |
||||
}); |
||||
}, |
||||
child:Container( |
||||
width: 20, |
||||
height: 20, |
||||
alignment: Alignment.center, |
||||
decoration: BoxDecoration( |
||||
color: Color(0xFFFB312B), |
||||
borderRadius: BorderRadius.circular(1)), |
||||
child: Text( |
||||
"22", |
||||
style: TextStyle( |
||||
color: Colors.white, |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
), |
||||
), |
||||
), |
||||
), |
||||
Padding(padding:EdgeInsets.only(left: 2.w,right: 2.w), |
||||
child:Text( |
||||
":", |
||||
style: TextStyle( |
||||
fontWeight: MyFontWeight.medium, |
||||
fontSize: 14.sp, |
||||
color: Color(0xFFFB312B), |
||||
), |
||||
),), |
||||
Container( |
||||
width: 20, |
||||
height: 20, |
||||
alignment: Alignment.center, |
||||
decoration: BoxDecoration( |
||||
color: Color(0xFFFB312B), |
||||
borderRadius: BorderRadius.circular(1)), |
||||
child: Text( |
||||
"22", |
||||
style: TextStyle( |
||||
color: Colors.white, |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
), |
||||
), |
||||
), |
||||
Padding(padding:EdgeInsets.only(left: 2.w,right: 2.w), |
||||
child:Text( |
||||
":", |
||||
style: TextStyle( |
||||
fontWeight: MyFontWeight.medium, |
||||
fontSize: 14.sp, |
||||
color: Color(0xFFFB312B), |
||||
), |
||||
),), |
||||
InkWell( |
||||
onTap: () { |
||||
}, |
||||
child: Container( |
||||
width: 20, |
||||
height: 20, |
||||
alignment: Alignment.center, |
||||
decoration: BoxDecoration( |
||||
color: Color(0xFFFB312B), |
||||
borderRadius: BorderRadius.circular(1)), |
||||
child: Text( |
||||
"22", |
||||
style: TextStyle( |
||||
color: Colors.white, |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
), |
||||
), |
||||
), |
||||
), |
||||
],) |
||||
], |
||||
), |
||||
) |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
Widget swiper() { |
||||
return Container( |
||||
child: AspectRatio( |
||||
aspectRatio: 1.3698, |
||||
child: Stack( |
||||
children: [ |
||||
MImage( |
||||
"", |
||||
width:double.infinity, |
||||
height: 330.h, |
||||
fit: BoxFit.cover, |
||||
errorSrc: "assets/image/default_1.png", |
||||
fadeSrc: "assets/image/default_1.png", |
||||
), |
||||
GestureDetector( |
||||
onTap: () { |
||||
Navigator.of(context).pop(); |
||||
}, |
||||
child: Container( |
||||
margin: EdgeInsets.only(left: 16, top: 52), |
||||
padding: EdgeInsets.all(5), |
||||
child: Icon( |
||||
Icons.arrow_back_ios, |
||||
size: 24, |
||||
color: Colors.black, |
||||
), |
||||
), |
||||
), |
||||
Align( |
||||
alignment: Alignment.topCenter, |
||||
child:Container( |
||||
margin: EdgeInsets.only(top: 52), |
||||
decoration: BoxDecoration( |
||||
borderRadius: BorderRadius.circular(15), |
||||
color: Color.fromRGBO(0, 0, 0, 69000000), |
||||
), |
||||
width:160.w, |
||||
height: 30.h, |
||||
child: Row( |
||||
children: [ |
||||
GestureDetector( |
||||
onTap: (){ |
||||
setState(() { |
||||
seckillIndex =0; |
||||
}); |
||||
}, |
||||
child: Container( |
||||
alignment: Alignment.center, |
||||
width: 72.w, |
||||
height:22.h, |
||||
margin: EdgeInsets.only(left:6.w), |
||||
decoration: BoxDecoration( |
||||
gradient: new LinearGradient( |
||||
begin: Alignment.centerRight, |
||||
end: Alignment.centerLeft, |
||||
colors: [ |
||||
seckillIndex == 0 ? Color(0xFFF67E5F):Colors.transparent, |
||||
seckillIndex == 0 ? Color(0xFFFC5237):Colors.transparent, |
||||
]), |
||||
borderRadius: BorderRadius.circular(16), |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(12), |
||||
offset: Offset(0, 3), |
||||
blurRadius: 14, |
||||
spreadRadius: 0, |
||||
), |
||||
], |
||||
), |
||||
child: Opacity( |
||||
opacity: seckillIndex == 0 ? 1 :0.5, |
||||
child: Text( |
||||
"限时秒杀", |
||||
style: TextStyle( |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
color: Colors.white, |
||||
), |
||||
), |
||||
) |
||||
) |
||||
), |
||||
GestureDetector( |
||||
onTap: (){ |
||||
setState(() { |
||||
seckillIndex = 1; |
||||
}); |
||||
}, |
||||
child: Container( |
||||
alignment: Alignment.center, |
||||
width: 72.w, |
||||
height:22.h, |
||||
margin: EdgeInsets.only(left:6.w), |
||||
decoration: BoxDecoration( |
||||
gradient: new LinearGradient( |
||||
begin: Alignment.centerRight, |
||||
end: Alignment.centerLeft, |
||||
colors: [ |
||||
seckillIndex == 1 ? Color(0xFFF67E5F):Colors.transparent, |
||||
seckillIndex == 1 ? Color(0xFFFC5237):Colors.transparent, |
||||
]), |
||||
borderRadius: BorderRadius.circular(16), |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(12), |
||||
offset: Offset(0, 3), |
||||
blurRadius: 14, |
||||
spreadRadius: 0, |
||||
), |
||||
], |
||||
), |
||||
child:Opacity( |
||||
opacity: seckillIndex == 1 ? 1 :0.5, |
||||
child: Text( |
||||
"限天秒杀", |
||||
style: TextStyle( |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
color: Colors.white, |
||||
), |
||||
), |
||||
) |
||||
) |
||||
), |
||||
], |
||||
), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
); |
||||
} |
||||
|
||||
///秒杀列表 |
||||
Widget seckilList() { |
||||
return Container( |
||||
height: MediaQuery.of(context).size.height-62.h-MediaQuery.of(context).padding.top, |
||||
padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h), |
||||
child: ListView.builder( |
||||
padding: EdgeInsets.zero, |
||||
itemCount:10, |
||||
scrollDirection: Axis.vertical, |
||||
shrinkWrap: true, |
||||
physics: _scrollPhysics, |
||||
itemBuilder: (context, position) { |
||||
return GestureDetector( |
||||
onTap: () { |
||||
setState(() {}); |
||||
}, |
||||
child: seckilItem(), |
||||
); |
||||
}, |
||||
), |
||||
); |
||||
} |
||||
|
||||
Widget timeItem(ActivityAreaList activityAreaList,position) { |
||||
return Container( |
||||
margin: EdgeInsets.only(right:12.w,top:8.h,bottom:8.h), |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.start, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
Text( |
||||
activityAreaList.timeProductList[position].actTime.startHour, |
||||
style: TextStyle( |
||||
fontSize: 17.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color: Color(0xFFFC3127), |
||||
), |
||||
), |
||||
Expanded(child: Container( |
||||
alignment: Alignment.center, |
||||
width:48.w, |
||||
height:15.h, |
||||
decoration: BoxDecoration( |
||||
color: Color(0xFFFB312B), |
||||
borderRadius: BorderRadius.circular(16), |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(12), |
||||
offset: Offset(0, 3), |
||||
blurRadius: 14, |
||||
spreadRadius: 0, |
||||
), |
||||
], |
||||
), |
||||
child: Text( |
||||
"已结束", |
||||
style: TextStyle( |
||||
fontSize:10.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Colors.white, |
||||
), |
||||
), |
||||
)) |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
Widget seckilItem() { |
||||
return Container( |
||||
margin: EdgeInsets.only(right:12.w,top: 12.h,bottom: 12.h), |
||||
child: Row( |
||||
mainAxisAlignment: MainAxisAlignment.start, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
// MImage( |
||||
// "", |
||||
// width: 94.w, |
||||
// height: 94.h, |
||||
// fit: BoxFit.cover, |
||||
// errorSrc: "assets/image/default_1.png", |
||||
// fadeSrc: "assets/image/default_1.png", |
||||
// ), |
||||
Image.asset( |
||||
"assets/image/icon_story_td.png", |
||||
width: 94, |
||||
height: 94, |
||||
fit: BoxFit.cover, |
||||
), |
||||
SizedBox(width:12.w,), |
||||
Expanded(child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.spaceAround, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Text( |
||||
"[生态小农]山林放养鸡蛋30枚/盒", |
||||
maxLines: 2, |
||||
overflow: TextOverflow.ellipsis, |
||||
style: TextStyle( |
||||
fontSize: 15.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
color: Color(0xFF353535), |
||||
), |
||||
), |
||||
Text( |
||||
"限量45件", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFF4D4D4D), |
||||
), |
||||
), |
||||
Row( |
||||
children: [ |
||||
ClipRRect( |
||||
borderRadius: BorderRadius.circular(6.5), |
||||
child: |
||||
Stack( |
||||
children: [ |
||||
Container( |
||||
width: 180.w, |
||||
height: 8.h, |
||||
color: Color(0xFFF5F5F5), |
||||
), |
||||
Container( |
||||
width: 100.w, |
||||
height: 8.h, |
||||
decoration: BoxDecoration( |
||||
gradient: LinearGradient( |
||||
begin: Alignment.centerLeft, |
||||
end: Alignment.centerRight, |
||||
colors: [Color(0xFFFDBA56), Color(0xFFFB2B2B)])), |
||||
) |
||||
], |
||||
)), |
||||
SizedBox(width: 5,), |
||||
Text( |
||||
"已售67%", |
||||
style: TextStyle( |
||||
fontSize: 10.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFF353535), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
Row( |
||||
children: [ |
||||
Text.rich( |
||||
TextSpan( |
||||
children: [ |
||||
TextSpan( |
||||
text: "¥", |
||||
style: TextStyle( |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color: Color(0xFFFB2E2C), |
||||
), |
||||
), |
||||
TextSpan( |
||||
text: "123.00", |
||||
style: TextStyle( |
||||
fontSize: 18.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color: Color(0xFFFB2E2C), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
Expanded(child: Text( |
||||
"¥234.00", |
||||
style: TextStyle( |
||||
fontSize: 10.sp, |
||||
decoration: TextDecoration.lineThrough, |
||||
decorationColor: Color(0xFF585858), |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFF353535), |
||||
), |
||||
),), |
||||
Container( |
||||
alignment: Alignment.center, |
||||
width:60.w, |
||||
height:24.h, |
||||
decoration: BoxDecoration( |
||||
color: Color(0xFFFB312B), |
||||
borderRadius: BorderRadius.circular(12), |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(12), |
||||
offset: Offset(0, 3), |
||||
blurRadius: 14, |
||||
spreadRadius: 0, |
||||
), |
||||
], |
||||
), |
||||
child: Text( |
||||
"马上抢", |
||||
style: TextStyle( |
||||
fontSize:12.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
color: Colors.white, |
||||
), |
||||
), |
||||
), |
||||
// Container( |
||||
// alignment: Alignment.center, |
||||
// width:60.w, |
||||
// height:24.h, |
||||
// decoration: BoxDecoration( |
||||
// color: Color(0xFFE2F6EA), |
||||
// borderRadius: BorderRadius.circular(12), |
||||
// boxShadow: [ |
||||
// BoxShadow( |
||||
// color: Colors.black.withAlpha(12), |
||||
// offset: Offset(0, 3), |
||||
// blurRadius: 14, |
||||
// spreadRadius: 0, |
||||
// ), |
||||
// ], |
||||
// ), |
||||
// child: Text( |
||||
// "即将开始", |
||||
// style: TextStyle( |
||||
// fontSize:12.sp, |
||||
// fontWeight: MyFontWeight.medium, |
||||
// color: Color(0xFF52AF79), |
||||
// ), |
||||
// ), |
||||
// ), |
||||
// Container( |
||||
// alignment: Alignment.center, |
||||
// width:60.w, |
||||
// height:24.h, |
||||
// decoration: BoxDecoration( |
||||
// color: Colors.transparent, |
||||
// borderRadius: BorderRadius.circular(12), |
||||
// boxShadow: [ |
||||
// BoxShadow( |
||||
// color: Colors.black.withAlpha(12), |
||||
// offset: Offset(0, 3), |
||||
// blurRadius: 14, |
||||
// spreadRadius: 0, |
||||
// ), |
||||
// ], |
||||
// ), |
||||
// child: Text( |
||||
// "已结束", |
||||
// style: TextStyle( |
||||
// fontSize:12.sp, |
||||
// fontWeight: MyFontWeight.medium, |
||||
// color: Color(0xFFADADAD), |
||||
// ), |
||||
// ), |
||||
// ), |
||||
], |
||||
), |
||||
], |
||||
),) |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,203 @@
|
||||
import 'package:flutter/material.dart'; |
||||
import 'package:huixiang/retrofit/retrofit_api.dart'; |
||||
import 'package:huixiang/utils/font_weight.dart'; |
||||
import 'package:huixiang/view_widget/classic_header.dart'; |
||||
import 'package:huixiang/view_widget/my_footer.dart'; |
||||
import 'package:pull_to_refresh/pull_to_refresh.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
class CartGoodsList extends StatefulWidget { |
||||
|
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _CartGoodsList(); |
||||
} |
||||
} |
||||
|
||||
class _CartGoodsList extends State<CartGoodsList> { |
||||
RefreshController refreshController = RefreshController(); |
||||
ApiService apiService; |
||||
int pageNum = 0; |
||||
|
||||
@override |
||||
void initState() { |
||||
super.initState(); |
||||
_onRefresh(); |
||||
} |
||||
|
||||
_onRefresh() async { |
||||
pageNum = 0; |
||||
setState(() {}); |
||||
} |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Container( |
||||
height: MediaQuery.of(context).size.height - |
||||
103.h - |
||||
MediaQuery.of(context).padding.top, |
||||
child: SmartRefresher( |
||||
controller: refreshController, |
||||
enablePullUp: false, |
||||
enablePullDown: true, |
||||
physics: BouncingScrollPhysics(), |
||||
header: MyHeader(), |
||||
onRefresh: () { |
||||
}, |
||||
child: ListView.builder( |
||||
itemCount:6, |
||||
padding: EdgeInsets.only( |
||||
top: 8.h, |
||||
bottom: 84.h, /* + (375.h - 88.h) + 4.h*/ |
||||
), |
||||
physics: NeverScrollableScrollPhysics(), |
||||
itemBuilder: (context, position) { |
||||
return InkWell( |
||||
onTap: () { |
||||
}, |
||||
child: cartGoodsItem(), |
||||
); |
||||
}), |
||||
), |
||||
); |
||||
} |
||||
|
||||
Widget cartGoodsItem() { |
||||
return Container( |
||||
margin: EdgeInsets.all(16), |
||||
padding: EdgeInsets.all(16), |
||||
decoration: BoxDecoration( |
||||
borderRadius: BorderRadius.circular(8), |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(12), |
||||
offset: Offset(0, 3), |
||||
blurRadius: 14, |
||||
spreadRadius: 0, |
||||
), |
||||
], |
||||
color: Colors.white, |
||||
), |
||||
child: Row( |
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
Image.asset( |
||||
// ? "assets/image/icon_radio_selected.png" : |
||||
"assets/image/icon_radio_unselected.png", |
||||
width:16, |
||||
height:16, |
||||
), |
||||
SizedBox(width: 16.w), |
||||
// MImage( |
||||
// "assets/image/icon_story_td.png", |
||||
// isCircle: true, |
||||
// width:81, |
||||
// height:81, |
||||
// fit: BoxFit.cover, |
||||
// errorSrc: "assets/image/default_1.png", |
||||
// fadeSrc: "assets/image/default_1.png", |
||||
// ), |
||||
Image.asset( |
||||
"assets/image/icon_story_td.png", |
||||
width: 81, |
||||
height: 81, |
||||
fit: BoxFit.cover, |
||||
), |
||||
SizedBox(width: 10.w), |
||||
Expanded(child: |
||||
Container( |
||||
height:81.h,child:Column( |
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Text( |
||||
"[生态小农]山林放养鸡蛋30枚/盒", |
||||
maxLines: 2, |
||||
overflow: TextOverflow.ellipsis, |
||||
style: TextStyle( |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
color: Color(0xFF353535), |
||||
), |
||||
), |
||||
// SizedBox(height: 5.h), |
||||
Text( |
||||
"套盒装", |
||||
style: TextStyle( |
||||
fontSize: 10.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
color: Color(0xFF727272), |
||||
), |
||||
), |
||||
// SizedBox(height: 5.h), |
||||
Row( |
||||
mainAxisAlignment: MainAxisAlignment.center, |
||||
crossAxisAlignment: CrossAxisAlignment.end, |
||||
children: [ |
||||
Expanded(child:Text.rich( |
||||
TextSpan( |
||||
children: [ |
||||
TextSpan( |
||||
text: "¥", |
||||
style: TextStyle( |
||||
fontSize: 10.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color: Color(0xFF32A060), |
||||
), |
||||
), |
||||
TextSpan( |
||||
text: "58.2", |
||||
style: TextStyle( |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color: Color(0xFF32A060), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
)), |
||||
Row( |
||||
mainAxisAlignment: MainAxisAlignment.center, |
||||
crossAxisAlignment: CrossAxisAlignment.center,children: [ |
||||
InkWell( |
||||
onTap: () { |
||||
setState(() { |
||||
}); |
||||
}, |
||||
child: Image.asset( |
||||
"assets/image/reduce.png", |
||||
width: 22, |
||||
height: 22, |
||||
), |
||||
), |
||||
Container( |
||||
width: 30, |
||||
alignment: Alignment.center, |
||||
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, |
||||
), |
||||
), |
||||
],) |
||||
], |
||||
), |
||||
], |
||||
)),), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
} |
@ -0,0 +1,241 @@
|
||||
import 'package:flutter/cupertino.dart'; |
||||
import 'package:flutter/material.dart'; |
||||
import 'package:flutter_swiper/flutter_swiper.dart'; |
||||
import 'package:huixiang/generated/l10n.dart'; |
||||
import 'package:huixiang/retrofit/retrofit_api.dart'; |
||||
import 'package:huixiang/store/shopping/shopping_home/recommend_goods_list_view.dart'; |
||||
import 'package:huixiang/utils/font_weight.dart'; |
||||
import 'package:huixiang/view_widget/classic_header.dart'; |
||||
import 'package:huixiang/view_widget/my_appbar.dart'; |
||||
import 'package:huixiang/view_widget/round_button.dart'; |
||||
import 'package:pull_to_refresh/pull_to_refresh.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
|
||||
import 'cart_goods_list.dart'; |
||||
|
||||
class ShoppingCartPage extends StatefulWidget { |
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _ShoppingCartPage(); |
||||
} |
||||
} |
||||
|
||||
class _ShoppingCartPage extends State<ShoppingCartPage> |
||||
with AutomaticKeepAliveClientMixin { |
||||
ApiService apiService; |
||||
|
||||
@override |
||||
void initState() { |
||||
super.initState(); |
||||
} |
||||
|
||||
final SwiperController controller = SwiperController(); |
||||
|
||||
@override |
||||
void dispose() { |
||||
super.dispose(); |
||||
if (refreshController != null) refreshController.dispose(); |
||||
} |
||||
|
||||
final RefreshController refreshController = RefreshController(); |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
super.build(context); |
||||
return Stack( |
||||
children: [ |
||||
Column( |
||||
children: [ |
||||
MyAppBar( |
||||
title: "购物车", |
||||
titleColor: Colors.black, |
||||
leadingColor: Colors.black, |
||||
background: Colors.transparent, |
||||
actions: [ |
||||
Container( |
||||
alignment: Alignment.center, |
||||
margin: EdgeInsets.only(right: 12.w), |
||||
child: GestureDetector( |
||||
onTap: () { |
||||
|
||||
}, |
||||
child: Text("管理", |
||||
style: TextStyle( |
||||
fontSize: 18.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color:Colors.black, |
||||
), |
||||
), |
||||
), |
||||
), |
||||
// Container( |
||||
// alignment: Alignment.center, |
||||
// margin: EdgeInsets.only(right: 12.w), |
||||
// child: GestureDetector( |
||||
// onTap: () { |
||||
// |
||||
// }, |
||||
// child: Text(S.of(context).quxiao, |
||||
// style: TextStyle( |
||||
// fontSize: 18.sp, |
||||
// fontWeight: MyFontWeight.semi_bold, |
||||
// color:Colors.black, |
||||
// ), |
||||
// ), |
||||
// ), |
||||
// ), |
||||
], |
||||
), |
||||
Expanded( |
||||
child: Container( |
||||
child: SmartRefresher( |
||||
controller: refreshController, |
||||
enablePullDown: true, |
||||
enablePullUp: false, |
||||
header: MyHeader(), |
||||
physics: BouncingScrollPhysics(), |
||||
onRefresh: () { |
||||
setState(() {}); |
||||
}, |
||||
child: SingleChildScrollView( |
||||
physics: NeverScrollableScrollPhysics(), |
||||
child: FutureBuilder( |
||||
// future: queryHome(), |
||||
builder: (context, snapshot) { |
||||
return Column( |
||||
children: [ |
||||
///购物车商品列表 |
||||
CartGoodsList(), |
||||
], |
||||
); |
||||
}, |
||||
), |
||||
), |
||||
), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
Align( |
||||
alignment: Alignment(0.8,0.8), |
||||
child: Container( |
||||
height:70.h, |
||||
width: double.infinity, |
||||
decoration: BoxDecoration( |
||||
borderRadius: BorderRadius.circular(8), |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(12), |
||||
offset: Offset(0, 3), |
||||
blurRadius: 14, |
||||
spreadRadius: 0, |
||||
), |
||||
], |
||||
color: Color(0xFFFAFAFA), |
||||
), |
||||
padding: EdgeInsets.only(left: 16.w,right: 16.w), |
||||
child: Row( |
||||
mainAxisAlignment: MainAxisAlignment.spaceAround, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
Image.asset( |
||||
"assets/image/icon_radio_unselected.png", |
||||
width: 16, |
||||
height: 16, |
||||
), |
||||
SizedBox(width: 5.w), |
||||
Expanded(child: Text( |
||||
"全选", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFFA29E9E), |
||||
), |
||||
),), |
||||
Text.rich( |
||||
TextSpan( |
||||
children: [ |
||||
TextSpan( |
||||
text: "合计:", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Colors.black, |
||||
), |
||||
), |
||||
TextSpan( |
||||
text: "¥20.4", |
||||
style: TextStyle( |
||||
fontSize: 20.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color: Color(0xFF32A060), |
||||
), |
||||
), |
||||
|
||||
], |
||||
), |
||||
), |
||||
Container( |
||||
alignment: Alignment.center, |
||||
width: 70.w, |
||||
height: 32.h, |
||||
margin: EdgeInsets.only(left:6.w), |
||||
decoration: BoxDecoration( |
||||
color: Color(0xFF32A060), |
||||
borderRadius: BorderRadius.circular(16), |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(12), |
||||
offset: Offset(0, 3), |
||||
blurRadius: 14, |
||||
spreadRadius: 0, |
||||
), |
||||
], |
||||
), |
||||
child: Text( |
||||
"结算", |
||||
style: TextStyle( |
||||
fontSize: 16.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Colors.white, |
||||
), |
||||
), |
||||
), |
||||
// Container( |
||||
// alignment: Alignment.center, |
||||
// width: 70.w, |
||||
// height: 32.h, |
||||
// margin: EdgeInsets.only(left:6.w), |
||||
// decoration: BoxDecoration( |
||||
// color: Color(0xFFFB312B), |
||||
// borderRadius: BorderRadius.circular(16), |
||||
// boxShadow: [ |
||||
// BoxShadow( |
||||
// color: Colors.black.withAlpha(12), |
||||
// offset: Offset(0, 3), |
||||
// blurRadius: 14, |
||||
// spreadRadius: 0, |
||||
// ), |
||||
// ], |
||||
// ), |
||||
// child: Text( |
||||
// "删除", |
||||
// style: TextStyle( |
||||
// fontSize: 16.sp, |
||||
// fontWeight: MyFontWeight.regular, |
||||
// color: Colors.white, |
||||
// ), |
||||
// ), |
||||
// ), |
||||
], |
||||
), |
||||
), |
||||
), |
||||
], |
||||
); |
||||
} |
||||
|
||||
|
||||
@override |
||||
bool get wantKeepAlive => true; |
||||
} |
@ -0,0 +1,205 @@
|
||||
import 'dart:convert'; |
||||
|
||||
import 'package:flutter/material.dart'; |
||||
import 'package:flutter_swiper/flutter_swiper.dart'; |
||||
import 'package:huixiang/retrofit/data/banner.dart'; |
||||
import 'package:huixiang/retrofit/retrofit_api.dart'; |
||||
import 'package:huixiang/view_widget/custom_image.dart'; |
||||
import 'package:pull_to_refresh/pull_to_refresh.dart'; |
||||
import 'package:huixiang/utils/font_weight.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
|
||||
class ActivityBanner extends StatefulWidget { |
||||
final List<BannerData> bannerData; |
||||
final SwiperController controller; |
||||
|
||||
ActivityBanner(this.bannerData, this.controller); |
||||
|
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _ActivityBanner(); |
||||
} |
||||
} |
||||
|
||||
class _ActivityBanner extends State<ActivityBanner> { |
||||
ApiService apiService; |
||||
final RefreshController refreshController = RefreshController(); |
||||
List<BannerData> bannerData = []; |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Container( |
||||
margin: EdgeInsets.only(bottom:10), |
||||
child: AspectRatio( |
||||
aspectRatio: 1.23, |
||||
child: Swiper( |
||||
viewportFraction: 0.9, |
||||
scale: 0.73, |
||||
pagination: SwiperPagination( |
||||
alignment: Alignment.bottomCenter, |
||||
builder: DotSwiperPaginationBuilder( |
||||
size: 8, |
||||
activeSize: 8, |
||||
space: 5, |
||||
activeColor: Colors.black, |
||||
color: Colors.black.withAlpha(76), |
||||
), |
||||
), |
||||
physics: BouncingScrollPhysics(), |
||||
itemBuilder: (context, position) { |
||||
return Column( |
||||
children: [ |
||||
InkWell( |
||||
onTap: () { |
||||
bannerClick(widget.bannerData[position]); |
||||
}, |
||||
child: |
||||
// MImage( |
||||
// (widget.bannerData != null && |
||||
// position < widget.bannerData.length) |
||||
// ? widget.bannerData[position].imgUrl |
||||
// : "", |
||||
// width:double.infinity, |
||||
// fit: BoxFit.cover, |
||||
// errorSrc: "assets/image/default_2_1.png", |
||||
// fadeSrc: "assets/image/default_2_1.png", |
||||
// ), |
||||
Image.asset( |
||||
"assets/image/icon_story_td.png", |
||||
height:185, |
||||
width:double.infinity, |
||||
fit: BoxFit.cover, |
||||
), |
||||
), |
||||
// Expanded(child: child) |
||||
Container( |
||||
height: 138, |
||||
decoration: BoxDecoration( |
||||
color: Colors.white, |
||||
borderRadius: BorderRadius.vertical(bottom: Radius.circular(8)), |
||||
), |
||||
child: ListView.builder( |
||||
scrollDirection: Axis.horizontal, |
||||
physics: BouncingScrollPhysics(), |
||||
padding: EdgeInsets.symmetric(horizontal: 12), |
||||
itemCount: 4, |
||||
itemBuilder: (context, position) { |
||||
return GestureDetector( |
||||
onTap: () { |
||||
Navigator.of(context).pushNamed( |
||||
'/router/shopping_goods_details', |
||||
arguments: {}, |
||||
); |
||||
}, |
||||
child: activityBannerItem(), |
||||
); |
||||
}, |
||||
), |
||||
), |
||||
], |
||||
); |
||||
}, |
||||
itemCount: |
||||
(widget.bannerData != null && widget.bannerData.length > 0) |
||||
? widget.bannerData.length |
||||
: 1), |
||||
), |
||||
); |
||||
} |
||||
|
||||
Widget activityBannerItem() { |
||||
return Container( |
||||
margin: EdgeInsets.only(right:7.w,left:7.w), |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.center, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
// MImage( |
||||
// "assets/image/icon_story_td.png", |
||||
// isCircle: true, |
||||
// width: 70.w, |
||||
// height: 70.h, |
||||
// fit: BoxFit.cover, |
||||
// errorSrc: "assets/image/default_1.png", |
||||
// fadeSrc: "assets/image/default_1.png", |
||||
// ), |
||||
Image.asset( |
||||
"assets/image/icon_story_td.png", |
||||
width: 70, |
||||
height: 70, |
||||
fit: BoxFit.cover, |
||||
), |
||||
SizedBox( |
||||
height: 4, |
||||
), |
||||
Text( |
||||
"[一心回乡]甄果", |
||||
style: TextStyle( |
||||
fontSize: 10.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFF353535), |
||||
), |
||||
), |
||||
Text.rich( |
||||
TextSpan( |
||||
children: [ |
||||
TextSpan( |
||||
text: "¥", |
||||
style: TextStyle( |
||||
fontSize: 10.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFF32A060), |
||||
), |
||||
), |
||||
TextSpan( |
||||
text: "12.60", |
||||
style: TextStyle( |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color: Color(0xFF32A060), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
/// contentType 跳转类型(0:不跳转,1:积分商品,2:活动,3:文章,4:页面跳转,5:课程) |
||||
bannerClick(BannerData bannerData) async { |
||||
switch (bannerData.contentType) { |
||||
case 1: |
||||
Navigator.of(context).pushNamed('/router/integral_store_page', |
||||
arguments: {"goodsId": bannerData.content}); |
||||
break; |
||||
case 2: |
||||
Navigator.of(context).pushNamed('/router/web_page', arguments: { |
||||
"activityId": bannerData.content, |
||||
}); |
||||
break; |
||||
case 3: |
||||
Navigator.of(context).pushNamed('/router/web_page', arguments: { |
||||
"articleId": bannerData.content, |
||||
}); |
||||
break; |
||||
case 4: |
||||
String router = bannerData.content; |
||||
if (router.contains("?")) { |
||||
String params = router.substring(router.indexOf("?")); |
||||
params = params.replaceAll("?", ""); |
||||
Map map = jsonDecode(params); |
||||
Navigator.of(context).pushNamed(router, arguments: map); |
||||
} else { |
||||
Navigator.of(context).pushNamed(router); |
||||
} |
||||
break; |
||||
case 5: |
||||
Navigator.of(context).pushNamed('/router/class_details', arguments: { |
||||
"id": bannerData.content, |
||||
}); |
||||
break; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,753 @@
|
||||
import 'package:flutter/cupertino.dart'; |
||||
import 'package:flutter/material.dart'; |
||||
import 'package:flutter_swiper/flutter_swiper.dart'; |
||||
import 'package:huixiang/retrofit/retrofit_api.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_appbar.dart'; |
||||
import 'package:pull_to_refresh/pull_to_refresh.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
|
||||
class BargainDetails extends StatefulWidget { |
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _BargainDetails(); |
||||
} |
||||
} |
||||
|
||||
class _BargainDetails extends State<BargainDetails> { |
||||
ApiService apiService; |
||||
|
||||
@override |
||||
void initState() { |
||||
super.initState(); |
||||
} |
||||
|
||||
final SwiperController controller = SwiperController(); |
||||
|
||||
@override |
||||
void dispose() { |
||||
super.dispose(); |
||||
if (refreshController != null) refreshController.dispose(); |
||||
} |
||||
|
||||
final RefreshController refreshController = RefreshController(); |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Stack( |
||||
children: [ |
||||
Container( |
||||
color: Color(0xFFF7F7F7), |
||||
), |
||||
Stack( |
||||
children: [ |
||||
Container( |
||||
height: 330.h, |
||||
decoration: BoxDecoration( |
||||
gradient: new LinearGradient( |
||||
begin: Alignment.centerRight, |
||||
end: Alignment.centerLeft, |
||||
colors: [ |
||||
Color(0xFFE8F5E9), |
||||
Color(0xFFE5F7FF), |
||||
]), |
||||
), |
||||
), |
||||
Column( |
||||
children: [ |
||||
MyAppBar( |
||||
title: "砍价详情", |
||||
titleColor: Colors.black, |
||||
leadingColor: Colors.black, |
||||
background: Colors.transparent, |
||||
), |
||||
Expanded( |
||||
child: Container( |
||||
child: SmartRefresher( |
||||
controller: refreshController, |
||||
enablePullDown: true, |
||||
enablePullUp: false, |
||||
header: MyHeader(), |
||||
physics: BouncingScrollPhysics(), |
||||
onRefresh: () { |
||||
setState(() {}); |
||||
}, |
||||
child: SingleChildScrollView( |
||||
physics: NeverScrollableScrollPhysics(), |
||||
child: FutureBuilder( |
||||
// future: queryHome(), |
||||
builder: (context, snapshot) { |
||||
return Column( |
||||
children: [ |
||||
bargainGoodsInfo(), |
||||
bargainProgress(), |
||||
bargainRule(), |
||||
bargainFriendsList(), |
||||
], |
||||
); |
||||
}, |
||||
), |
||||
), |
||||
), |
||||
), |
||||
), |
||||
], |
||||
) |
||||
], |
||||
), |
||||
], |
||||
); |
||||
} |
||||
|
||||
///商品信息b |
||||
Widget bargainGoodsInfo() { |
||||
return Container( |
||||
width: double.infinity, |
||||
decoration: BoxDecoration( |
||||
borderRadius: BorderRadius.circular(8), |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(12), |
||||
offset: Offset(0, 3), |
||||
blurRadius: 14, |
||||
spreadRadius: 0, |
||||
) |
||||
], |
||||
color: Colors.white), |
||||
margin: EdgeInsets.only(left: 16.w, right: 16.w, top: 24.h), |
||||
padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h), |
||||
child: Row( |
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
ClipRRect( |
||||
borderRadius: BorderRadius.circular(2), |
||||
child: Image.asset( |
||||
"assets/image/icon_story_td.png", |
||||
width: 85, |
||||
height: 85, |
||||
fit: BoxFit.cover, |
||||
), |
||||
), |
||||
// MImage( |
||||
// "", |
||||
// width: double.infinity, |
||||
// height: 166, |
||||
// fit: BoxFit.cover, |
||||
// errorSrc: "assets/image/default_1.png", |
||||
// fadeSrc: "assets/image/default_1.png", |
||||
// ), |
||||
SizedBox( |
||||
width: 10, |
||||
), |
||||
Expanded( |
||||
child: Container( |
||||
height: 85, |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.spaceAround, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Text( |
||||
"[生态小农]山林放养鸡蛋30枚/盒备份 2", |
||||
maxLines: 2, |
||||
overflow: TextOverflow.ellipsis, |
||||
style: TextStyle( |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
color: Color(0xFF353535), |
||||
), |
||||
), |
||||
Text( |
||||
"套盒装", |
||||
style: TextStyle( |
||||
fontSize: 10.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFF727272), |
||||
), |
||||
), |
||||
Text.rich( |
||||
TextSpan( |
||||
children: [ |
||||
TextSpan( |
||||
text: "¥", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color: Color(0xFF9476F7), |
||||
), |
||||
), |
||||
TextSpan( |
||||
text: "284.00", |
||||
style: TextStyle( |
||||
fontSize: 16.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color: Color(0xFF9476F7), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
], |
||||
), |
||||
)) |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
///砍价进度 |
||||
Widget bargainProgress() { |
||||
return Container( |
||||
width: double.infinity, |
||||
decoration: BoxDecoration( |
||||
borderRadius: BorderRadius.circular(8), |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(12), |
||||
offset: Offset(0, 3), |
||||
blurRadius: 14, |
||||
spreadRadius: 0, |
||||
) |
||||
], |
||||
color: Colors.white), |
||||
margin: EdgeInsets.only(left: 16.w, right: 16.w, top: 24.h), |
||||
padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h), |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.center, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
Container(margin: EdgeInsets.only(left: 10),child: |
||||
Stack( |
||||
alignment: Alignment.bottomLeft, |
||||
children: [ |
||||
Container( |
||||
alignment: Alignment.center, |
||||
width:67, |
||||
height:23.h, |
||||
decoration: BoxDecoration( |
||||
borderRadius: BorderRadius.circular(4), |
||||
color: Color(0xFF9476F7), |
||||
), |
||||
child: Text( |
||||
"砍价成功", |
||||
style: TextStyle( |
||||
fontSize: 10.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Colors.white, |
||||
), |
||||
), |
||||
), |
||||
Align( |
||||
alignment: Alignment.bottomLeft, |
||||
child: |
||||
Container(height:8,child: Icon( |
||||
Icons.arrow_drop_down, |
||||
color: Color(0xFF9476F7), |
||||
size: 18, |
||||
),), |
||||
), |
||||
], |
||||
),), |
||||
SizedBox(height:10), |
||||
ClipRRect( |
||||
borderRadius: BorderRadius.circular(6.5), |
||||
child: |
||||
Stack( |
||||
children: [ |
||||
Container( |
||||
width:double.infinity, |
||||
height: 8.h, |
||||
color: Color(0xFFF5F5F5), |
||||
), |
||||
Container( |
||||
width: 100.w, |
||||
height: 8.h, |
||||
decoration: BoxDecoration( |
||||
gradient: LinearGradient( |
||||
begin: Alignment.centerLeft, |
||||
end: Alignment.centerRight, |
||||
colors: [Color(0xFFFEC401), Color(0xFF9274F7)])), |
||||
) |
||||
], |
||||
)), |
||||
SizedBox(height: 3,), |
||||
Row( |
||||
children: [ |
||||
Expanded(child:Text( |
||||
"原价¥284.00", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFF8D8D8D), |
||||
), |
||||
),), |
||||
Text.rich( |
||||
TextSpan( |
||||
children: [ |
||||
TextSpan( |
||||
text: "最低价¥", |
||||
style: TextStyle( |
||||
fontSize:9.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFF9476F7), |
||||
), |
||||
), |
||||
TextSpan( |
||||
text: "284.00", |
||||
style: TextStyle( |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color: Color(0xFF9476F7), |
||||
), |
||||
), |
||||
|
||||
], |
||||
), |
||||
), |
||||
], |
||||
), |
||||
SizedBox(height:16), |
||||
Row(children: [ |
||||
Expanded(child: GestureDetector( |
||||
child:Container( |
||||
alignment: Alignment.center, |
||||
width:double.infinity, |
||||
height:54.h, |
||||
margin: EdgeInsets.only(left:6.w), |
||||
decoration: BoxDecoration( |
||||
borderRadius: BorderRadius.circular(27), |
||||
border: Border.all( |
||||
width: 1, |
||||
color: Color(0xFF9476F7), |
||||
style: BorderStyle.solid, |
||||
), |
||||
), |
||||
child: Text( |
||||
"我也要砍", |
||||
style: TextStyle( |
||||
fontSize: 16.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
color: Color(0xFF9476F7), |
||||
), |
||||
), |
||||
), |
||||
)), |
||||
// Expanded(child:GestureDetector( |
||||
// child: Container( |
||||
// alignment: Alignment.center, |
||||
// width:double.infinity, |
||||
// height:54.h, |
||||
// margin: EdgeInsets.only(left:6.w), |
||||
// decoration: BoxDecoration( |
||||
// color: Color(0xFF9476F7), |
||||
// borderRadius: BorderRadius.circular(27), |
||||
// boxShadow: [ |
||||
// BoxShadow( |
||||
// color: Colors.black.withAlpha(12), |
||||
// offset: Offset(0, 3), |
||||
// blurRadius: 14, |
||||
// spreadRadius: 0, |
||||
// ), |
||||
// ], |
||||
// ), |
||||
// child: Text( |
||||
// "帮他砍价", |
||||
// style: TextStyle( |
||||
// fontSize: 16.sp, |
||||
// fontWeight: MyFontWeight.medium, |
||||
// color: Colors.white, |
||||
// ), |
||||
// ), |
||||
// ) |
||||
// ),), |
||||
Expanded(child:GestureDetector( |
||||
child: Container( |
||||
alignment: Alignment.center, |
||||
width:double.infinity, |
||||
height:54.h, |
||||
margin: EdgeInsets.only(left:6.w), |
||||
decoration: BoxDecoration( |
||||
color: Color(0xFFE5E5E5), |
||||
borderRadius: BorderRadius.circular(27), |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(12), |
||||
offset: Offset(0, 3), |
||||
blurRadius: 14, |
||||
spreadRadius: 0, |
||||
), |
||||
], |
||||
), |
||||
child: Text( |
||||
"已帮TA砍价", |
||||
style: TextStyle( |
||||
fontSize: 16.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
color: Color(0xFF858585), |
||||
), |
||||
), |
||||
) |
||||
),), |
||||
],), |
||||
// Container( |
||||
// alignment: Alignment.center, |
||||
// width:double.infinity, |
||||
// height:54.h, |
||||
// margin: EdgeInsets.only(left:6.w), |
||||
// decoration: BoxDecoration( |
||||
// borderRadius: BorderRadius.circular(27), |
||||
// color: Color(0xFF9476F7), |
||||
// ), |
||||
// child: Row( |
||||
// mainAxisAlignment: MainAxisAlignment.center, |
||||
// crossAxisAlignment: CrossAxisAlignment.center, |
||||
// children: [ |
||||
// Image.asset( |
||||
// "assets/image/wx.png", |
||||
// width:24, |
||||
// height:24, |
||||
// fit: BoxFit.cover, |
||||
// ), |
||||
// SizedBox( |
||||
// width:8, |
||||
// ), |
||||
// Text( |
||||
// "邀请微信好友一起拼团", |
||||
// style: TextStyle( |
||||
// fontSize: 16.sp, |
||||
// fontWeight: MyFontWeight.medium, |
||||
// color: Colors.white, |
||||
// ), |
||||
// ) |
||||
// ], |
||||
// ) |
||||
// ) |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
///砍价规则 |
||||
Widget bargainRule() { |
||||
return Container( |
||||
width: double.infinity, |
||||
decoration: BoxDecoration( |
||||
borderRadius: BorderRadius.circular(8), |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(12), |
||||
offset: Offset(0, 3), |
||||
blurRadius: 14, |
||||
spreadRadius: 0, |
||||
) |
||||
], |
||||
color: Colors.white), |
||||
margin: EdgeInsets.only(left: 16.w, right: 16.w, top: 24.h), |
||||
padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h), |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Row( |
||||
mainAxisAlignment: MainAxisAlignment.center, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
Container( |
||||
width: 3, |
||||
height: 3, |
||||
margin: EdgeInsets.only(right: 10), |
||||
decoration: BoxDecoration( |
||||
color: Color(0xFF9476F7), |
||||
borderRadius: BorderRadius.all(Radius.circular(5))), |
||||
), |
||||
Container( |
||||
width: 5, |
||||
height: 5, |
||||
margin: EdgeInsets.only(right: 10), |
||||
decoration: BoxDecoration( |
||||
color: Color(0xFF9476F7), |
||||
borderRadius: BorderRadius.all(Radius.circular(5))), |
||||
), |
||||
Container( |
||||
width: 8, |
||||
height: 8, |
||||
margin: EdgeInsets.only(right: 4), |
||||
decoration: BoxDecoration( |
||||
color: Color(0xFF9476F7), |
||||
borderRadius: BorderRadius.all(Radius.circular(5))), |
||||
), |
||||
Text( |
||||
"砍价规则", |
||||
style: TextStyle( |
||||
fontSize:15.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color: Colors.black, |
||||
), |
||||
), |
||||
Container( |
||||
width: 8, |
||||
height: 8, |
||||
margin: EdgeInsets.only(right: 10, left: 4), |
||||
decoration: BoxDecoration( |
||||
color: Color(0xFF9476F7), |
||||
borderRadius: BorderRadius.all(Radius.circular(5))), |
||||
), |
||||
Container( |
||||
width: 5, |
||||
height: 5, |
||||
margin: EdgeInsets.only(right: 10), |
||||
decoration: BoxDecoration( |
||||
color: Color(0xFF9476F7), |
||||
borderRadius: BorderRadius.all(Radius.circular(5))), |
||||
), |
||||
Container( |
||||
width: 3, |
||||
height: 3, |
||||
decoration: BoxDecoration( |
||||
color: Color(0xFF9476F7), |
||||
borderRadius: BorderRadius.all(Radius.circular(5))), |
||||
), |
||||
], |
||||
), |
||||
SizedBox( |
||||
height: 12, |
||||
), |
||||
Text( |
||||
"1.选择自己喜欢的商品,邀请好友砍价,每次砍价金额以页面显示为主,邀请的越多,砍价成功的几率越高。", |
||||
style: TextStyle( |
||||
color: Color(0xFF4C4C4C), |
||||
fontSize:12.sp, |
||||
height: 1.5, |
||||
fontWeight: MyFontWeight.medium, |
||||
), |
||||
), |
||||
Text( |
||||
"2.砍价成功后,点击立即购买,将以最终价格进行结算。", |
||||
style: TextStyle( |
||||
color: Color(0xFF4C4C4C), |
||||
fontSize:12.sp, |
||||
height: 1.5, |
||||
fontWeight: MyFontWeight.medium, |
||||
), |
||||
), |
||||
Text( |
||||
"3.砍价商品不享受平台活动,优惠券以及会员折扣。", |
||||
style: TextStyle( |
||||
color: Color(0xFF4C4C4C), |
||||
fontSize:12.sp, |
||||
height: 1.5, |
||||
fontWeight: MyFontWeight.medium, |
||||
), |
||||
), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
///砍价好友榜 |
||||
Widget bargainFriendsList() { |
||||
return Container( |
||||
width: double.infinity, |
||||
decoration: BoxDecoration( |
||||
borderRadius: BorderRadius.circular(8), |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(12), |
||||
offset: Offset(0, 3), |
||||
blurRadius: 14, |
||||
spreadRadius: 0, |
||||
) |
||||
], |
||||
color: Colors.white), |
||||
margin: EdgeInsets.only(left: 16.w, right: 16.w, top: 24.h), |
||||
padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h), |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.center, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
Row( |
||||
mainAxisAlignment: MainAxisAlignment.center, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
Container( |
||||
width: 3, |
||||
height: 3, |
||||
margin: EdgeInsets.only(right: 10), |
||||
decoration: BoxDecoration( |
||||
color: Color(0xFF9476F7), |
||||
borderRadius: BorderRadius.all(Radius.circular(5))), |
||||
), |
||||
Container( |
||||
width: 5, |
||||
height: 5, |
||||
margin: EdgeInsets.only(right: 10), |
||||
decoration: BoxDecoration( |
||||
color: Color(0xFF9476F7), |
||||
borderRadius: BorderRadius.all(Radius.circular(5))), |
||||
), |
||||
Container( |
||||
width: 8, |
||||
height: 8, |
||||
margin: EdgeInsets.only(right: 4), |
||||
decoration: BoxDecoration( |
||||
color: Color(0xFF9476F7), |
||||
borderRadius: BorderRadius.all(Radius.circular(5))), |
||||
), |
||||
Text( |
||||
"好友砍价榜", |
||||
style: TextStyle( |
||||
fontSize:15.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color: Colors.black, |
||||
), |
||||
), |
||||
Container( |
||||
width: 8, |
||||
height: 8, |
||||
margin: EdgeInsets.only(right: 10, left: 4), |
||||
decoration: BoxDecoration( |
||||
color: Color(0xFF9476F7), |
||||
borderRadius: BorderRadius.all(Radius.circular(5))), |
||||
), |
||||
Container( |
||||
width: 5, |
||||
height: 5, |
||||
margin: EdgeInsets.only(right: 10), |
||||
decoration: BoxDecoration( |
||||
color: Color(0xFF9476F7), |
||||
borderRadius: BorderRadius.all(Radius.circular(5))), |
||||
), |
||||
Container( |
||||
width: 3, |
||||
height: 3, |
||||
decoration: BoxDecoration( |
||||
color: Color(0xFF9476F7), |
||||
borderRadius: BorderRadius.all(Radius.circular(5))), |
||||
), |
||||
], |
||||
), |
||||
SizedBox( |
||||
height:20, |
||||
), |
||||
Container( |
||||
alignment: Alignment.center, |
||||
width: double.infinity, |
||||
child: ListView.builder( |
||||
shrinkWrap: true, |
||||
padding: EdgeInsets.zero, |
||||
scrollDirection: Axis.vertical, |
||||
physics: BouncingScrollPhysics(), |
||||
itemCount: 3, |
||||
itemBuilder: (context, position) { |
||||
return GestureDetector( |
||||
onTap: () {}, |
||||
child: bargainFriendsItem(), |
||||
); |
||||
}, |
||||
), |
||||
// (coupons != null && coupons.length > 0) |
||||
// ? ListView.builder( |
||||
// padding: EdgeInsets.symmetric(vertical: 8.h), |
||||
// itemBuilder: (context, position) { |
||||
// return GestureDetector( |
||||
// onTap: () { |
||||
// Navigator.of(context).pushNamed( |
||||
// '/router/vip_details_page', |
||||
// arguments: {"id": coupons[position].id}); |
||||
// }, |
||||
// child: vipCardItem(coupons[position]), |
||||
// ); |
||||
// }, |
||||
// itemCount: coupons != null ? coupons.length : 0, |
||||
// ) |
||||
// : NoDataView( |
||||
// isShowBtn: false, |
||||
// text: "暂无好友帮忙砍价~", |
||||
// fontSize: 16.sp, |
||||
// margin: EdgeInsets.only(top: 120.h), |
||||
// ), |
||||
), |
||||
SizedBox( |
||||
height:20, |
||||
), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
Widget bargainFriendsItem() { |
||||
return Container( |
||||
height: 36.h, |
||||
margin: EdgeInsets.only(bottom:10), |
||||
child:Row( |
||||
mainAxisAlignment: MainAxisAlignment.spaceAround, |
||||
crossAxisAlignment: CrossAxisAlignment.end, |
||||
children: [ |
||||
// MImage( |
||||
// "", |
||||
// width:34, |
||||
// height:34, |
||||
// fit: BoxFit.cover, |
||||
// isCircle: true, |
||||
// errorSrc: "assets/image/default_1.png", |
||||
// fadeSrc: "assets/image/default_1.png", |
||||
// ), |
||||
Image.asset( |
||||
"assets/image/icon_story_td.png", |
||||
width: 34, |
||||
height: 34, |
||||
fit: BoxFit.cover, |
||||
), |
||||
SizedBox(width: 4,), |
||||
Expanded(child:Column( |
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Text( |
||||
"张三", |
||||
style: TextStyle( |
||||
fontSize:12.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
color: Color(0xFF353535), |
||||
), |
||||
), |
||||
Text( |
||||
"3分钟前", |
||||
style: TextStyle( |
||||
fontSize:10.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFFACACAC), |
||||
), |
||||
), |
||||
], |
||||
)), |
||||
Text.rich( |
||||
TextSpan( |
||||
children: [ |
||||
TextSpan( |
||||
text: "已砍", |
||||
style: TextStyle( |
||||
fontSize: 11.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFF353535), |
||||
), |
||||
), |
||||
TextSpan( |
||||
text: "23.00元", |
||||
style: TextStyle( |
||||
fontSize:11.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFF9476F7), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
], |
||||
) |
||||
); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,97 @@
|
||||
import 'package:flutter/cupertino.dart'; |
||||
import 'package:flutter/material.dart'; |
||||
import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'; |
||||
import 'package:huixiang/retrofit/retrofit_api.dart'; |
||||
import 'package:huixiang/utils/font_weight.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
|
||||
class ClassifyList extends StatefulWidget { |
||||
|
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _ClassifyList(); |
||||
} |
||||
} |
||||
|
||||
class _ClassifyList extends State<ClassifyList> { |
||||
ApiService apiService; |
||||
BMFCoordinate latLng; |
||||
|
||||
final TextEditingController editingController = TextEditingController(); |
||||
|
||||
@override |
||||
void initState() { |
||||
super.initState(); |
||||
} |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Container( |
||||
height: 100.h, |
||||
margin: EdgeInsets.only(top:12.h,left: 16.w,right: 16.w), |
||||
padding: EdgeInsets.only(bottom: 3.h, top: 16.h,), |
||||
decoration: BoxDecoration( |
||||
borderRadius: BorderRadius.circular(8), |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(12), |
||||
offset: Offset(0, 3), |
||||
blurRadius: 14, |
||||
spreadRadius: 0, |
||||
), |
||||
], |
||||
color: Colors.white, |
||||
), |
||||
child: ListView.builder( |
||||
scrollDirection: Axis.horizontal, |
||||
physics: BouncingScrollPhysics(), |
||||
padding: EdgeInsets.symmetric(horizontal: 14), |
||||
itemCount:15, |
||||
itemBuilder: (context, position) { |
||||
return GestureDetector( |
||||
onTap: () { |
||||
Navigator.of(context) |
||||
.pushNamed('/router/search_page'); |
||||
}, |
||||
child: classifyItem(), |
||||
); |
||||
}, |
||||
), |
||||
); |
||||
} |
||||
|
||||
Widget classifyItem() { |
||||
return Container( |
||||
// height:94.h, |
||||
margin: EdgeInsets.only(right: 19.w), |
||||
child: Column( |
||||
children: [ |
||||
// MImage( |
||||
// "assets/image/icon_story_td.png", |
||||
// isCircle: true, |
||||
// width: 48.w, |
||||
// height: 48.h, |
||||
// fit: BoxFit.cover, |
||||
// errorSrc: "assets/image/default_1.png", |
||||
// fadeSrc: "assets/image/default_1.png", |
||||
// ), |
||||
Image.asset( |
||||
"assets/image/icon_story_td.png", |
||||
width: 48, |
||||
height: 48, |
||||
fit: BoxFit.cover, |
||||
), |
||||
SizedBox(height: 4,), |
||||
Text( |
||||
"时令水果", |
||||
style: TextStyle( |
||||
fontSize: 11.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFF1A1A1A), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
} |
@ -0,0 +1,888 @@
|
||||
import 'package:flutter/cupertino.dart'; |
||||
import 'package:flutter/material.dart'; |
||||
import 'package:flutter_swiper/flutter_swiper.dart'; |
||||
import 'package:huixiang/retrofit/retrofit_api.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_appbar.dart'; |
||||
import 'package:pull_to_refresh/pull_to_refresh.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
|
||||
class GroupDetails extends StatefulWidget { |
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _GroupDetails(); |
||||
} |
||||
} |
||||
|
||||
class _GroupDetails extends State<GroupDetails> { |
||||
ApiService apiService; |
||||
|
||||
@override |
||||
void initState() { |
||||
super.initState(); |
||||
} |
||||
|
||||
final SwiperController controller = SwiperController(); |
||||
|
||||
@override |
||||
void dispose() { |
||||
super.dispose(); |
||||
if (refreshController != null) refreshController.dispose(); |
||||
} |
||||
|
||||
final RefreshController refreshController = RefreshController(); |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Stack( |
||||
children: [ |
||||
Container( |
||||
color: Color(0xFFF7F7F7), |
||||
), |
||||
Stack( |
||||
children: [ |
||||
Container( |
||||
height: 330.h, |
||||
decoration: BoxDecoration( |
||||
gradient: new LinearGradient( |
||||
begin: Alignment.centerRight, |
||||
end: Alignment.centerLeft, |
||||
colors: [ |
||||
Color(0xFFE8F5E9), |
||||
Color(0xFFE5F7FF), |
||||
]), |
||||
), |
||||
), |
||||
Column( |
||||
children: [ |
||||
MyAppBar( |
||||
title: "拼团详情", |
||||
titleColor: Colors.black, |
||||
leadingColor: Colors.black, |
||||
background: Colors.transparent, |
||||
), |
||||
Expanded( |
||||
child: Container( |
||||
child: SmartRefresher( |
||||
controller: refreshController, |
||||
enablePullDown: true, |
||||
enablePullUp: false, |
||||
header: MyHeader(), |
||||
physics: BouncingScrollPhysics(), |
||||
onRefresh: () { |
||||
setState(() {}); |
||||
}, |
||||
child: SingleChildScrollView( |
||||
physics: NeverScrollableScrollPhysics(), |
||||
child: FutureBuilder( |
||||
// future: queryHome(), |
||||
builder: (context, snapshot) { |
||||
return Column( |
||||
children: [ |
||||
goodsInfo(), |
||||
inviteGroup(), |
||||
groupRule(), |
||||
], |
||||
); |
||||
}, |
||||
), |
||||
), |
||||
), |
||||
), |
||||
), |
||||
], |
||||
) |
||||
], |
||||
), |
||||
], |
||||
); |
||||
} |
||||
|
||||
///商品信息 |
||||
Widget goodsInfo() { |
||||
return Container( |
||||
width: double.infinity, |
||||
decoration: BoxDecoration( |
||||
borderRadius: BorderRadius.circular(8), |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(12), |
||||
offset: Offset(0, 3), |
||||
blurRadius: 14, |
||||
spreadRadius: 0, |
||||
) |
||||
], |
||||
color: Colors.white), |
||||
margin: EdgeInsets.only(left: 16.w, right: 16.w, top: 24.h), |
||||
padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h), |
||||
child: Row( |
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
ClipRRect( |
||||
borderRadius: BorderRadius.circular(2), |
||||
child: Image.asset( |
||||
"assets/image/icon_story_td.png", |
||||
width: 85, |
||||
height: 85, |
||||
fit: BoxFit.cover, |
||||
), |
||||
), |
||||
// MImage( |
||||
// "", |
||||
// width: double.infinity, |
||||
// height: 166, |
||||
// fit: BoxFit.cover, |
||||
// errorSrc: "assets/image/default_1.png", |
||||
// fadeSrc: "assets/image/default_1.png", |
||||
// ), |
||||
SizedBox( |
||||
width: 10, |
||||
), |
||||
Expanded( |
||||
child: Container( |
||||
height: 85, |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.spaceAround, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Text( |
||||
"[生态小农]山林放养鸡蛋30枚/盒备份 2", |
||||
maxLines: 2, |
||||
overflow: TextOverflow.ellipsis, |
||||
style: TextStyle( |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
color: Color(0xFF353535), |
||||
), |
||||
), |
||||
Text( |
||||
"套盒装", |
||||
style: TextStyle( |
||||
fontSize: 10.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFF727272), |
||||
), |
||||
), |
||||
Text.rich( |
||||
TextSpan( |
||||
children: [ |
||||
TextSpan( |
||||
text: "¥", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color: Color(0xFF32A060), |
||||
), |
||||
), |
||||
TextSpan( |
||||
text: "284.00", |
||||
style: TextStyle( |
||||
fontSize: 16.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color: Color(0xFF32A060), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
], |
||||
), |
||||
)) |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
///邀请好友拼团 |
||||
Widget inviteGroup() { |
||||
return Container( |
||||
width: double.infinity, |
||||
decoration: BoxDecoration( |
||||
borderRadius: BorderRadius.circular(8), |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(12), |
||||
offset: Offset(0, 3), |
||||
blurRadius: 14, |
||||
spreadRadius: 0, |
||||
) |
||||
], |
||||
color: Colors.white), |
||||
margin: EdgeInsets.only(left: 16.w, right: 16.w, top: 24.h), |
||||
padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h), |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.center, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
Row( |
||||
mainAxisAlignment: MainAxisAlignment.center, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
Container( |
||||
width: 3, |
||||
height: 3, |
||||
margin: EdgeInsets.only(right: 10), |
||||
decoration: BoxDecoration( |
||||
color: Color(0xFFB8BAC1), |
||||
borderRadius: BorderRadius.all(Radius.circular(5))), |
||||
), |
||||
Container( |
||||
width: 5, |
||||
height: 5, |
||||
margin: EdgeInsets.only(right: 10), |
||||
decoration: BoxDecoration( |
||||
color: Color(0xFFB8BAC1), |
||||
borderRadius: BorderRadius.all(Radius.circular(5))), |
||||
), |
||||
Container( |
||||
width: 8, |
||||
height: 8, |
||||
margin: EdgeInsets.only(right: 4), |
||||
decoration: BoxDecoration( |
||||
color: Color(0xFFB8BAC1), |
||||
borderRadius: BorderRadius.all(Radius.circular(5))), |
||||
), |
||||
Text( |
||||
"拼团剩余时间", |
||||
style: TextStyle( |
||||
fontSize: 18.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color: Colors.black, |
||||
), |
||||
), |
||||
Container( |
||||
width: 8, |
||||
height: 8, |
||||
margin: EdgeInsets.only(right: 10, left: 4), |
||||
decoration: BoxDecoration( |
||||
color: Color(0xFFB8BAC1), |
||||
borderRadius: BorderRadius.all(Radius.circular(5))), |
||||
), |
||||
Container( |
||||
width: 5, |
||||
height: 5, |
||||
margin: EdgeInsets.only(right: 10), |
||||
decoration: BoxDecoration( |
||||
color: Color(0xFFB8BAC1), |
||||
borderRadius: BorderRadius.all(Radius.circular(5))), |
||||
), |
||||
Container( |
||||
width: 3, |
||||
height: 3, |
||||
decoration: BoxDecoration( |
||||
color: Color(0xFFB8BAC1), |
||||
borderRadius: BorderRadius.all(Radius.circular(5))), |
||||
), |
||||
], |
||||
), |
||||
SizedBox( |
||||
height: 12, |
||||
), |
||||
Row( |
||||
mainAxisAlignment: MainAxisAlignment.center, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
InkWell( |
||||
onTap: () {}, |
||||
child: Container( |
||||
width: 27, |
||||
height: 28, |
||||
alignment: Alignment.center, |
||||
decoration: BoxDecoration( |
||||
color: Color(0xFFD2D2D2), |
||||
borderRadius: BorderRadius.circular(4)), |
||||
child: Text( |
||||
"22", |
||||
style: TextStyle( |
||||
color: Colors.white, |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
), |
||||
), |
||||
), |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.only(left: 10, right: 10), |
||||
child: Text( |
||||
":", |
||||
style: TextStyle( |
||||
fontSize: 16.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
color: Color(0xFFD2D2D2), |
||||
), |
||||
)), |
||||
InkWell( |
||||
onTap: () {}, |
||||
child: Container( |
||||
width: 27, |
||||
height: 28, |
||||
alignment: Alignment.center, |
||||
decoration: BoxDecoration( |
||||
color: Color(0xFFD2D2D2), |
||||
borderRadius: BorderRadius.circular(4)), |
||||
child: Text( |
||||
"59", |
||||
style: TextStyle( |
||||
color: Colors.white, |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
), |
||||
), |
||||
), |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.only(left: 10, right: 10), |
||||
child: Text( |
||||
":", |
||||
style: TextStyle( |
||||
fontSize: 16.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
color: Color(0xFFD2D2D2), |
||||
), |
||||
)), |
||||
InkWell( |
||||
onTap: () {}, |
||||
child: Container( |
||||
width: 27, |
||||
height: 28, |
||||
alignment: Alignment.center, |
||||
decoration: BoxDecoration( |
||||
color: Color(0xFFD2D2D2), |
||||
borderRadius: BorderRadius.circular(4)), |
||||
child: Text( |
||||
"59", |
||||
style: TextStyle( |
||||
color: Colors.white, |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
), |
||||
), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
SizedBox( |
||||
height: 24, |
||||
), |
||||
// Text( |
||||
// "恭喜您拼团成功", |
||||
// style: TextStyle( |
||||
// fontSize: 18.sp, |
||||
// fontWeight: MyFontWeight.semi_bold, |
||||
// color: Colors.black, |
||||
// ), |
||||
// ), |
||||
Text.rich( |
||||
TextSpan( |
||||
children: [ |
||||
TextSpan( |
||||
text: "距离拼团成功还差", |
||||
style: TextStyle( |
||||
fontSize: 18.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color: Colors.black, |
||||
), |
||||
), |
||||
TextSpan( |
||||
text: "2", |
||||
style: TextStyle( |
||||
fontSize: 18.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color: Color(0xFFF8961E), |
||||
), |
||||
), |
||||
TextSpan( |
||||
text: "人", |
||||
style: TextStyle( |
||||
fontSize: 18.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color: Colors.black, |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
// Text( |
||||
// "很遗憾,拼团失败", |
||||
// style: TextStyle( |
||||
// fontSize: 18.sp, |
||||
// fontWeight: MyFontWeight.semi_bold, |
||||
// color: Colors.black, |
||||
// ), |
||||
// ), |
||||
SizedBox( |
||||
height: 32, |
||||
), |
||||
Container( |
||||
alignment: Alignment.center, |
||||
width: double.infinity, |
||||
height: 75.h, |
||||
child: ListView.builder( |
||||
shrinkWrap: true, |
||||
padding: EdgeInsets.zero, |
||||
scrollDirection: Axis.horizontal, |
||||
physics: BouncingScrollPhysics(), |
||||
itemCount: 3, |
||||
itemBuilder: (context, position) { |
||||
return GestureDetector( |
||||
onTap: () {}, |
||||
child: groupItem(), |
||||
); |
||||
}, |
||||
), |
||||
), |
||||
SizedBox( |
||||
height:54.h, |
||||
), |
||||
InkWell( |
||||
onTap: () { |
||||
setState(() { |
||||
}); |
||||
}, |
||||
child:Container( |
||||
width:double.infinity, |
||||
height:54.h, |
||||
margin: EdgeInsets.only(bottom: 28), |
||||
alignment: Alignment.center, |
||||
decoration: BoxDecoration( |
||||
color: Color(0xFF00A359), |
||||
borderRadius: BorderRadius.circular(27)), |
||||
child: Text( |
||||
"查看拼团订单", |
||||
style: TextStyle( |
||||
fontSize: 16.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
color: Colors.white, |
||||
), |
||||
)), |
||||
), |
||||
// InkWell( |
||||
// onTap: () { |
||||
// setState(() { |
||||
// }); |
||||
// }, |
||||
// child:Container( |
||||
// width:double.infinity, |
||||
// height:54.h, |
||||
// margin: EdgeInsets.only(bottom: 28), |
||||
// alignment: Alignment.center, |
||||
// decoration: BoxDecoration( |
||||
// color: Color(0xFF00A359), |
||||
// borderRadius: BorderRadius.circular(27)), |
||||
// child: Row( |
||||
// mainAxisAlignment: MainAxisAlignment.center, |
||||
// crossAxisAlignment: CrossAxisAlignment.center, |
||||
// children: [ |
||||
// Image.asset( |
||||
// "assets/image/wx.png", |
||||
// width:24, |
||||
// height:24, |
||||
// fit: BoxFit.cover, |
||||
// ), |
||||
// SizedBox( |
||||
// width:8, |
||||
// ), |
||||
// Text( |
||||
// "邀请微信好友一起拼团", |
||||
// style: TextStyle( |
||||
// fontSize: 16.sp, |
||||
// fontWeight: MyFontWeight.medium, |
||||
// color: Colors.white, |
||||
// ), |
||||
// ) |
||||
// ], |
||||
// )), |
||||
// ), |
||||
// InkWell( |
||||
// onTap: () { |
||||
// setState(() { |
||||
// }); |
||||
// }, |
||||
// child:Container( |
||||
// width:double.infinity, |
||||
// height:54.h, |
||||
// margin: EdgeInsets.only(bottom: 28), |
||||
// alignment: Alignment.center, |
||||
// decoration: BoxDecoration( |
||||
// color: Color(0xFF00A359), |
||||
// borderRadius: BorderRadius.circular(27)), |
||||
// child: Text( |
||||
// "联系客服退款", |
||||
// style: TextStyle( |
||||
// fontSize: 16.sp, |
||||
// fontWeight: MyFontWeight.medium, |
||||
// color: Colors.white, |
||||
// ), |
||||
// )), |
||||
// ), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
Widget groupItem() { |
||||
return Container( |
||||
margin: EdgeInsets.only(right:25), |
||||
child:Row( |
||||
children: [ |
||||
Stack( |
||||
children: [ |
||||
Container( |
||||
alignment: Alignment.center, |
||||
decoration: BoxDecoration( |
||||
borderRadius: BorderRadius.circular(60), |
||||
border: Border.all( |
||||
width: 1, |
||||
color: Color(0xFFF8961E), |
||||
// style: BorderStyle.solid, |
||||
), |
||||
), |
||||
child:MImage( |
||||
"", |
||||
width:60.w, |
||||
height:60.h, |
||||
fit: BoxFit.cover, |
||||
isCircle: true, |
||||
errorSrc: "assets/image/default_1.png", |
||||
fadeSrc: "assets/image/default_1.png", |
||||
), |
||||
), |
||||
Align( |
||||
alignment: Alignment.bottomCenter, |
||||
child:Container( |
||||
width: 60.w, |
||||
child: Container( |
||||
width: 34.w, |
||||
height:14.h, |
||||
alignment: Alignment.center, |
||||
margin: EdgeInsets.only(left:10,right:10), |
||||
decoration: BoxDecoration( |
||||
color: Color(0xFFF8961E), |
||||
borderRadius: BorderRadius.circular(7)), |
||||
child: Text( |
||||
"团长", |
||||
style: TextStyle( |
||||
fontSize:8.sp, |
||||
fontWeight: MyFontWeight.light, |
||||
color: Colors.white, |
||||
), |
||||
)), |
||||
), |
||||
|
||||
) |
||||
], |
||||
), |
||||
// Container( |
||||
// width: 60.w, |
||||
// height: 67.h, |
||||
// child:Image.asset( |
||||
// "assets/image/pin_t.png", |
||||
// width: 60.w, |
||||
// height: 60.h, |
||||
// fit: BoxFit.cover, |
||||
// ), |
||||
// ), |
||||
], |
||||
) |
||||
); |
||||
} |
||||
|
||||
///拼团规则 |
||||
Widget groupRule() { |
||||
return Container( |
||||
width: double.infinity, |
||||
decoration: BoxDecoration( |
||||
borderRadius: BorderRadius.circular(8), |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(12), |
||||
offset: Offset(0, 3), |
||||
blurRadius: 14, |
||||
spreadRadius: 0, |
||||
) |
||||
], |
||||
color: Colors.white), |
||||
margin: EdgeInsets.only(left: 16.w, right: 16.w, top: 24.h,bottom:40.h), |
||||
padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h), |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.spaceAround, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Text( |
||||
"拼团规则", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color: Color(0xFF353535), |
||||
), |
||||
), |
||||
SizedBox(height: 12.h), |
||||
Row( |
||||
mainAxisAlignment: MainAxisAlignment.center, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
Column( |
||||
children: [ |
||||
Row( |
||||
mainAxisAlignment: MainAxisAlignment.spaceAround, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
Image.asset( |
||||
"assets/image/zu_tuan.png", |
||||
width: 42, |
||||
height: 42, |
||||
fit: BoxFit.cover, |
||||
), |
||||
Container( |
||||
width:45, |
||||
child: Flex( |
||||
children: List.generate(8, (_) { |
||||
return SizedBox( |
||||
width: 3, |
||||
height: 1, |
||||
child: DecoratedBox( |
||||
decoration: |
||||
BoxDecoration(color: Color(0xFF32A060)), |
||||
), |
||||
); |
||||
}), |
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
||||
direction: Axis.horizontal, |
||||
), |
||||
), |
||||
], |
||||
), |
||||
SizedBox(height: 8.h), |
||||
Row( |
||||
mainAxisAlignment: MainAxisAlignment.spaceAround, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
Column( |
||||
children: [ |
||||
Text( |
||||
"开团/参团", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFF181818), |
||||
), |
||||
), |
||||
Text( |
||||
"拼团享低价", |
||||
style: TextStyle( |
||||
fontSize: 10.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFF5F5F5F), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
Container( |
||||
width:35, |
||||
child: Flex( |
||||
children: List.generate(0, (_) { |
||||
return SizedBox( |
||||
width: 3, |
||||
height: 1, |
||||
child: DecoratedBox( |
||||
decoration: BoxDecoration(color: Colors.white), |
||||
), |
||||
); |
||||
}), |
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
||||
direction: Axis.horizontal, |
||||
), |
||||
), |
||||
], |
||||
), |
||||
], |
||||
), |
||||
Column( |
||||
children: [ |
||||
Row( |
||||
mainAxisAlignment: MainAxisAlignment.spaceAround, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
Image.asset( |
||||
"assets/image/zt_zf.png", |
||||
width: 42, |
||||
height: 42, |
||||
fit: BoxFit.cover, |
||||
), |
||||
Container( |
||||
width: 45, |
||||
child: Flex( |
||||
children: List.generate(8, (_) { |
||||
return SizedBox( |
||||
width: 3, |
||||
height: 1, |
||||
child: DecoratedBox( |
||||
decoration: |
||||
BoxDecoration(color: Color(0xFF32A060)), |
||||
), |
||||
); |
||||
}), |
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
||||
direction: Axis.horizontal, |
||||
), |
||||
), |
||||
], |
||||
), |
||||
SizedBox(height: 8.h), |
||||
Row( |
||||
mainAxisAlignment: MainAxisAlignment.spaceAround, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
Column( |
||||
children: [ |
||||
Text( |
||||
"成功支付", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFF181818), |
||||
), |
||||
), |
||||
Text( |
||||
"下单可开团", |
||||
style: TextStyle( |
||||
fontSize: 10.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFF5F5F5F), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
Container( |
||||
width: 35, |
||||
child: Flex( |
||||
children: List.generate(0, (_) { |
||||
return SizedBox( |
||||
width: 3, |
||||
height: 1, |
||||
child: DecoratedBox( |
||||
decoration: BoxDecoration(color: Colors.white), |
||||
), |
||||
); |
||||
}), |
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
||||
direction: Axis.horizontal, |
||||
), |
||||
), |
||||
], |
||||
), |
||||
], |
||||
), |
||||
Column( |
||||
children: [ |
||||
Row( |
||||
mainAxisAlignment: MainAxisAlignment.spaceAround, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
Image.asset( |
||||
"assets/image/yq_zt.png", |
||||
width: 42, |
||||
height: 42, |
||||
fit: BoxFit.cover, |
||||
), |
||||
Container( |
||||
width: 45, |
||||
child: Flex( |
||||
children: List.generate(8, (_) { |
||||
return SizedBox( |
||||
width: 3, |
||||
height: 1, |
||||
child: DecoratedBox( |
||||
decoration: |
||||
BoxDecoration(color: Color(0xFF32A060)), |
||||
), |
||||
); |
||||
}), |
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
||||
direction: Axis.horizontal, |
||||
), |
||||
), |
||||
], |
||||
), |
||||
SizedBox(height: 8.h), |
||||
Row( |
||||
mainAxisAlignment: MainAxisAlignment.spaceAround, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
Column( |
||||
children: [ |
||||
Text( |
||||
"邀请参团", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFF181818), |
||||
), |
||||
), |
||||
Text( |
||||
"一起享优惠", |
||||
style: TextStyle( |
||||
fontSize: 10.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFF5F5F5F), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
Container( |
||||
width: 35, |
||||
child: Flex( |
||||
children: List.generate(0, (_) { |
||||
return SizedBox( |
||||
width: 3, |
||||
height: 1, |
||||
child: DecoratedBox( |
||||
decoration: BoxDecoration(color: Colors.white), |
||||
), |
||||
); |
||||
}), |
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
||||
direction: Axis.horizontal, |
||||
), |
||||
), |
||||
], |
||||
) |
||||
], |
||||
), |
||||
Column( |
||||
children: [ |
||||
Image.asset( |
||||
"assets/image/zt_m.png", |
||||
width: 42, |
||||
height: 42, |
||||
fit: BoxFit.cover, |
||||
), |
||||
SizedBox(height: 8.h), |
||||
Text( |
||||
"人满成团", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFF181818), |
||||
), |
||||
), |
||||
Text( |
||||
"人不满退款", |
||||
style: TextStyle( |
||||
fontSize: 10.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFF5F5F5F), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
], |
||||
), |
||||
], |
||||
) |
||||
); |
||||
} |
||||
} |
@ -0,0 +1,214 @@
|
||||
import 'package:flutter/material.dart'; |
||||
import 'package:huixiang/retrofit/retrofit_api.dart'; |
||||
import 'package:huixiang/utils/font_weight.dart'; |
||||
import 'package:huixiang/view_widget/classic_header.dart'; |
||||
import 'package:huixiang/view_widget/my_appbar.dart'; |
||||
import 'package:huixiang/view_widget/my_footer.dart'; |
||||
import 'package:pull_to_refresh/pull_to_refresh.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
|
||||
class GroupPageDetails extends StatefulWidget { |
||||
|
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _GroupPageDetails(); |
||||
} |
||||
} |
||||
|
||||
class _GroupPageDetails extends State<GroupPageDetails> { |
||||
RefreshController refreshController = RefreshController(); |
||||
ApiService apiService; |
||||
int pageNum = 0; |
||||
|
||||
@override |
||||
void initState() { |
||||
super.initState(); |
||||
_onRefresh(); |
||||
} |
||||
|
||||
_onRefresh() async { |
||||
pageNum = 0; |
||||
setState(() {}); |
||||
} |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Container( |
||||
color: Colors.white, |
||||
child: Column( |
||||
children: [ |
||||
MyAppBar( |
||||
title:"可参加的团", |
||||
titleColor: Colors.black, |
||||
leadingColor: Colors.black, |
||||
background: Colors.transparent, |
||||
), |
||||
Expanded( |
||||
child: Container( |
||||
child: SmartRefresher( |
||||
controller: refreshController, |
||||
enablePullDown: true, |
||||
enablePullUp: true, |
||||
header: MyHeader(), |
||||
physics: BouncingScrollPhysics(), |
||||
onRefresh: () { |
||||
setState(() {}); |
||||
}, |
||||
child: SingleChildScrollView( |
||||
physics: NeverScrollableScrollPhysics(), |
||||
child: FutureBuilder( |
||||
// future: queryHome(), |
||||
builder: (context, snapshot) { |
||||
return Column( |
||||
children: [ |
||||
groupList(), |
||||
], |
||||
); |
||||
}, |
||||
), |
||||
), |
||||
), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
///参团列表 |
||||
Widget groupList() { |
||||
return Container( |
||||
height: MediaQuery.of(context).size.height-62.h-MediaQuery.of(context).padding.top, |
||||
padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h), |
||||
child: ListView.builder( |
||||
padding: EdgeInsets.zero, |
||||
itemCount:10, |
||||
scrollDirection: Axis.vertical, |
||||
shrinkWrap: true, |
||||
physics: BouncingScrollPhysics(), |
||||
itemBuilder: (context, position) { |
||||
return GestureDetector( |
||||
onTap: () { |
||||
setState(() {}); |
||||
}, |
||||
child: groupItem(), |
||||
); |
||||
}, |
||||
), |
||||
); |
||||
} |
||||
|
||||
Widget groupItem() { |
||||
return Container( |
||||
height: 44.h, |
||||
margin: EdgeInsets.only(top: 8.h, bottom: 8.h), |
||||
child: Row( |
||||
mainAxisAlignment: MainAxisAlignment.center, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
// MImage( |
||||
// "", |
||||
// width:44, |
||||
// height:44, |
||||
// fit: BoxFit.cover, |
||||
// isCircle: true, |
||||
// errorSrc: "assets/image/default_1.png", |
||||
// fadeSrc: "assets/image/default_1.png", |
||||
// ), |
||||
Image.asset( |
||||
"assets/image/icon_story_td.png", |
||||
width: 44, |
||||
height: 44, |
||||
fit: BoxFit.cover, |
||||
), |
||||
SizedBox(width: 4.w), |
||||
Expanded( |
||||
child: Text( |
||||
"团长名称", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFF4D4D4D), |
||||
), |
||||
)), |
||||
Column( |
||||
mainAxisAlignment: MainAxisAlignment.start, |
||||
crossAxisAlignment: CrossAxisAlignment.end, |
||||
children: [ |
||||
Text.rich( |
||||
TextSpan( |
||||
children: [ |
||||
TextSpan( |
||||
text: "还差:", |
||||
style: TextStyle( |
||||
fontSize: 10.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFF353535), |
||||
), |
||||
), |
||||
TextSpan( |
||||
text: "1", |
||||
style: TextStyle( |
||||
fontSize: 10.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFF32A060), |
||||
), |
||||
), |
||||
TextSpan( |
||||
text: "人", |
||||
style: TextStyle( |
||||
fontSize: 10.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFF353535), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
Text( |
||||
"剩余23:12:12", |
||||
style: TextStyle( |
||||
fontSize: 10.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFF353535), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
Container( |
||||
alignment: Alignment.center, |
||||
width: 53.w, |
||||
height: 22.h, |
||||
margin: EdgeInsets.only(left: 4.w), |
||||
decoration: BoxDecoration( |
||||
borderRadius: BorderRadius.circular(13), |
||||
gradient: new LinearGradient( |
||||
begin: Alignment.centerRight, |
||||
end: Alignment.centerLeft, |
||||
colors: [ |
||||
Color(0xFF61CE6B), |
||||
Color(0xFF32A057), |
||||
]), |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(12), |
||||
offset: Offset(0, 3), |
||||
blurRadius: 14, |
||||
spreadRadius: 0, |
||||
), |
||||
], |
||||
), |
||||
child: Text( |
||||
"去参团", |
||||
style: TextStyle( |
||||
fontSize: 10.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
color: Colors.white, |
||||
), |
||||
), |
||||
) |
||||
], |
||||
), |
||||
); |
||||
} |
||||
} |
@ -0,0 +1,214 @@
|
||||
import 'package:flutter/material.dart'; |
||||
import 'package:huixiang/utils/flutter_utils.dart'; |
||||
import 'package:huixiang/utils/font_weight.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
|
||||
class RecommendGoodsListView extends StatefulWidget { |
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _RecommendGoodsListView(); |
||||
} |
||||
} |
||||
|
||||
class _RecommendGoodsListView extends State<RecommendGoodsListView> { |
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Column( |
||||
children: [ |
||||
Text( |
||||
"为你推荐", |
||||
overflow: TextOverflow.ellipsis, |
||||
maxLines: 2, |
||||
style: TextStyle( |
||||
fontSize: 16.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color: Color(0xFF1A1A1A), |
||||
), |
||||
), |
||||
Container( |
||||
color: Color(0xFF32A060), |
||||
width: 35.w, |
||||
height: 5.h, |
||||
), |
||||
GridView.builder( |
||||
itemCount: 6, |
||||
padding: EdgeInsets.only( |
||||
left: 16.w, |
||||
right: 16.w, |
||||
top: 13.h, |
||||
bottom: 16.h, |
||||
), |
||||
shrinkWrap: true, |
||||
physics: NeverScrollableScrollPhysics(), |
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( |
||||
//一行的Widget数量 |
||||
crossAxisCount: 2, |
||||
//水平子Widget之间间距 |
||||
crossAxisSpacing: 11.w, |
||||
//垂直子Widget之间间距 |
||||
mainAxisSpacing: 16.w, |
||||
//子Widget宽高比例 0.59 |
||||
childAspectRatio: |
||||
185 / (281 / 2 + (281 / 2) * AppUtils.textScale(context)), |
||||
), |
||||
itemBuilder: (context, index) { |
||||
return GestureDetector( |
||||
onTap: () { |
||||
Navigator.of(context).pushNamed( |
||||
'/router/shopping_goods_details', |
||||
arguments: {}, |
||||
); |
||||
}, |
||||
child: goodsListItem(), |
||||
); |
||||
}, |
||||
) |
||||
], |
||||
); |
||||
} |
||||
|
||||
Widget goodsListItem() { |
||||
return Container( |
||||
decoration: BoxDecoration( |
||||
borderRadius: BorderRadius.vertical( |
||||
top: Radius.circular(8), |
||||
), |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(10), |
||||
offset: Offset(0, 3), |
||||
blurRadius: 14, |
||||
spreadRadius: 0, |
||||
) |
||||
], |
||||
color: Colors.white, |
||||
), |
||||
margin: EdgeInsets.symmetric( |
||||
vertical: 3, |
||||
), |
||||
child: Column( |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Container( |
||||
decoration: BoxDecoration( |
||||
borderRadius: BorderRadius.circular(8), |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(10), |
||||
offset: Offset(0, 3), |
||||
blurRadius: 14, |
||||
spreadRadius: 0, |
||||
) |
||||
], |
||||
), |
||||
child: |
||||
// MImage( |
||||
// "", |
||||
// width: double.infinity, |
||||
// height: 166, |
||||
// fit: BoxFit.cover, |
||||
// errorSrc: "assets/image/default_1.png", |
||||
// fadeSrc: "assets/image/default_1.png", |
||||
// ), |
||||
Image.asset( |
||||
"assets/image/icon_story_td.png", |
||||
width: double.infinity, |
||||
fit: BoxFit.cover, |
||||
), |
||||
), |
||||
Expanded( |
||||
child: Container( |
||||
padding: EdgeInsets.only(left: 12.w, right: 12.w), |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.spaceAround, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Row( |
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
||||
crossAxisAlignment: CrossAxisAlignment.end, |
||||
children: [ |
||||
Container( |
||||
margin: EdgeInsets.only(top: 8, right: 8), |
||||
padding: EdgeInsets.only(left: 2, right: 2), |
||||
height: 17.h, |
||||
alignment: Alignment.center, |
||||
decoration: BoxDecoration( |
||||
borderRadius: BorderRadius.circular(2), |
||||
color: Color(0xFF5A5A5A), |
||||
), |
||||
child: Text( |
||||
"中国大陆5仓", |
||||
style: TextStyle( |
||||
fontSize: 10.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Colors.white, |
||||
), |
||||
), |
||||
), |
||||
Text( |
||||
"已售12件", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFF5D5D5D), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
Text( |
||||
"SWISSGEAR瑞士军刀联名款马克杯", |
||||
maxLines: 2, |
||||
overflow: TextOverflow.ellipsis, |
||||
style: TextStyle( |
||||
fontSize: 16.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
color: Color(0xFF353535), |
||||
), |
||||
), |
||||
Row( |
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
||||
crossAxisAlignment: CrossAxisAlignment.end, |
||||
children: [ |
||||
Text.rich( |
||||
TextSpan( |
||||
children: [ |
||||
TextSpan( |
||||
text: "¥", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color: Color(0xFF32A060), |
||||
), |
||||
), |
||||
TextSpan( |
||||
text: "284.00", |
||||
style: TextStyle( |
||||
fontSize: 18.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color: Color(0xFF32A060), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
Text( |
||||
"¥283.00", |
||||
style: TextStyle( |
||||
fontSize: 14.sp, |
||||
decoration: TextDecoration.lineThrough, |
||||
decorationColor: Color(0xFF585858), |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFFA2A2A2), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
], |
||||
), |
||||
), |
||||
) |
||||
], |
||||
), |
||||
); |
||||
} |
||||
} |
@ -0,0 +1,607 @@
|
||||
import 'package:dio/dio.dart'; |
||||
import 'package:flutter/material.dart'; |
||||
import 'package:flutter/services.dart'; |
||||
import 'package:flutter_easyloading/flutter_easyloading.dart'; |
||||
import 'package:flutter_html/flutter_html.dart'; |
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; |
||||
import 'package:fluwx/fluwx.dart'; |
||||
import 'package:huixiang/generated/l10n.dart'; |
||||
import 'package:huixiang/retrofit/data/base_data.dart'; |
||||
import 'package:huixiang/retrofit/data/vip_benefit_list.dart'; |
||||
import 'package:huixiang/retrofit/data/vip_rule_details.dart'; |
||||
import 'package:huixiang/retrofit/data/wx_pay.dart'; |
||||
import 'package:huixiang/retrofit/retrofit_api.dart'; |
||||
import 'package:huixiang/utils/flutter_utils.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/icon_text.dart'; |
||||
import 'package:huixiang/view_widget/item_input_widget.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
import 'package:huixiang/view_widget/my_appbar.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 SearchPage extends StatefulWidget { |
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _SearchPage(); |
||||
} |
||||
} |
||||
|
||||
class _SearchPage extends State<SearchPage> { |
||||
ApiService apiService; |
||||
TextEditingController controller = TextEditingController(); |
||||
final RefreshController refreshController = RefreshController(); |
||||
int optionIndex = 0; |
||||
|
||||
@override |
||||
void initState() { |
||||
super.initState(); |
||||
|
||||
SharedPreferences.getInstance().then((value) { |
||||
apiService = ApiService(Dio(), |
||||
context: context, token: value.getString("token"), pay: true); |
||||
}); |
||||
} |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Stack( |
||||
children: [ |
||||
Container( |
||||
decoration: BoxDecoration( |
||||
border: Border.all( |
||||
color: Colors.transparent, |
||||
), |
||||
color: Colors.transparent, |
||||
borderRadius: new BorderRadius.only( |
||||
topLeft: Radius.circular(16), |
||||
topRight: Radius.circular(16), |
||||
), |
||||
), |
||||
), |
||||
Stack( |
||||
children: [ |
||||
Container( |
||||
// padding: EdgeInsets.only(top: 40.h), |
||||
height: 140.h, |
||||
decoration: BoxDecoration( |
||||
gradient: new LinearGradient( |
||||
begin: Alignment.centerRight, |
||||
end: Alignment.centerLeft, |
||||
colors: [ |
||||
Color(0xFFE8F5E9), |
||||
Color(0xFFE5F7FF), |
||||
]), |
||||
), |
||||
), |
||||
Column( |
||||
children: [ |
||||
Container( |
||||
height: 100.h, |
||||
color: Colors.transparent, |
||||
margin: EdgeInsets.only(left: 16.w, right: 16.w, top: 15.h), |
||||
child: Row( |
||||
children: [ |
||||
GestureDetector( |
||||
onTap: (){ |
||||
Navigator.of(context).pop(); |
||||
}, |
||||
child: Icon( |
||||
Icons.arrow_back_ios, |
||||
size: 24, |
||||
color: Colors.black, |
||||
), |
||||
), |
||||
Expanded( |
||||
child: Container( |
||||
height: 30.h, |
||||
margin: EdgeInsets.fromLTRB(0.w, 0, 8.w, 0.h), |
||||
padding: EdgeInsets.fromLTRB(12.w, 7.h, 0, 7.h), |
||||
decoration: BoxDecoration( |
||||
color: Colors.white, |
||||
borderRadius: BorderRadius.circular(18), |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(12), |
||||
offset: Offset(0, 3), |
||||
blurRadius: 14, |
||||
spreadRadius: 0, |
||||
), |
||||
], |
||||
), |
||||
child: GestureDetector( |
||||
onTap: () {}, |
||||
child: Row( |
||||
children: [ |
||||
Icon( |
||||
Icons.search, |
||||
size: 16, |
||||
color: Color(0xFFABACAB), |
||||
), |
||||
SizedBox( |
||||
width: 3.w, |
||||
), |
||||
Text( |
||||
"前进麦味", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFF727272), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
)), |
||||
Container( |
||||
alignment: Alignment.center, |
||||
child: GestureDetector( |
||||
onTap: () {}, |
||||
child: Text( |
||||
"搜索", |
||||
style: TextStyle( |
||||
fontSize: 18.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color: Colors.black, |
||||
), |
||||
), |
||||
), |
||||
), |
||||
], |
||||
)), |
||||
Expanded( |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
border: Border.all( |
||||
width: 0, |
||||
color: Colors.white, |
||||
), |
||||
color: Colors.white, |
||||
borderRadius: new BorderRadius.only( |
||||
topLeft: Radius.circular(8), |
||||
topRight: Radius.circular(8), |
||||
), |
||||
), |
||||
padding: EdgeInsets.only(left: 17.w, top: 16.h,right: 17.w), |
||||
child: SmartRefresher( |
||||
controller: refreshController, |
||||
enablePullDown: true, |
||||
enablePullUp: false, |
||||
header: MyHeader(), |
||||
physics: BouncingScrollPhysics(), |
||||
onRefresh: () { |
||||
setState(() {}); |
||||
}, |
||||
child: SingleChildScrollView( |
||||
physics: NeverScrollableScrollPhysics(), |
||||
child: FutureBuilder( |
||||
// future: queryHome(), |
||||
builder: (context, snapshot) { |
||||
return Column( |
||||
children: [ |
||||
// hotSearch(), |
||||
// historySearch(), |
||||
searchList() |
||||
], |
||||
); |
||||
}, |
||||
), |
||||
), |
||||
), |
||||
), |
||||
), |
||||
], |
||||
) |
||||
], |
||||
), |
||||
], |
||||
); |
||||
} |
||||
|
||||
///热门搜索 |
||||
Widget hotSearch() { |
||||
return Container( |
||||
width: double.infinity, |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Text( |
||||
"热门搜索", |
||||
style: TextStyle( |
||||
fontSize: 15.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color: Color(0xFF181818), |
||||
), |
||||
), |
||||
SizedBox(height: 16.h), |
||||
GridView.builder( |
||||
itemCount: 6, |
||||
shrinkWrap: true, |
||||
padding: EdgeInsets.zero, |
||||
physics: NeverScrollableScrollPhysics(), |
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( |
||||
//一行的Widget数量 |
||||
crossAxisCount: 4, |
||||
//水平子Widget之间间距 |
||||
crossAxisSpacing: 6.w, |
||||
//垂直子Widget之间间距 |
||||
mainAxisSpacing: 12.w, |
||||
//垂直单个子Widget之间间距 |
||||
childAspectRatio: 3 / 1, |
||||
), |
||||
itemBuilder: (context, index) { |
||||
return GestureDetector( |
||||
onTap: () {}, |
||||
child: hotSearchItem(), |
||||
); |
||||
}, |
||||
), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
Widget hotSearchItem() { |
||||
return Container( |
||||
child: Row( |
||||
mainAxisAlignment: MainAxisAlignment.spaceAround, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
RoundButton( |
||||
width: 68.w, |
||||
height: 29.h, |
||||
text: "稻田里的书店", |
||||
textColor: Color(0xFF181818), |
||||
fontWeight: MyFontWeight.regular, |
||||
radius: 4, |
||||
backgroup: Color(0xFFF5F5F5), |
||||
fontSize: 12.sp, |
||||
), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
///历史搜索 |
||||
Widget historySearch() { |
||||
return Container( |
||||
width: double.infinity, |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Row( |
||||
children: [ |
||||
Expanded(child:Text( |
||||
"历史搜索", |
||||
style: TextStyle( |
||||
fontSize: 15.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color: Color(0xFF181818), |
||||
), |
||||
)), |
||||
Image.asset( |
||||
"assets/image/icon_delete.png", |
||||
width: 22.w, |
||||
height:20.h, |
||||
), |
||||
Text( |
||||
"删除", |
||||
style: TextStyle( |
||||
fontSize: 15.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color: Color(0xFF181818), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
|
||||
SizedBox(height: 16.h), |
||||
GridView.builder( |
||||
itemCount: 6, |
||||
shrinkWrap: true, |
||||
padding: EdgeInsets.zero, |
||||
physics: NeverScrollableScrollPhysics(), |
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( |
||||
//一行的Widget数量 |
||||
crossAxisCount: 4, |
||||
//水平子Widget之间间距 |
||||
crossAxisSpacing: 6.w, |
||||
//垂直子Widget之间间距 |
||||
mainAxisSpacing: 12.w, |
||||
//垂直单个子Widget之间间距 |
||||
childAspectRatio: 3 / 1, |
||||
), |
||||
itemBuilder: (context, index) { |
||||
return GestureDetector( |
||||
onTap: () { |
||||
|
||||
}, |
||||
child: historySearchItem(), |
||||
); |
||||
}, |
||||
), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
Widget historySearchItem() { |
||||
return Container( |
||||
child: Row( |
||||
mainAxisAlignment: MainAxisAlignment.spaceAround, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
RoundButton( |
||||
width: 68.w, |
||||
height: 29.h, |
||||
text: "稻田里的书店", |
||||
textColor: Color(0xFF181818), |
||||
fontWeight: MyFontWeight.regular, |
||||
radius: 4, |
||||
backgroup: Color(0xFFF5F5F5), |
||||
fontSize: 12.sp, |
||||
), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
///搜索列表 |
||||
Widget searchList() { |
||||
return Container( |
||||
width: double.infinity, |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Row( |
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
GestureDetector( |
||||
onTap: (){ |
||||
setState(() { |
||||
optionIndex = 0 ; |
||||
}); |
||||
}, |
||||
child: Text( |
||||
"默认推荐", |
||||
style: TextStyle( |
||||
fontSize: optionIndex == 0 ? 15.sp :14.sp, |
||||
fontWeight: optionIndex == 0 ? MyFontWeight.semi_bold : MyFontWeight.regular, |
||||
color: optionIndex == 0 ? Color(0xFF181818) : Color(0xFF4D4D4D), |
||||
), |
||||
), |
||||
), |
||||
GestureDetector( |
||||
onTap: (){ |
||||
setState(() { |
||||
optionIndex = 1 ; |
||||
}); |
||||
}, |
||||
child:Text( |
||||
"销量", |
||||
style: TextStyle( |
||||
fontSize: optionIndex == 1 ? 15.sp :14.sp, |
||||
fontWeight: optionIndex == 1 ? MyFontWeight.semi_bold : MyFontWeight.regular, |
||||
color: optionIndex == 1 ? Color(0xFF181818) : Color(0xFF4D4D4D), |
||||
), |
||||
), |
||||
), |
||||
GestureDetector( |
||||
onTap: (){ |
||||
setState(() { |
||||
optionIndex = 2 ; |
||||
}); |
||||
}, |
||||
child:Row(children: [ |
||||
Text( |
||||
"价格", |
||||
style: TextStyle( |
||||
fontSize: optionIndex == 2 ? 15.sp :14.sp, |
||||
fontWeight: optionIndex == 2 ? MyFontWeight.semi_bold : MyFontWeight.regular, |
||||
color: optionIndex == 2 ? Color(0xFF181818) : Color(0xFF4D4D4D), |
||||
), |
||||
), |
||||
Image.asset( |
||||
"assets/image/jg.png", |
||||
width:16, |
||||
height:16, |
||||
), |
||||
],), |
||||
), |
||||
GestureDetector( |
||||
onTap: (){ |
||||
setState(() { |
||||
optionIndex = 3 ; |
||||
}); |
||||
}, |
||||
child: Text( |
||||
"专区", |
||||
style: TextStyle( |
||||
fontSize: optionIndex == 3 ? 15.sp :14.sp, |
||||
fontWeight: optionIndex == 3 ? MyFontWeight.semi_bold : MyFontWeight.regular, |
||||
color: optionIndex == 3 ? Color(0xFF181818) : Color(0xFF4D4D4D), |
||||
), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
SizedBox(height: 16.h), |
||||
GridView.builder( |
||||
itemCount:6, |
||||
shrinkWrap: true, |
||||
physics: NeverScrollableScrollPhysics(), |
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( |
||||
//一行的Widget数量 |
||||
crossAxisCount:2, |
||||
//水平子Widget之间间距 |
||||
crossAxisSpacing: 11.w, |
||||
//垂直子Widget之间间距 |
||||
mainAxisSpacing: 16.w, |
||||
//子Widget宽高比例 0.59 |
||||
childAspectRatio: |
||||
185 / (281 / 2 + (281 / 2) * AppUtils.textScale(context)), |
||||
), |
||||
itemBuilder: (context, index) { |
||||
return GestureDetector( |
||||
onTap: () { |
||||
Navigator.of(context).pushNamed('/router/shopping_mall_home',arguments: { |
||||
"type" : 1, |
||||
}); |
||||
}, |
||||
child: searchListItem(), |
||||
); |
||||
}, |
||||
) |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
Widget searchListItem() { |
||||
return Container( |
||||
decoration: BoxDecoration( |
||||
borderRadius: BorderRadius.circular(4), |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(10), |
||||
offset: Offset(0, 3), |
||||
blurRadius: 14, |
||||
spreadRadius: 0, |
||||
) |
||||
], |
||||
color: Colors.white, |
||||
), |
||||
margin: EdgeInsets.symmetric( |
||||
vertical: 3, |
||||
), |
||||
child: Column( |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Container( |
||||
decoration: BoxDecoration( |
||||
borderRadius: BorderRadius.circular(4), |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(10), |
||||
offset: Offset(0, 3), |
||||
blurRadius: 14, |
||||
spreadRadius: 0, |
||||
) |
||||
], |
||||
), |
||||
child: |
||||
// MImage( |
||||
// "", |
||||
// width: double.infinity, |
||||
// height: 166, |
||||
// fit: BoxFit.cover, |
||||
// errorSrc: "assets/image/default_1.png", |
||||
// fadeSrc: "assets/image/default_1.png", |
||||
// ), |
||||
Image.asset( |
||||
"assets/image/icon_story_td.png", |
||||
width:double.infinity, |
||||
fit: BoxFit.cover, |
||||
), |
||||
), |
||||
Expanded(child:Container( |
||||
padding: EdgeInsets.only(left:8.w,right:8.w), |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.spaceAround, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Row( |
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
||||
crossAxisAlignment: CrossAxisAlignment.end, |
||||
children: [ |
||||
Container( |
||||
margin: EdgeInsets.only(top: 8, right: 8), |
||||
padding: EdgeInsets.only(left: 2, right: 2), |
||||
height: 17.h, |
||||
alignment: Alignment.center, |
||||
decoration: BoxDecoration( |
||||
borderRadius: BorderRadius.circular(2), |
||||
color: Color(0xFF5A5A5A), |
||||
), |
||||
child: Text( |
||||
"中国大陆5仓", |
||||
style: TextStyle( |
||||
fontSize: 10.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Colors.white, |
||||
), |
||||
), |
||||
), |
||||
Text( |
||||
"已售12件", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFF5D5D5D), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
Text( |
||||
"SWISSGEAR瑞士军刀联名款马克杯", |
||||
maxLines: 2, |
||||
overflow: TextOverflow.ellipsis, |
||||
style: TextStyle( |
||||
fontSize: 16.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
color: Color(0xFF353535), |
||||
), |
||||
), |
||||
Row( |
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
||||
crossAxisAlignment: CrossAxisAlignment.end, |
||||
children: [ |
||||
Text.rich( |
||||
TextSpan( |
||||
children: [ |
||||
TextSpan( |
||||
text: "¥", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color: Color(0xFF32A060), |
||||
), |
||||
), |
||||
TextSpan( |
||||
text: "284.00", |
||||
style: TextStyle( |
||||
fontSize:18.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color: Color(0xFF32A060), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
Text( |
||||
"¥283.00", |
||||
style: TextStyle( |
||||
fontSize:14.sp, |
||||
decoration: TextDecoration.lineThrough, |
||||
decorationColor: Color(0xFF585858), |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFFA2A2A2), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
], |
||||
), |
||||
),) |
||||
], |
||||
), |
||||
); |
||||
} |
||||
} |
@ -0,0 +1,321 @@
|
||||
import 'package:dio/dio.dart'; |
||||
import 'package:flutter/cupertino.dart'; |
||||
import 'package:flutter/material.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/page.dart'; |
||||
import 'package:huixiang/retrofit/retrofit_api.dart'; |
||||
import 'package:huixiang/utils/font_weight.dart'; |
||||
import 'package:huixiang/view_widget/item_title.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
import 'package:shared_preferences/shared_preferences.dart'; |
||||
|
||||
class ShoppingActivity extends StatefulWidget { |
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _ShoppingActivity(); |
||||
} |
||||
} |
||||
|
||||
class _ShoppingActivity extends State<ShoppingActivity> { |
||||
ApiService apiService; |
||||
|
||||
@override |
||||
void initState() { |
||||
super.initState(); |
||||
} |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Column( |
||||
children: [ |
||||
SizedBox( |
||||
height: 10.h, |
||||
), |
||||
Container( |
||||
margin: EdgeInsets.symmetric(horizontal: 9.w), |
||||
child: Row( |
||||
children: [ |
||||
GestureDetector( |
||||
onTap: () { |
||||
Navigator.of(context).pushNamed('/router/activity_prefecture_details'); |
||||
}, |
||||
child: Container( |
||||
margin: EdgeInsets.symmetric(horizontal: 5.w ), |
||||
padding: EdgeInsets.only(left: 12.w), |
||||
width: (MediaQuery.of(context).size.width - 42) / 2, |
||||
height: 195.h, |
||||
decoration: BoxDecoration( |
||||
borderRadius: BorderRadius.circular(8), |
||||
color: Colors.white, |
||||
), |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.spaceAround, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Text( |
||||
"回乡秒杀", |
||||
style: TextStyle( |
||||
fontSize: 15.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
color: Colors.black, |
||||
), |
||||
), |
||||
Text( |
||||
"超多好物,等你来秒", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFF7B7B7B), |
||||
), |
||||
), |
||||
GestureDetector( |
||||
onTap: (){ |
||||
}, |
||||
child: Container( |
||||
height:20.h, |
||||
width: 60.w, |
||||
decoration: BoxDecoration( |
||||
color: Color(0xFF32A060), |
||||
borderRadius: BorderRadius.circular(11.5), |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(12), |
||||
offset: Offset(0, 3), |
||||
blurRadius: 14, |
||||
spreadRadius: 0, |
||||
), |
||||
], |
||||
), |
||||
child: Row( |
||||
mainAxisAlignment: MainAxisAlignment.center, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
Text( |
||||
"10点场", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Colors.white, |
||||
), |
||||
), |
||||
Icon( |
||||
Icons.keyboard_arrow_right, |
||||
size: 16, |
||||
color: Colors.white, |
||||
), |
||||
], |
||||
), |
||||
), |
||||
), |
||||
Padding(padding: EdgeInsets.only(bottom: 10.h),child: |
||||
Image.asset( |
||||
"assets/image/icon_story_td.png", |
||||
width: 87, |
||||
height: 87, |
||||
fit: BoxFit.cover, |
||||
),) |
||||
], |
||||
), |
||||
), |
||||
), |
||||
Expanded( |
||||
child: Container( |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly, |
||||
children: [ |
||||
GestureDetector( |
||||
onTap: () { |
||||
}, |
||||
child: Container( |
||||
margin: EdgeInsets.symmetric(horizontal: 5.w), |
||||
padding: EdgeInsets.only(left: 12.w,right: 11.w), |
||||
width: (MediaQuery.of(context).size.width - 42) / 2, |
||||
height: 195.h / 2, |
||||
decoration: BoxDecoration( |
||||
borderRadius: BorderRadius.circular(8), |
||||
color: Colors.white, |
||||
), |
||||
child: Row( |
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly, |
||||
crossAxisAlignment: CrossAxisAlignment.end, |
||||
children: [ |
||||
Expanded(child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.spaceAround, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Text( |
||||
"好价我砍", |
||||
style: TextStyle( |
||||
fontSize: 15.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
color: Colors.black, |
||||
), |
||||
), |
||||
Text( |
||||
"拉友同优", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFF7B7B7B), |
||||
), |
||||
), |
||||
GestureDetector( |
||||
onTap: (){ |
||||
}, |
||||
child: Container( |
||||
height: 18.h, |
||||
width: 48.w, |
||||
decoration: BoxDecoration( |
||||
color: Color(0xFF32A060), |
||||
borderRadius: BorderRadius.circular(11.5), |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(12), |
||||
offset: Offset(0, 3), |
||||
blurRadius: 14, |
||||
spreadRadius: 0, |
||||
), |
||||
], |
||||
), |
||||
child: Row( |
||||
mainAxisAlignment: MainAxisAlignment.center, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
Text( |
||||
"GO", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Colors.white, |
||||
), |
||||
), |
||||
Icon( |
||||
Icons.keyboard_arrow_right, |
||||
size: 16, |
||||
color: Colors.white, |
||||
), |
||||
], |
||||
), |
||||
), |
||||
), |
||||
], |
||||
),), |
||||
Padding(padding: EdgeInsets.only(bottom: 10.h),child: |
||||
Image.asset( |
||||
"assets/image/icon_story_td.png", |
||||
width: 44, |
||||
height: 44, |
||||
fit: BoxFit.cover, |
||||
),) |
||||
], |
||||
), |
||||
), |
||||
), |
||||
SizedBox( |
||||
height: 5, |
||||
), |
||||
GestureDetector( |
||||
onTap: () { |
||||
}, |
||||
child: Container( |
||||
margin: EdgeInsets.symmetric(horizontal: 5.w), |
||||
padding: EdgeInsets.only(left: 12.w,right: 11.w), |
||||
width: (MediaQuery.of(context).size.width - 42) / 2, |
||||
height: 195.h / 2, |
||||
decoration: BoxDecoration( |
||||
borderRadius: BorderRadius.circular(8), |
||||
color: Colors.white, |
||||
), |
||||
child: Row( |
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly, |
||||
crossAxisAlignment: CrossAxisAlignment.end, |
||||
children: [ |
||||
Expanded(child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.spaceAround, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Text( |
||||
"拼团专场", |
||||
style: TextStyle( |
||||
fontSize: 15.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
color: Colors.black, |
||||
), |
||||
), |
||||
Text( |
||||
"优惠齐享", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFF7B7B7B), |
||||
), |
||||
), |
||||
GestureDetector( |
||||
onTap: (){ |
||||
}, |
||||
child: Container( |
||||
height: 18.h, |
||||
width: 48.w, |
||||
decoration: BoxDecoration( |
||||
color: Color(0xFF32A060), |
||||
borderRadius: BorderRadius.circular(11.5), |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(12), |
||||
offset: Offset(0, 3), |
||||
blurRadius: 14, |
||||
spreadRadius: 0, |
||||
), |
||||
], |
||||
), |
||||
child: Row( |
||||
mainAxisAlignment: MainAxisAlignment.center, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
Text( |
||||
"GO", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Colors.white, |
||||
), |
||||
), |
||||
Icon( |
||||
Icons.keyboard_arrow_right, |
||||
size: 16, |
||||
color: Colors.white, |
||||
), |
||||
], |
||||
), |
||||
), |
||||
), |
||||
], |
||||
),), |
||||
Padding(padding: EdgeInsets.only(bottom: 10.h),child: |
||||
Image.asset( |
||||
"assets/image/icon_story_td.png", |
||||
width: 44, |
||||
height: 44, |
||||
fit: BoxFit.cover, |
||||
),) |
||||
], |
||||
), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
SizedBox( |
||||
height: 28.h, |
||||
), |
||||
], |
||||
); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,120 @@
|
||||
|
||||
import 'dart:convert'; |
||||
|
||||
import 'package:flutter/material.dart'; |
||||
import 'package:flutter_swiper/flutter_swiper.dart'; |
||||
import 'package:huixiang/retrofit/data/banner.dart'; |
||||
import 'package:huixiang/retrofit/data/base_data.dart'; |
||||
import 'package:huixiang/retrofit/data/page.dart'; |
||||
import 'package:huixiang/retrofit/retrofit_api.dart'; |
||||
import 'package:huixiang/view_widget/custom_image.dart'; |
||||
import 'package:pull_to_refresh/pull_to_refresh.dart'; |
||||
|
||||
class ShoppingHomeBanner extends StatefulWidget { |
||||
|
||||
final List<BannerData> bannerData; |
||||
final SwiperController controller; |
||||
|
||||
ShoppingHomeBanner(this.bannerData,this.controller); |
||||
|
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _ShoppingHomeBanner(); |
||||
} |
||||
|
||||
} |
||||
|
||||
class _ShoppingHomeBanner extends State<ShoppingHomeBanner> { |
||||
ApiService apiService; |
||||
final RefreshController refreshController = RefreshController(); |
||||
List<BannerData> bannerData = []; |
||||
|
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Container( |
||||
child: AspectRatio( |
||||
aspectRatio: 2.08, |
||||
child: Swiper( |
||||
viewportFraction: 0.88, |
||||
scale: 0.93, |
||||
pagination: SwiperPagination( |
||||
alignment: Alignment.bottomCenter, |
||||
builder: DotSwiperPaginationBuilder( |
||||
size: 8, |
||||
activeSize: 8, |
||||
space: 5, |
||||
activeColor: Colors.black, |
||||
color: Colors.black.withAlpha(76), |
||||
), |
||||
), |
||||
physics: BouncingScrollPhysics(), |
||||
itemBuilder: (context, position) { |
||||
return InkWell( |
||||
onTap: () { |
||||
bannerClick(widget.bannerData[position]); |
||||
}, |
||||
child: MImage( |
||||
(widget.bannerData != null && position < widget.bannerData.length) |
||||
? widget.bannerData[position].imgUrl |
||||
: "", |
||||
fit: BoxFit.cover, |
||||
radius: BorderRadius.circular(8), |
||||
errorSrc: "assets/image/default_2_1.png", |
||||
fadeSrc: "assets/image/default_2_1.png", |
||||
), |
||||
); |
||||
}, |
||||
itemCount: (widget.bannerData != null && widget.bannerData.length > 0) |
||||
? widget.bannerData.length |
||||
: 1), |
||||
), |
||||
); |
||||
} |
||||
|
||||
/// contentType 跳转类型(0:不跳转,1:积分商品,2:活动,3:文章,4:页面跳转,5:课程) |
||||
bannerClick(BannerData bannerData) async { |
||||
switch (bannerData.contentType) { |
||||
case 1: |
||||
Navigator.of(context).pushNamed('/router/integral_store_page', |
||||
arguments: {"goodsId": bannerData.content}); |
||||
break; |
||||
case 2: |
||||
Navigator.of(context) |
||||
.pushNamed('/router/web_page', arguments: { |
||||
"activityId": bannerData.content, |
||||
}); |
||||
break; |
||||
case 3: |
||||
Navigator.of(context) |
||||
.pushNamed('/router/web_page', arguments: { |
||||
"articleId": bannerData.content, |
||||
}); |
||||
break; |
||||
case 4: |
||||
String router = bannerData.content; |
||||
if (router.contains("?")) { |
||||
String params = router.substring(router.indexOf("?")); |
||||
params = params.replaceAll("?", ""); |
||||
Map map = jsonDecode(params); |
||||
Navigator.of(context).pushNamed(router, arguments: map); |
||||
} else { |
||||
Navigator.of(context).pushNamed(router); |
||||
} |
||||
break; |
||||
case 5: |
||||
Navigator.of(context) |
||||
.pushNamed('/router/class_details', arguments: { |
||||
"id": bannerData.content, |
||||
}); |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,198 @@
|
||||
import 'package:flutter/cupertino.dart'; |
||||
import 'package:flutter/material.dart'; |
||||
import 'package:flutter_swiper/flutter_swiper.dart'; |
||||
import 'package:huixiang/main.dart'; |
||||
import 'package:huixiang/retrofit/data/store_info.dart'; |
||||
import 'package:huixiang/retrofit/retrofit_api.dart'; |
||||
import 'package:huixiang/store/shopping/shopping_home/recommend_goods_list_view.dart'; |
||||
import 'package:huixiang/store/shopping/shopping_home/shopping_acticvity.dart'; |
||||
import 'package:huixiang/utils/event_type.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_appbar.dart'; |
||||
import 'package:pull_to_refresh/pull_to_refresh.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
import 'classify_list.dart'; |
||||
|
||||
class ShoppingHomePage extends StatefulWidget { |
||||
final StoreInfo storeInfo; |
||||
|
||||
ShoppingHomePage(this.storeInfo); |
||||
|
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _ShoppingHomePage(); |
||||
} |
||||
} |
||||
|
||||
class _ShoppingHomePage extends State<ShoppingHomePage> |
||||
with AutomaticKeepAliveClientMixin { |
||||
ApiService apiService; |
||||
|
||||
@override |
||||
void initState() { |
||||
super.initState(); |
||||
} |
||||
|
||||
final SwiperController controller = SwiperController(); |
||||
|
||||
@override |
||||
void dispose() { |
||||
super.dispose(); |
||||
if (refreshController != null) refreshController.dispose(); |
||||
} |
||||
|
||||
final RefreshController refreshController = RefreshController(); |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
super.build(context); |
||||
return Column( |
||||
children: [ |
||||
MyAppBar( |
||||
title: widget?.storeInfo?.storeName ?? "一心回乡商城", |
||||
titleColor: Colors.black, |
||||
leadingColor: Colors.black, |
||||
background: Colors.transparent, |
||||
), |
||||
Expanded( |
||||
child: Container( |
||||
child: SmartRefresher( |
||||
controller: refreshController, |
||||
enablePullDown: true, |
||||
enablePullUp: false, |
||||
header: MyHeader(), |
||||
physics: BouncingScrollPhysics(), |
||||
onRefresh: () { |
||||
setState(() {}); |
||||
}, |
||||
child: SingleChildScrollView( |
||||
physics: NeverScrollableScrollPhysics(), |
||||
child: FutureBuilder( |
||||
// future: queryHome(), |
||||
builder: (context, snapshot) { |
||||
return Column( |
||||
children: [ |
||||
buildSearchItem(), |
||||
|
||||
buildSwiper(), |
||||
|
||||
///分类导航栏 |
||||
// ShoppingTitleTab(), |
||||
|
||||
///分类列表 |
||||
ClassifyList(), |
||||
|
||||
///专区活动 |
||||
ShoppingActivity(), |
||||
|
||||
///严选活动 |
||||
// ActivityBanner(), |
||||
|
||||
///为你推荐 |
||||
RecommendGoodsListView(), |
||||
], |
||||
); |
||||
}, |
||||
), |
||||
), |
||||
), |
||||
), |
||||
), |
||||
SizedBox( |
||||
height: 76.h, |
||||
), |
||||
], |
||||
); |
||||
} |
||||
|
||||
Widget buildSearchItem() { |
||||
return Container( |
||||
height: 36.h, |
||||
margin: EdgeInsets.fromLTRB(16.w, 0, 16.w, 16.h), |
||||
padding: EdgeInsets.fromLTRB(12.w, 6.h, 0, 6.h), |
||||
decoration: BoxDecoration( |
||||
color: Colors.white, |
||||
borderRadius: BorderRadius.circular(18), |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(12), |
||||
offset: Offset(0, 3), |
||||
blurRadius: 14, |
||||
spreadRadius: 0, |
||||
), |
||||
], |
||||
), |
||||
child: GestureDetector( |
||||
onTap: () { |
||||
Navigator.of(context).pushNamed('/router/search_page'); |
||||
}, |
||||
child: Row( |
||||
children: [ |
||||
Icon( |
||||
Icons.search, |
||||
size: 24, |
||||
color: Color(0xFFABACAB), |
||||
), |
||||
SizedBox( |
||||
width: 3.w, |
||||
), |
||||
Text( |
||||
"前进麦味", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFF727272), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
); |
||||
} |
||||
|
||||
Widget buildSwiper() { |
||||
return Container( |
||||
width: double.infinity, |
||||
height: 160.h, |
||||
margin: EdgeInsets.only(left: 16,right: 16), |
||||
decoration: BoxDecoration( |
||||
borderRadius: BorderRadius.circular(8), |
||||
), |
||||
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( |
||||
(widget.storeInfo != null && |
||||
widget.storeInfo.bannerList != null && |
||||
position < widget.storeInfo.bannerList.length) |
||||
? widget.storeInfo.bannerList[position].imgUrl |
||||
: "", |
||||
fit: BoxFit.cover, |
||||
radius: BorderRadius.circular(8), |
||||
errorSrc: "assets/image/default_2_1.png", |
||||
fadeSrc: "assets/image/default_2_1.png", |
||||
), |
||||
); |
||||
}, |
||||
itemCount: (widget.storeInfo != null && widget.storeInfo.bannerList != null) |
||||
? widget.storeInfo.bannerList.length |
||||
: 1, |
||||
), |
||||
); |
||||
} |
||||
|
||||
@override |
||||
bool get wantKeepAlive => true; |
||||
} |
@ -0,0 +1,70 @@
|
||||
import 'package:flutter/material.dart'; |
||||
import 'package:huixiang/generated/l10n.dart'; |
||||
import 'package:huixiang/retrofit/data/category_select_list.dart'; |
||||
import 'package:huixiang/retrofit/data/goods_category.dart'; |
||||
import 'package:huixiang/utils/font_weight.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
import 'package:huixiang/view_widget/my_tab.dart'; |
||||
|
||||
class ShoppingTitleTab extends StatefulWidget { |
||||
final List<CategorySelectList> classSelectList; |
||||
final Function notifyClassSelectList; |
||||
|
||||
ShoppingTitleTab(this.classSelectList,this.notifyClassSelectList); |
||||
|
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _ClassTitleTab(); |
||||
} |
||||
} |
||||
|
||||
class _ClassTitleTab extends State<ShoppingTitleTab> |
||||
with SingleTickerProviderStateMixin { |
||||
TabController tabController; |
||||
|
||||
@override |
||||
void initState() { |
||||
super.initState(); |
||||
|
||||
} |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Container( |
||||
alignment: Alignment.centerLeft, |
||||
child: DefaultTabController( |
||||
length:widget.classSelectList == null |
||||
? 0 |
||||
: widget.classSelectList.length, |
||||
child: TabBar( |
||||
isScrollable: true, |
||||
//可滚动 |
||||
indicatorColor: Color(0xff39B54A), |
||||
labelColor: Color(0xff32A060), |
||||
labelStyle: TextStyle( |
||||
fontSize: 14.sp, |
||||
fontWeight: FontWeight.bold, |
||||
), |
||||
unselectedLabelStyle: TextStyle( |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
), |
||||
controller: tabController, |
||||
//未选中文字颜色 |
||||
unselectedLabelColor: Color(0xff4D4D4D), |
||||
indicatorSize: TabBarIndicatorSize.label, |
||||
onTap: (index){ |
||||
widget.notifyClassSelectList(index); |
||||
}, |
||||
//指示器与文字等宽 |
||||
tabs:widget.classSelectList == null |
||||
? [] |
||||
: widget.classSelectList |
||||
.map((e) => MyTab(text: e.name)) |
||||
.toList(), |
||||
), |
||||
), |
||||
); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,244 @@
|
||||
import 'package:dio/dio.dart'; |
||||
import 'package:flutter/cupertino.dart'; |
||||
import 'package:flutter/material.dart'; |
||||
import 'package:flutter_easyloading/flutter_easyloading.dart'; |
||||
import 'package:flutter_swiper/flutter_swiper.dart'; |
||||
import 'package:huixiang/generated/l10n.dart'; |
||||
import 'package:huixiang/main.dart'; |
||||
import 'package:huixiang/retrofit/data/activity.dart'; |
||||
import 'package:huixiang/retrofit/data/banner.dart'; |
||||
import 'package:huixiang/retrofit/data/base_data.dart'; |
||||
import 'package:huixiang/retrofit/data/brand.dart'; |
||||
import 'package:huixiang/retrofit/data/page.dart'; |
||||
import 'package:huixiang/retrofit/data/store_info.dart'; |
||||
import 'package:huixiang/retrofit/min_api.dart'; |
||||
import 'package:huixiang/retrofit/retrofit_api.dart'; |
||||
import 'package:huixiang/store/shopping/shopping_cart/shopping_cart_page.dart'; |
||||
import 'package:huixiang/store/shopping/shopping_home/shopping_home_page.dart'; |
||||
import 'package:huixiang/utils/event_type.dart'; |
||||
import 'package:huixiang/utils/font_weight.dart'; |
||||
import 'package:pull_to_refresh/pull_to_refresh.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
import 'package:shared_preferences/shared_preferences.dart'; |
||||
|
||||
class ShoppingMallHome extends StatefulWidget { |
||||
final arguments; |
||||
|
||||
ShoppingMallHome({this.arguments}); |
||||
|
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _ShoppingMallHome(); |
||||
} |
||||
} |
||||
|
||||
class _ShoppingMallHome extends State<ShoppingMallHome> |
||||
with AutomaticKeepAliveClientMixin { |
||||
ApiService apiService; |
||||
MinApiService minService; |
||||
List<Brand> brands = []; |
||||
List<BannerData> bannerData = []; |
||||
int choiceIndex = 0; |
||||
bool dialogShowing = false; |
||||
final RefreshController refreshController = RefreshController(); |
||||
final SwiperController controller = SwiperController(); |
||||
String storeId = ""; |
||||
String tenant = ""; |
||||
|
||||
///小程序token |
||||
String minToken; |
||||
StoreInfo storeInfo; |
||||
List<Activity> activitys; |
||||
|
||||
@override |
||||
void initState() { |
||||
super.initState(); |
||||
if (widget.arguments != null) choiceIndex = widget.arguments["type"]; |
||||
|
||||
tenant = widget.arguments["tenant"]; |
||||
storeId = widget.arguments["id"]; |
||||
|
||||
SharedPreferences.getInstance().then((value) { |
||||
minLogin(value); |
||||
queryStoreInfo(); |
||||
}); |
||||
} |
||||
|
||||
/// 小程序登录 |
||||
minLogin(SharedPreferences shared) async { |
||||
EasyLoading.show(status: S.of(context).zhengzaijiazai); |
||||
apiService = ApiService( |
||||
Dio(), |
||||
context: context, |
||||
token: shared.getString('token'), |
||||
showLoading: false, |
||||
); |
||||
apiService.minLogin(storeId).catchError((onError) { |
||||
debugPrint(onError); |
||||
}).then((baseData) { |
||||
if (baseData != null && baseData.isSuccess) { |
||||
Map<String, dynamic> minStoreInfo = baseData.data; |
||||
minToken = minStoreInfo["token"]; |
||||
queryStoreInfo(); |
||||
SharedPreferences.getInstance().then( |
||||
(value) => { |
||||
value.setString('minToken', minToken), |
||||
value.setString('tenant', tenant), |
||||
value.setString('storeId', storeId), |
||||
}, |
||||
); |
||||
minService = MinApiService( |
||||
Dio(), |
||||
context: context, |
||||
token: minToken, |
||||
tenant: tenant, |
||||
storeId: storeId, |
||||
showLoading: false, |
||||
); |
||||
|
||||
// queryShopCar().then((value) { |
||||
// this.shopCarGoods = value; |
||||
// setState(() {}); |
||||
// }); |
||||
// if (tableId > 0) { |
||||
// getParentInfo(); |
||||
// } |
||||
EasyLoading.dismiss(); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
/// 查询店铺信息 |
||||
queryStoreInfo() async { |
||||
BaseData baseData = |
||||
await apiService.queryStoreInfo(storeId).catchError((error) { |
||||
debugPrint(error); |
||||
}); |
||||
if (baseData != null && baseData.isSuccess) { |
||||
storeInfo = StoreInfo.fromJson(baseData.data); |
||||
activitys = storeInfo.informationVOPageVO.list |
||||
.map((e) => Activity.fromJson(e)) |
||||
.toList(); |
||||
if (mounted) { |
||||
setState(() {}); |
||||
} |
||||
} |
||||
EasyLoading.dismiss(); |
||||
} |
||||
|
||||
@override |
||||
void dispose() { |
||||
super.dispose(); |
||||
if (refreshController != null) refreshController.dispose(); |
||||
} |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
super.build(context); |
||||
return Stack( |
||||
children: [ |
||||
Container( |
||||
color: Color(0xFFF7F7F7), |
||||
), |
||||
Stack( |
||||
children: [ |
||||
Container( |
||||
// padding: EdgeInsets.only(top: 40.h), |
||||
height: 260.h, |
||||
decoration: BoxDecoration( |
||||
gradient: new LinearGradient( |
||||
begin: Alignment.centerRight, |
||||
end: Alignment.centerLeft, |
||||
colors: [ |
||||
Color(0xFFE8F5E9), |
||||
Color(0xFFE5F7FF), |
||||
]), |
||||
), |
||||
), |
||||
if (choiceIndex == 0) |
||||
ShoppingHomePage( |
||||
storeInfo, |
||||
), |
||||
if (choiceIndex == 1) ShoppingCartPage(), |
||||
Align( |
||||
alignment: Alignment.bottomCenter, |
||||
child: Container( |
||||
color: Colors.white, |
||||
height: 83.h, |
||||
width: double.infinity, |
||||
padding: EdgeInsets.only(top: 10.h), |
||||
child: Row( |
||||
mainAxisAlignment: MainAxisAlignment.center, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Expanded( |
||||
child: GestureDetector( |
||||
onTap: () { |
||||
setState(() { |
||||
choiceIndex = 0; |
||||
}); |
||||
}, |
||||
child: Column( |
||||
children: [ |
||||
Image.asset( |
||||
choiceIndex == 0 |
||||
? "assets/image/shopping_home.png" |
||||
: "assets/image/shopping_home_h.png", |
||||
width: 30, |
||||
height: 30, |
||||
), |
||||
Text( |
||||
"首页", |
||||
style: TextStyle( |
||||
fontSize: 10.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color: choiceIndex == 0 |
||||
? Color(0xFF4C4C4C) |
||||
: Color(0xFFC6C6C6), |
||||
), |
||||
), |
||||
], |
||||
)), |
||||
), |
||||
Expanded( |
||||
child: GestureDetector( |
||||
onTap: () { |
||||
setState(() { |
||||
choiceIndex = 1; |
||||
}); |
||||
}, |
||||
child: Column( |
||||
children: [ |
||||
Image.asset( |
||||
choiceIndex == 0 |
||||
? "assets/image/shopping_cart_h.png" |
||||
: "assets/image/shopping_cart.png", |
||||
width: 30, |
||||
height: 30, |
||||
), |
||||
Text( |
||||
"购物车", |
||||
style: TextStyle( |
||||
fontSize: 10.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color: choiceIndex == 0 |
||||
? Color(0xFFC6C6C6) |
||||
: Color(0xFF4C4C4C), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
)) |
||||
], |
||||
), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
], |
||||
); |
||||
} |
||||
|
||||
@override |
||||
bool get wantKeepAlive => true; |
||||
} |