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.
350 lines
11 KiB
350 lines
11 KiB
4 years ago
|
import 'package:flutter/material.dart';
|
||
|
import 'package:huixiang/generated/l10n.dart';
|
||
|
import 'package:huixiang/view_widget/border_text.dart';
|
||
|
import 'package:huixiang/view_widget/icon_text.dart';
|
||
|
import 'package:huixiang/view_widget/my_tab.dart';
|
||
|
import 'package:huixiang/view_widget/round_button.dart';
|
||
|
|
||
|
class ExchangeHistoryPage extends StatefulWidget {
|
||
|
@override
|
||
|
State<StatefulWidget> createState() {
|
||
|
return _ExchangeHistoryPage();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
class _ExchangeHistoryPage extends State<ExchangeHistoryPage>
|
||
|
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).quanbuduihuan,
|
||
|
),
|
||
|
MyTab(
|
||
|
text: S.of(context).weulingqu,
|
||
|
),
|
||
|
MyTab(
|
||
|
text: S.of(context).keshiyong,
|
||
|
),
|
||
|
MyTab(
|
||
|
text: S.of(context).yikexiao,
|
||
|
)
|
||
|
];
|
||
|
_pages = [
|
||
|
ExchangeHistoryList(0),
|
||
|
ExchangeHistoryList(1),
|
||
|
ExchangeHistoryList(2),
|
||
|
ExchangeHistoryList(3)
|
||
|
];
|
||
|
}
|
||
|
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
return DefaultTabController(
|
||
|
length: 3,
|
||
|
child: Scaffold(
|
||
|
appBar: AppBar(
|
||
|
title: Text(
|
||
|
S.of(context).duihuanlishi,
|
||
|
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,
|
||
|
indicatorColor: Color(0xFF39B54A),
|
||
|
indicatorSize: TabBarIndicatorSize.label,
|
||
|
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 ExchangeHistoryList extends StatefulWidget {
|
||
|
final int orderStatus;
|
||
|
|
||
|
ExchangeHistoryList(this.orderStatus);
|
||
|
|
||
|
@override
|
||
|
State<StatefulWidget> createState() {
|
||
|
return _ExchangeHistoryList();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
class _ExchangeHistoryList extends State<ExchangeHistoryList> {
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
return ListView.builder(
|
||
|
itemCount: 8,
|
||
|
itemBuilder: (context, position) {
|
||
|
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: Column(
|
||
|
children: [
|
||
|
Row(
|
||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||
|
children: [
|
||
|
Text(
|
||
|
S.of(context).chuangjianshijian("2021-04-08"),
|
||
|
style: TextStyle(
|
||
|
color: Colors.black,
|
||
|
fontWeight: FontWeight.bold,
|
||
|
fontSize: 14,
|
||
|
),
|
||
|
),
|
||
|
Text(
|
||
|
S.of(context).yiduihuan,
|
||
|
style: TextStyle(
|
||
|
color: Color(0xFFFE951E),
|
||
|
fontWeight: FontWeight.bold,
|
||
|
fontSize: 14,
|
||
|
),
|
||
|
)
|
||
|
],
|
||
|
),
|
||
|
SizedBox(
|
||
|
height: 16,
|
||
|
),
|
||
|
Row(
|
||
|
children: [
|
||
|
Text(
|
||
|
S.of(context).zitidizhi,
|
||
|
style: TextStyle(
|
||
|
color: Color(0xFF353535),
|
||
|
fontSize: 12,
|
||
|
),
|
||
|
),
|
||
|
SizedBox(
|
||
|
width: 8,
|
||
|
),
|
||
|
Expanded(
|
||
|
child: Text(
|
||
|
"武昌区凯德1818蓝调步行街(蔡明纬店旁)",
|
||
|
style: TextStyle(
|
||
|
color: Colors.black,
|
||
|
fontSize: 12,
|
||
|
),
|
||
|
),
|
||
|
)
|
||
|
],
|
||
|
),
|
||
|
SizedBox(
|
||
|
height: 8,
|
||
|
),
|
||
|
Row(
|
||
|
children: [
|
||
|
Text(
|
||
|
S.of(context).zitishijian,
|
||
|
style: TextStyle(
|
||
|
color: Color(0xFF353535),
|
||
|
fontSize: 12,
|
||
|
),
|
||
|
),
|
||
|
SizedBox(
|
||
|
width: 8,
|
||
|
),
|
||
|
Expanded(
|
||
|
child: Text(
|
||
|
S.of(context).duihuanhouwugegongzuori,
|
||
|
style: TextStyle(
|
||
|
color: Colors.black,
|
||
|
fontSize: 12,
|
||
|
),
|
||
|
),
|
||
|
)
|
||
|
],
|
||
|
),
|
||
|
SizedBox(
|
||
|
height: 16,
|
||
|
),
|
||
|
Row(
|
||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||
|
children: [
|
||
|
Image.network(
|
||
|
"https://t7.baidu.com/it/u=1415123242,2593353431&fm=193&f=GIF",
|
||
|
width: 66,
|
||
|
height: 66,
|
||
|
fit: BoxFit.cover,
|
||
|
),
|
||
|
SizedBox(
|
||
|
width: 12,
|
||
|
),
|
||
|
Expanded(
|
||
|
child: SizedBox(
|
||
|
height: 66,
|
||
|
child: Column(
|
||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||
|
children: [
|
||
|
Text(
|
||
|
"海峡姐妹集团无门槛50元优惠券",
|
||
|
style: TextStyle(
|
||
|
fontSize: 14,
|
||
|
fontWeight: FontWeight.bold,
|
||
|
color: Color(0xFF353535)),
|
||
|
),
|
||
|
SizedBox(
|
||
|
height: 2,
|
||
|
),
|
||
|
Text(
|
||
|
S.of(context).feishiwuduihuanma,
|
||
|
style: TextStyle(
|
||
|
fontSize: 10, color: Color(0xFF727272)),
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
flex: 1,
|
||
|
),
|
||
|
Text(
|
||
|
"x1",
|
||
|
style: TextStyle(
|
||
|
fontSize: 12,
|
||
|
color: Color(0xFF353535),
|
||
|
),
|
||
|
)
|
||
|
],
|
||
|
),
|
||
|
Row(
|
||
|
mainAxisAlignment: MainAxisAlignment.end,
|
||
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||
|
children: [
|
||
|
Text(
|
||
|
S.of(context).shangpinjifen(90),
|
||
|
style: TextStyle(
|
||
|
fontSize: 12,
|
||
|
color: Color(0xFFA0A0A0),
|
||
|
),
|
||
|
),
|
||
|
SizedBox(
|
||
|
width: 4,
|
||
|
),
|
||
|
Text(
|
||
|
S.of(context).shifujifen(80),
|
||
|
style: TextStyle(
|
||
|
fontSize: 12,
|
||
|
fontWeight: FontWeight.bold,
|
||
|
color: Colors.black,
|
||
|
),
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
SizedBox(
|
||
|
height: 12,
|
||
|
),
|
||
|
Row(
|
||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||
|
children: [
|
||
|
IconText(
|
||
|
S.of(context).youxiaoqizhi("2021.09.03"),
|
||
|
leftImage: "assets/image/icon_order_time.png",
|
||
|
iconSize: 16,
|
||
|
textStyle: TextStyle(
|
||
|
fontSize: 12,
|
||
|
color: Color(0xFF353535),
|
||
|
),
|
||
|
),
|
||
|
GestureDetector(
|
||
|
onTap: (){
|
||
|
Navigator.of(context).pushNamed('/router/write_off_page');
|
||
|
},
|
||
|
child: buildBtnStatus(position),
|
||
|
),
|
||
|
],
|
||
|
)
|
||
|
],
|
||
|
),
|
||
|
);
|
||
|
});
|
||
|
}
|
||
|
|
||
|
Widget buildBtnStatus(position) {
|
||
|
if (position % 2 == 0) {
|
||
|
return RoundButton(
|
||
|
padding: EdgeInsets.fromLTRB(8, 4, 8, 4),
|
||
|
text: S.of(context).lingqudaokabao,
|
||
|
textColor: Colors.white,
|
||
|
fontSize: 12,
|
||
|
backgroup: Color(0xFF32A060),
|
||
|
radius: 2,
|
||
|
);
|
||
|
} else {
|
||
|
return BorderText(
|
||
|
text: S.of(context).shanchudingdan,
|
||
|
textColor: Color(0xFF32A060),
|
||
|
borderWidth: 1,
|
||
|
borderColor: Color(0xFF32A060),
|
||
|
fontSize: 12,
|
||
|
padding: EdgeInsets.fromLTRB(14, 4, 14, 4),
|
||
|
);
|
||
|
}
|
||
|
}
|
||
|
}
|