You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
249 lines
7.4 KiB
249 lines
7.4 KiB
import 'package:flutter/material.dart'; |
|
import 'package:huixiang/generated/l10n.dart'; |
|
import 'package:huixiang/view_widget/my_tab.dart'; |
|
import 'package:huixiang/view_widget/round_button.dart'; |
|
import 'package:bubble_tab_indicator/bubble_tab_indicator.dart'; |
|
|
|
class OrderHistoryPage extends StatefulWidget { |
|
@override |
|
State<StatefulWidget> createState() { |
|
return _OrderHistoryPage(); |
|
} |
|
} |
|
|
|
class _OrderHistoryPage extends State<OrderHistoryPage> |
|
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).quanbudingdan, |
|
), |
|
MyTab( |
|
text: S.of(context).weiwancheng, |
|
), |
|
MyTab( |
|
text: S.of(context).yiwancheng, |
|
), |
|
MyTab( |
|
text: S.of(context).yiquxiao, |
|
) |
|
]; |
|
_pages = [ |
|
OrderHistoryList(0), |
|
OrderHistoryList(1), |
|
OrderHistoryList(2), |
|
OrderHistoryList(3) |
|
]; |
|
} |
|
|
|
@override |
|
Widget build(BuildContext context) { |
|
return DefaultTabController( |
|
length: 3, |
|
child: Scaffold( |
|
appBar: AppBar( |
|
title: Text( |
|
S.of(context).dingdan, |
|
style: TextStyle( |
|
color: Colors.black, |
|
fontWeight: FontWeight.bold, |
|
fontSize: 18, |
|
), |
|
), |
|
centerTitle: false, |
|
backgroundColor: Color(0xFFFFFFFF), |
|
elevation: 0, |
|
leading: GestureDetector( |
|
onTap: () { |
|
Navigator.of(context).pop(); |
|
}, |
|
child: Container( |
|
alignment: Alignment.centerRight, |
|
margin: EdgeInsets.only(left: 10), |
|
padding: EdgeInsets.all(6), |
|
child: Icon( |
|
Icons.arrow_back_ios, |
|
color: Colors.black, |
|
size: 24, |
|
), |
|
), |
|
), |
|
titleSpacing: 2, |
|
leadingWidth: 56, |
|
bottom: PreferredSize( |
|
preferredSize: Size(double.infinity, 38), |
|
child: TabBar( |
|
controller: tabcontroller, |
|
indicatorWeight: 2, |
|
indicatorSize: TabBarIndicatorSize.label, |
|
indicatorColor: Color(0xFF39B54A), |
|
indicatorPadding: EdgeInsets.only(top: 3), |
|
unselectedLabelStyle: |
|
TextStyle(fontSize: 16, fontWeight: FontWeight.normal), |
|
labelStyle: TextStyle( |
|
color: Colors.black, |
|
fontSize: 16, |
|
fontWeight: FontWeight.bold, |
|
), |
|
labelColor: Colors.black, |
|
tabs: tabs, |
|
), |
|
), |
|
), |
|
body: TabBarView( |
|
children: _pages, |
|
controller: tabcontroller, |
|
), |
|
), |
|
); |
|
} |
|
} |
|
|
|
class OrderHistoryList extends StatefulWidget { |
|
final int orderStatus; |
|
|
|
OrderHistoryList(this.orderStatus); |
|
|
|
@override |
|
State<StatefulWidget> createState() { |
|
return _OrderHistoryList(); |
|
} |
|
} |
|
|
|
class _OrderHistoryList extends State<OrderHistoryList> { |
|
@override |
|
Widget build(BuildContext context) { |
|
return ListView.builder( |
|
itemCount: 8, |
|
itemBuilder: (context, position) { |
|
return GestureDetector( |
|
onTap: () { |
|
Navigator.of(context).pushNamed('/router/order_details'); |
|
}, |
|
child: orderItem(), |
|
); |
|
}); |
|
} |
|
|
|
bool isRemake = true; |
|
|
|
Widget orderItem() { |
|
return Container( |
|
margin: EdgeInsets.fromLTRB(16, 8, 16, 8), |
|
padding: EdgeInsets.all(12), |
|
decoration: BoxDecoration( |
|
color: Colors.white, |
|
borderRadius: BorderRadius.circular(8), |
|
boxShadow: [ |
|
BoxShadow( |
|
color: Colors.black.withAlpha(12), |
|
offset: Offset(0, 3), |
|
blurRadius: 14, |
|
spreadRadius: 0) |
|
]), |
|
child: Row( |
|
mainAxisAlignment: MainAxisAlignment.start, |
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
children: [ |
|
Image.network( |
|
"https://t7.baidu.com/it/u=1348120667,563487140&fm=193&f=GIF", |
|
width: 82, |
|
height: 82, |
|
fit: BoxFit.contain, |
|
), |
|
Expanded( |
|
child: Container( |
|
height: 97, |
|
margin: EdgeInsets.only(left: 24), |
|
alignment: Alignment.centerLeft, |
|
child: Column( |
|
mainAxisAlignment: MainAxisAlignment.spaceAround, |
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
children: [ |
|
Text( |
|
"前进麦味·天然烘焙(凯德1818店)", |
|
style: TextStyle( |
|
fontWeight: FontWeight.bold, |
|
fontSize: 14, |
|
color: Color(0xFF353535), |
|
), |
|
), |
|
Column( |
|
mainAxisAlignment: MainAxisAlignment.spaceAround, |
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
children: [ |
|
Text( |
|
S.of(context).xiadanshijian_("2020.01.20~2020.1.21"), |
|
style: TextStyle( |
|
fontSize: 10, |
|
color: Color(0xFF727272), |
|
), |
|
), |
|
SizedBox( |
|
height: 4, |
|
), |
|
if (isRemake) |
|
Text( |
|
"海盐牛角+咸蛋黄芋泥+草莓奶昔…", |
|
style: TextStyle( |
|
fontSize: 10, |
|
color: Color(0xFFEDB12F), |
|
), |
|
), |
|
], |
|
), |
|
Row( |
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
crossAxisAlignment: CrossAxisAlignment.end, |
|
children: [ |
|
Text.rich(TextSpan(children: [ |
|
TextSpan( |
|
text: S.of(context).jiesuanjine, |
|
style: TextStyle( |
|
fontSize: 12, |
|
color: Color(0xFF353535), |
|
), |
|
), |
|
TextSpan( |
|
text: S.of(context).yuan("58.2"), |
|
style: TextStyle( |
|
fontSize: 12, |
|
fontWeight: FontWeight.bold, |
|
color: Color(0xFF32A060), |
|
), |
|
), |
|
])), |
|
RoundButton( |
|
text: S.of(context).quzhifu, |
|
textColor: Colors.white, |
|
fontSize: 12, |
|
backgroup: Color(0xFF32A060), |
|
radius: 2, |
|
padding: EdgeInsets.fromLTRB(8, 4, 8, 4), |
|
) |
|
], |
|
), |
|
], |
|
), |
|
), |
|
flex: 1, |
|
) |
|
], |
|
), |
|
); |
|
} |
|
}
|
|
|