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.
134 lines
3.6 KiB
134 lines
3.6 KiB
4 years ago
|
import 'package:flutter/material.dart';
|
||
|
import 'package:flutter/cupertino.dart';
|
||
|
import 'package:flutter_icons/flutter_icons.dart';
|
||
|
import 'package:akuCommunity/utils/screenutil.dart';
|
||
|
import 'package:akuCommunity/base/base_style.dart';
|
||
|
import 'package:akuCommunity/routers/page_routers.dart';
|
||
|
import 'widget/order_list.dart';
|
||
|
|
||
|
class OrderPage extends StatefulWidget {
|
||
|
final Bundle bundle;
|
||
|
OrderPage({Key key, this.bundle}) : super(key: key);
|
||
|
|
||
|
@override
|
||
|
_OrderPageState createState() => _OrderPageState();
|
||
|
}
|
||
|
|
||
|
class _OrderPageState extends State<OrderPage>
|
||
|
with SingleTickerProviderStateMixin {
|
||
|
TabController _tabController;
|
||
|
|
||
|
List<Map<String, dynamic>> tabs = [
|
||
|
{'name': '全部', 'id': 'new'},
|
||
|
{'name': '待付款', 'id': 'new'},
|
||
|
{'name': '待发货', 'id': 'new'},
|
||
|
{'name': '待收货', 'id': 'new'},
|
||
|
{'name': '待评价', 'id': 'new'},
|
||
|
{'name': '售后', 'id': 'new'},
|
||
|
];
|
||
|
|
||
|
@override
|
||
|
void initState() {
|
||
|
super.initState();
|
||
|
// 创建Controller
|
||
|
_tabController = TabController(length: tabs.length, vsync: this);
|
||
|
}
|
||
|
|
||
|
PreferredSize _preferredSizeBottom() {
|
||
|
return PreferredSize(
|
||
|
preferredSize: Size.fromHeight(kToolbarHeight),
|
||
|
child: Align(
|
||
|
alignment: Alignment.centerLeft,
|
||
|
child: TabBar(
|
||
|
controller: _tabController,
|
||
|
isScrollable: true,
|
||
|
indicator: BoxDecoration(),
|
||
|
labelColor: BaseStyle.colorff8500,
|
||
|
unselectedLabelColor: BaseStyle.color333333,
|
||
|
labelStyle: TextStyle(
|
||
|
fontSize: Screenutil.size(28),
|
||
|
fontWeight: FontWeight.w600,
|
||
|
),
|
||
|
unselectedLabelStyle: TextStyle(
|
||
|
fontSize: Screenutil.size(28),
|
||
|
fontWeight: FontWeight.w500,
|
||
|
),
|
||
|
tabs: List.generate(
|
||
|
tabs.length,
|
||
|
(index) => Tab(
|
||
|
text: tabs[index]['name'],
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
|
||
|
InkWell _inkWellSearch() {
|
||
|
return InkWell(
|
||
|
onTap: () {},
|
||
|
child: Container(
|
||
|
margin: EdgeInsets.only(right: Screenutil.length(32)),
|
||
|
padding: EdgeInsets.only(
|
||
|
left: Screenutil.length(40),
|
||
|
top: Screenutil.length(20),
|
||
|
bottom: Screenutil.length(20)),
|
||
|
decoration: BoxDecoration(
|
||
|
color: BaseStyle.colorf3f3f3,
|
||
|
borderRadius: BorderRadius.all(Radius.circular(36)),
|
||
|
boxShadow: <BoxShadow>[
|
||
|
BoxShadow(
|
||
|
color: Colors.grey.withOpacity(0.1),
|
||
|
offset: Offset(1.1, 1.1),
|
||
|
blurRadius: 10.0),
|
||
|
],
|
||
|
),
|
||
|
child: Row(children: [
|
||
|
Icon(
|
||
|
AntDesign.search1,
|
||
|
size: BaseStyle.fontSize28,
|
||
|
color: BaseStyle.color999999,
|
||
|
),
|
||
|
SizedBox(width: 5),
|
||
|
Text(
|
||
|
'搜索我的订单',
|
||
|
style: TextStyle(
|
||
|
fontSize: BaseStyle.fontSize28,
|
||
|
color: BaseStyle.color999999,
|
||
|
),
|
||
|
)
|
||
|
]),
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
|
||
|
AppBar _appBar() {
|
||
|
return AppBar(
|
||
|
elevation: 0,
|
||
|
titleSpacing: 0,
|
||
|
backgroundColor: Color(0xffffffff),
|
||
|
leading: InkWell(
|
||
|
onTap: () => Navigator.pop(context),
|
||
|
child: Icon(AntDesign.left, size: Screenutil.size(40)),
|
||
|
),
|
||
|
centerTitle: false,
|
||
|
title: _inkWellSearch(),
|
||
|
bottom: _preferredSizeBottom(),
|
||
|
);
|
||
|
}
|
||
|
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
return Scaffold(
|
||
|
appBar: _appBar(),
|
||
|
body: TabBarView(
|
||
|
controller: _tabController,
|
||
|
children: List.generate(
|
||
|
tabs.length,
|
||
|
(index) => OrderList(),
|
||
|
),
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
}
|