@@ -297,7 +297,7 @@ | |||||
}, | }, | ||||
{ | { | ||||
"name": "path_provider", | "name": "path_provider", | ||||
"rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/path_provider-1.6.21", | |||||
"rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/path_provider-1.6.22", | |||||
"packageUri": "lib/", | "packageUri": "lib/", | ||||
"languageVersion": "2.1" | "languageVersion": "2.1" | ||||
}, | }, | ||||
@@ -620,7 +620,7 @@ | |||||
"languageVersion": "2.8" | "languageVersion": "2.8" | ||||
} | } | ||||
], | ], | ||||
"generated": "2020-10-23T06:24:35.938865Z", | |||||
"generated": "2020-10-27T02:24:43.007495Z", | |||||
"generator": "pub", | "generator": "pub", | ||||
"generatorVersion": "2.8.2" | "generatorVersion": "2.8.2" | ||||
} | } |
@@ -39,7 +39,7 @@ class _MyAppState extends State<MyApp> { | |||||
BaseWidgetRegister.init(); | BaseWidgetRegister.init(); | ||||
print('初始化百川'); | print('初始化百川'); | ||||
FlutterAlibc.initAlibc(version: "", appName: "").then((result) { | FlutterAlibc.initAlibc(version: "", appName: "").then((result) { | ||||
print("白川"+'${result.errorCode} ${result.errorMessage}'); | |||||
print("白川" + '${result.errorCode} ${result.errorMessage}'); | |||||
}); | }); | ||||
} | } | ||||
@@ -53,8 +53,17 @@ class _MyAppState extends State<MyApp> { | |||||
ChangeNotifierProvider.value(value: UserInfoNotifier()), | ChangeNotifierProvider.value(value: UserInfoNotifier()), | ||||
], | ], | ||||
child: MaterialApp( | child: MaterialApp( | ||||
home: LaunchPage( | |||||
builder: (context) => HomePage(), | |||||
home: GestureDetector( | |||||
onTap: () { | |||||
FocusScopeNode currentFocus = FocusScope.of(context); | |||||
if (!currentFocus.hasPrimaryFocus && | |||||
currentFocus.focusedChild != null) { | |||||
FocusManager.instance.primaryFocus.unfocus(); | |||||
} | |||||
}, | |||||
child: LaunchPage( | |||||
builder: (context) => HomePage(), | |||||
), | |||||
), | ), | ||||
), | ), | ||||
); | ); | ||||
@@ -12,6 +12,8 @@ class OrderContentBloc extends BlocBase { | |||||
StreamController<List<OrderModel>>(); | StreamController<List<OrderModel>>(); | ||||
Stream<List<OrderModel>> get outData => _ordersController.stream; | Stream<List<OrderModel>> get outData => _ordersController.stream; | ||||
String _state; | |||||
OrderFilterModel _filter; | |||||
@override | @override | ||||
void dispose() { | void dispose() { | ||||
@@ -19,30 +21,46 @@ class OrderContentBloc extends BlocBase { | |||||
_ordersController = null; | _ordersController = null; | ||||
} | } | ||||
void loadData(String state, OrderFilterModel filter) { | |||||
Map<String, dynamic> params = filter.toJson(); | |||||
void refresh(String state, OrderFilterModel filter) { | |||||
_state = state; | |||||
_filter = filter; | |||||
_filter.pageNo = '1'; | |||||
_loadData(state, filter); | |||||
} | |||||
void _loadData(String state, OrderFilterModel filter) { | |||||
Map<String, dynamic> params = _filter.toJson(); | |||||
params.removeWhere((key, value) => value == null || value == ''); | params.removeWhere((key, value) => value == null || value == ''); | ||||
params['state'] = state; | |||||
params['state'] = _state; | |||||
NetUtil.request('/api/v1/order', method: NetMethod.POST, params: params, | NetUtil.request('/api/v1/order', method: NetMethod.POST, params: params, | ||||
onCache: (data) { | onCache: (data) { | ||||
_loadData(data); | |||||
_parseData(data); | |||||
}, onSuccess: (data) { | }, onSuccess: (data) { | ||||
_loadData(data); | |||||
_parseData(data); | |||||
}); | }); | ||||
} | } | ||||
void _loadData(dynamic data) { | |||||
void loadMore() { | |||||
_loadData(_state, _filter); | |||||
} | |||||
void _parseData(dynamic data) { | |||||
List list = data ?? []; | List list = data ?? []; | ||||
// OrderModel model = OrderModel(); | |||||
// model.itemId = '6918577752399759376'; | |||||
// model.imgUrl = | |||||
// 'https://t7.baidu.com/it/u=3616242789,1098670747&fm=79&app=86&size=h300&n=0&g=4n&f=jpeg?sec=1603444938&t=04aeb23595ac79d419be19ab92bea668'; | |||||
// model.title = '乐町百褶半身裙秋冬女2019新款复古麻花半身裙甜美百褶半身裙'; | |||||
// model.price = '108'; | |||||
// model.commission = '0'; | |||||
// model.commissionRate = '9.2'; | |||||
// _orders.add(model); | |||||
if (_filter.pageNo == null || | |||||
_filter.pageNo == '' || | |||||
_filter.pageNo == '1') { | |||||
_orders.clear(); | |||||
} | |||||
if (list.length > 0) { | |||||
if (_filter.pageNo == null || _filter.pageNo == '') { | |||||
_filter.pageNo = '2'; | |||||
} else { | |||||
_filter.pageNo = ((int.tryParse(_filter.pageNo) ?? 1) + 1).toString(); | |||||
} | |||||
} | |||||
_orders.addAll(list.map((item) { | _orders.addAll(list.map((item) { | ||||
return OrderModel.fromJson(Map<String, dynamic>.from(item)); | return OrderModel.fromJson(Map<String, dynamic>.from(item)); | ||||
@@ -0,0 +1,62 @@ | |||||
import 'dart:async'; | |||||
import 'package:zhiying_base_widget/pages/orders_page/models/order_model.dart'; | |||||
import 'package:zhiying_comm/util/base_bloc.dart'; | |||||
import 'package:zhiying_comm/zhiying_comm.dart'; | |||||
class OrderSearchBloc extends BlocBase { | |||||
List<OrderModel> _orders = List(); | |||||
StreamController<List<OrderModel>> _ordersController = | |||||
StreamController<List<OrderModel>>(); | |||||
Stream<List<OrderModel>> get outData => _ordersController.stream; | |||||
int _page = 1; | |||||
String _keyword = ''; | |||||
@override | |||||
void dispose() { | |||||
_ordersController.close(); | |||||
_ordersController = null; | |||||
} | |||||
void refresh(String keyword) { | |||||
_keyword = keyword; | |||||
_page = 1; | |||||
_loadData(_keyword); | |||||
} | |||||
void _loadData(String keyword) { | |||||
Map<String, dynamic> params = Map(); | |||||
params['keyword'] = keyword; | |||||
params['page_no'] = _page.toString(); | |||||
NetUtil.request('/api/v1/order', method: NetMethod.POST, params: params, | |||||
onCache: (data) { | |||||
_parseData(data); | |||||
}, onSuccess: (data) { | |||||
_parseData(data); | |||||
}); | |||||
} | |||||
void loadMore() { | |||||
_loadData(_keyword); | |||||
} | |||||
void _parseData(dynamic data) { | |||||
List list = data ?? []; | |||||
if (_page <= 1) { | |||||
_orders.clear(); | |||||
} | |||||
if (list.length > 0) { | |||||
_page++; | |||||
} | |||||
_orders.addAll(list.map((item) { | |||||
return OrderModel.fromJson(Map<String, dynamic>.from(item)); | |||||
}).toList()); | |||||
_ordersController.add(_orders); | |||||
} | |||||
} |
@@ -1,4 +1,6 @@ | |||||
import 'package:event_bus/event_bus.dart'; | |||||
import 'package:flutter/material.dart'; | import 'package:flutter/material.dart'; | ||||
import 'package:pull_to_refresh/pull_to_refresh.dart'; | |||||
import 'package:zhiying_base_widget/pages/orders_page/bloc/order_content_bloc.dart'; | import 'package:zhiying_base_widget/pages/orders_page/bloc/order_content_bloc.dart'; | ||||
import 'package:zhiying_base_widget/pages/orders_page/models/order_filter_model.dart'; | import 'package:zhiying_base_widget/pages/orders_page/models/order_filter_model.dart'; | ||||
import 'package:zhiying_base_widget/pages/orders_page/models/order_model.dart'; | import 'package:zhiying_base_widget/pages/orders_page/models/order_model.dart'; | ||||
@@ -11,8 +13,11 @@ class OrderContentPage extends StatefulWidget { | |||||
final String state; // 订单状态 | final String state; // 订单状态 | ||||
final OrderPageStyleModel style; | final OrderPageStyleModel style; | ||||
final OrderFilterModel filter; | final OrderFilterModel filter; | ||||
final int index; | |||||
final EventBus eventBus; | |||||
const OrderContentPage(this.state, {Key key, this.filter, this.style}) | |||||
const OrderContentPage(this.state, | |||||
{Key key, this.filter, this.style, this.index, this.eventBus}) | |||||
: super(key: key); | : super(key: key); | ||||
@override | @override | ||||
@@ -24,7 +29,13 @@ class _OrderContentPageState extends State<OrderContentPage> { | |||||
Widget build(BuildContext context) { | Widget build(BuildContext context) { | ||||
return BlocProvider<OrderContentBloc>( | return BlocProvider<OrderContentBloc>( | ||||
bloc: OrderContentBloc(), | bloc: OrderContentBloc(), | ||||
child: OrderContentContainer(widget.state, widget.filter, widget.style), | |||||
child: OrderContentContainer( | |||||
widget.state, | |||||
widget.filter, | |||||
widget.style, | |||||
index: widget.index, | |||||
eventBus: widget.eventBus, | |||||
), | |||||
); | ); | ||||
} | } | ||||
} | } | ||||
@@ -33,8 +44,11 @@ class OrderContentContainer extends StatefulWidget { | |||||
final String state; // 订单状态 | final String state; // 订单状态 | ||||
final OrderFilterModel filter; | final OrderFilterModel filter; | ||||
final OrderPageStyleModel style; | final OrderPageStyleModel style; | ||||
final int index; | |||||
final EventBus eventBus; | |||||
const OrderContentContainer(this.state, this.filter, this.style, {Key key}) | |||||
const OrderContentContainer(this.state, this.filter, this.style, | |||||
{Key key, this.index, this.eventBus}) | |||||
: super(key: key); | : super(key: key); | ||||
@override | @override | ||||
@@ -43,11 +57,19 @@ class OrderContentContainer extends StatefulWidget { | |||||
class _OrderContentContainerState extends State<OrderContentContainer> { | class _OrderContentContainerState extends State<OrderContentContainer> { | ||||
OrderContentBloc _bloc; | OrderContentBloc _bloc; | ||||
RefreshController _refreshController = | |||||
RefreshController(initialRefresh: false); | |||||
@override | @override | ||||
void initState() { | void initState() { | ||||
_bloc = BlocProvider.of(context); | _bloc = BlocProvider.of(context); | ||||
_bloc.loadData(widget.state, widget.filter); | |||||
_bloc.refresh(widget.state, widget.filter); | |||||
widget.eventBus.on<int>().listen((index) { | |||||
if (index == widget.index) { | |||||
_bloc.refresh(widget.state, widget.filter); | |||||
} | |||||
}); | |||||
super.initState(); | super.initState(); | ||||
} | } | ||||
@@ -61,6 +83,7 @@ class _OrderContentContainerState extends State<OrderContentContainer> { | |||||
if (snapshot.data == null) { | if (snapshot.data == null) { | ||||
return Container(); | return Container(); | ||||
} | } | ||||
_refreshController.refreshCompleted(); | |||||
List<OrderModel> orders = snapshot.data; | List<OrderModel> orders = snapshot.data; | ||||
if (orders.length == 0) { | if (orders.length == 0) { | ||||
return Container( | return Container( | ||||
@@ -69,14 +92,26 @@ class _OrderContentContainerState extends State<OrderContentContainer> { | |||||
), | ), | ||||
); | ); | ||||
} | } | ||||
return ListView.builder( | |||||
itemCount: orders.length, | |||||
itemBuilder: (context, index) { | |||||
return OrderItemWidget( | |||||
orders[index], | |||||
widget.style, | |||||
); | |||||
}); | |||||
return SmartRefresher( | |||||
enablePullDown: true, | |||||
enablePullUp: true, | |||||
header: WaterDropHeader(), | |||||
controller: _refreshController, | |||||
onLoading: () { | |||||
_bloc.loadMore(); | |||||
}, | |||||
onRefresh: () { | |||||
_bloc.refresh(widget.state, widget.filter); | |||||
}, | |||||
child: ListView.builder( | |||||
itemCount: orders.length, | |||||
itemBuilder: (context, index) { | |||||
return OrderItemWidget( | |||||
orders[index], | |||||
widget.style, | |||||
); | |||||
}), | |||||
); | |||||
}); | }); | ||||
} | } | ||||
} | } |
@@ -1,43 +1,99 @@ | |||||
import 'package:flutter/cupertino.dart'; | import 'package:flutter/cupertino.dart'; | ||||
import 'package:flutter/material.dart'; | import 'package:flutter/material.dart'; | ||||
import 'package:flutter/services.dart'; | |||||
import 'package:fluttertoast/fluttertoast.dart'; | |||||
import 'package:pull_to_refresh/pull_to_refresh.dart'; | |||||
import 'package:zhiying_base_widget/pages/orders_page/bloc/order_search_bloc.dart'; | |||||
import 'package:zhiying_base_widget/pages/orders_page/models/order_model.dart'; | |||||
import 'package:zhiying_base_widget/pages/orders_page/models/order_page_style_model.dart'; | |||||
import 'package:zhiying_base_widget/pages/orders_page/views/order_item_widget.dart'; | |||||
import 'package:zhiying_base_widget/widgets/empty/empty_widget.dart'; | import 'package:zhiying_base_widget/widgets/empty/empty_widget.dart'; | ||||
import 'package:zhiying_comm/util/base_bloc.dart'; | |||||
import 'package:zhiying_comm/zhiying_comm.dart'; | import 'package:zhiying_comm/zhiying_comm.dart'; | ||||
// 订单搜索页面 | // 订单搜索页面 | ||||
class OrderSearchPage extends StatefulWidget { | class OrderSearchPage extends StatefulWidget { | ||||
final OrderPageStyleModel style; | |||||
const OrderSearchPage(this.style, {Key key}) : super(key: key); | |||||
@override | @override | ||||
_OrderSearchPageState createState() => _OrderSearchPageState(); | _OrderSearchPageState createState() => _OrderSearchPageState(); | ||||
} | } | ||||
class _OrderSearchPageState extends State<OrderSearchPage> { | class _OrderSearchPageState extends State<OrderSearchPage> { | ||||
@override | |||||
Widget build(BuildContext context) { | |||||
return BlocProvider<OrderSearchBloc>( | |||||
bloc: OrderSearchBloc(), | |||||
child: _OrderSearchContainer(widget.style), | |||||
); | |||||
} | |||||
} | |||||
class _OrderSearchContainer extends StatefulWidget { | |||||
final OrderPageStyleModel style; | |||||
const _OrderSearchContainer(this.style, {Key key}) : super(key: key); | |||||
@override | |||||
_OrderSearchContainerState createState() => _OrderSearchContainerState(); | |||||
} | |||||
class _OrderSearchContainerState extends State<_OrderSearchContainer> { | |||||
final TextEditingController _keywordController = TextEditingController(); | final TextEditingController _keywordController = TextEditingController(); | ||||
OrderSearchBloc _bloc; | |||||
RefreshController _refreshController = | |||||
RefreshController(initialRefresh: false); | |||||
@override | @override | ||||
void initState() { | void initState() { | ||||
// TODO: implement initState | |||||
_bloc = BlocProvider.of(context); | |||||
super.initState(); | super.initState(); | ||||
} | } | ||||
@override | @override | ||||
void dispose() { | void dispose() { | ||||
_keywordController.dispose(); | |||||
super.dispose(); | super.dispose(); | ||||
} | } | ||||
@override | @override | ||||
Widget build(BuildContext context) { | Widget build(BuildContext context) { | ||||
return GestureDetector( | |||||
onTap: () { | |||||
FocusScope.of(context).requestFocus(FocusNode()); | |||||
}, | |||||
child: Scaffold( | |||||
appBar: _createNav(), | |||||
body: SafeArea( | |||||
child: Container( | |||||
width: double.infinity, | |||||
height: double.infinity, | |||||
child: Center(child: EmptyWidget())), | |||||
), | |||||
return Scaffold( | |||||
appBar: _createNav(), | |||||
body: SafeArea( | |||||
child: StreamBuilder<List<OrderModel>>( | |||||
stream: _bloc.outData, | |||||
builder: (BuildContext context, AsyncSnapshot snapshot) { | |||||
if (snapshot.data == null) { | |||||
return Container(); | |||||
} | |||||
_refreshController.refreshCompleted(); | |||||
List<OrderModel> orders = snapshot.data; | |||||
if (orders.length == 0) { | |||||
return Container( | |||||
child: Center( | |||||
child: EmptyWidget(), | |||||
), | |||||
); | |||||
} | |||||
return SmartRefresher( | |||||
enablePullDown: false, | |||||
enablePullUp: true, | |||||
controller: _refreshController, | |||||
onLoading: () { | |||||
_bloc.loadMore(); | |||||
}, | |||||
child: ListView.builder( | |||||
itemCount: orders.length, | |||||
itemBuilder: (context, index) { | |||||
return OrderItemWidget( | |||||
orders[index], | |||||
widget.style, | |||||
); | |||||
}), | |||||
); | |||||
}), | |||||
), | ), | ||||
); | ); | ||||
} | } | ||||
@@ -106,5 +162,10 @@ class _OrderSearchPageState extends State<OrderSearchPage> { | |||||
void _search(String keyword) { | void _search(String keyword) { | ||||
FocusScope.of(context).requestFocus(FocusNode()); | FocusScope.of(context).requestFocus(FocusNode()); | ||||
if (_keywordController.text == null || _keywordController.text == '') { | |||||
Fluttertoast.showToast(msg: '请输入搜索关键词'); | |||||
return; | |||||
} | |||||
_bloc.refresh(_keywordController.text); | |||||
} | } | ||||
} | } |
@@ -1,3 +1,4 @@ | |||||
import 'package:event_bus/event_bus.dart'; | |||||
import 'package:flutter/cupertino.dart'; | import 'package:flutter/cupertino.dart'; | ||||
import 'package:flutter/material.dart'; | import 'package:flutter/material.dart'; | ||||
import 'package:zhiying_base_widget/pages/orders_page/bloc/order_page_bloc.dart'; | import 'package:zhiying_base_widget/pages/orders_page/bloc/order_page_bloc.dart'; | ||||
@@ -10,6 +11,7 @@ import 'package:zhiying_base_widget/pages/orders_page/views/order_filter.dart'; | |||||
import 'package:zhiying_base_widget/pages/orders_page/views/order_serch_widget.dart'; | import 'package:zhiying_base_widget/pages/orders_page/views/order_serch_widget.dart'; | ||||
import 'package:zhiying_base_widget/pages/orders_page/views/order_tabbar_widget.dart'; | import 'package:zhiying_base_widget/pages/orders_page/views/order_tabbar_widget.dart'; | ||||
import 'package:zhiying_comm/util/base_bloc.dart'; | import 'package:zhiying_comm/util/base_bloc.dart'; | ||||
import 'package:zhiying_comm/zhiying_comm.dart'; | |||||
// 订单页面 | // 订单页面 | ||||
class OrdersPage extends StatefulWidget { | class OrdersPage extends StatefulWidget { | ||||
@@ -96,6 +98,8 @@ class _OrdersContainerState extends State<_OrdersContainer> | |||||
List<String> _titles = []; | List<String> _titles = []; | ||||
List<Widget> _contents = []; | List<Widget> _contents = []; | ||||
EventBus _eventBus = EventBus(); | |||||
@override | @override | ||||
void initState() { | void initState() { | ||||
_bloc = BlocProvider.of<OrderPageBloc>(context); | _bloc = BlocProvider.of<OrderPageBloc>(context); | ||||
@@ -106,6 +110,12 @@ class _OrdersContainerState extends State<_OrdersContainer> | |||||
super.initState(); | super.initState(); | ||||
} | } | ||||
@override | |||||
void dispose() { | |||||
_tabController?.dispose(); | |||||
super.dispose(); | |||||
} | |||||
@override | @override | ||||
Widget build(BuildContext context) { | Widget build(BuildContext context) { | ||||
return StreamBuilder<OrderPageStyleModel>( | return StreamBuilder<OrderPageStyleModel>( | ||||
@@ -116,8 +126,13 @@ class _OrdersContainerState extends State<_OrdersContainer> | |||||
return Container(); | return Container(); | ||||
} | } | ||||
List<OrderTypeModel> type = model.filter.orderState; | List<OrderTypeModel> type = model.filter.orderState; | ||||
_tabController?.dispose(); | |||||
_tabController = | _tabController = | ||||
TabController(length: type?.length ?? 0, vsync: this); | TabController(length: type?.length ?? 0, vsync: this); | ||||
_tabController.addListener(() { | |||||
Logger.debug('????? ${_tabController.index.toString()}'); | |||||
}); | |||||
_titles = List.generate(type?.length, (index) => type[index].name); | _titles = List.generate(type?.length, (index) => type[index].name); | ||||
_contents = List.generate( | _contents = List.generate( | ||||
type?.length ?? 0, | type?.length ?? 0, | ||||
@@ -125,6 +140,8 @@ class _OrdersContainerState extends State<_OrdersContainer> | |||||
type[index].type, | type[index].type, | ||||
style: model, | style: model, | ||||
filter: _filter, | filter: _filter, | ||||
index: index, | |||||
eventBus: _eventBus, | |||||
), | ), | ||||
); | ); | ||||
@@ -135,7 +152,7 @@ class _OrdersContainerState extends State<_OrdersContainer> | |||||
onTap: () { | onTap: () { | ||||
Navigator.of(context) | Navigator.of(context) | ||||
.push(CupertinoPageRoute(builder: (BuildContext context) { | .push(CupertinoPageRoute(builder: (BuildContext context) { | ||||
return OrderSearchPage(); | |||||
return OrderSearchPage(model); | |||||
})); | })); | ||||
}, | }, | ||||
), | ), | ||||
@@ -167,6 +184,18 @@ class _OrdersContainerState extends State<_OrdersContainer> | |||||
_isFilterShow = false; | _isFilterShow = false; | ||||
}); | }); | ||||
}, | }, | ||||
onConfirm: (_) { | |||||
_eventBus.fire(_tabController.index); | |||||
setState(() { | |||||
_isFilterShow = false; | |||||
}); | |||||
}, | |||||
onReset: (_) { | |||||
_eventBus.fire(_tabController.index); | |||||
setState(() { | |||||
_isFilterShow = false; | |||||
}); | |||||
}, | |||||
), | ), | ||||
) | ) | ||||
], | ], | ||||
@@ -9,11 +9,19 @@ import 'package:zhiying_comm/zhiying_comm.dart'; | |||||
class OrderFilterWidget extends StatefulWidget { | class OrderFilterWidget extends StatefulWidget { | ||||
final OrderPageStyleModel style; | final OrderPageStyleModel style; | ||||
final OrderFilterModel filterModel; | final OrderFilterModel filterModel; | ||||
final VoidCallback onDismiss; | final VoidCallback onDismiss; | ||||
final ValueChanged<OrderFilterModel> onConfirm; | |||||
final ValueChanged<OrderFilterModel> onReset; | |||||
const OrderFilterWidget(this.style, this.filterModel, | |||||
{Key key, this.onDismiss}) | |||||
: super(key: key); | |||||
const OrderFilterWidget( | |||||
this.style, | |||||
this.filterModel, { | |||||
Key key, | |||||
this.onDismiss, | |||||
this.onConfirm, | |||||
this.onReset, | |||||
}) : super(key: key); | |||||
@override | @override | ||||
_OrderFilterWidgetState createState() => _OrderFilterWidgetState(); | _OrderFilterWidgetState createState() => _OrderFilterWidgetState(); | ||||
@@ -181,12 +189,18 @@ class _OrderFilterWidgetState extends State<OrderFilterWidget> { | |||||
child: Row( | child: Row( | ||||
children: <Widget>[ | children: <Widget>[ | ||||
Expanded( | Expanded( | ||||
child: Container( | |||||
color: Colors.transparent, | |||||
child: Center( | |||||
child: Text( | |||||
'重置', | |||||
style: TextStyle(fontSize: 15, color: Color(0xff999999)), | |||||
child: GestureDetector( | |||||
onTap: () { | |||||
Logger.debug('重置'); | |||||
_resetFilter(); | |||||
}, | |||||
child: Container( | |||||
color: Colors.transparent, | |||||
child: Center( | |||||
child: Text( | |||||
'重置', | |||||
style: TextStyle(fontSize: 15, color: Color(0xff999999)), | |||||
), | |||||
), | ), | ||||
), | ), | ||||
), | ), | ||||
@@ -198,12 +212,18 @@ class _OrderFilterWidgetState extends State<OrderFilterWidget> { | |||||
color: Color(0xffe3e3e3), | color: Color(0xffe3e3e3), | ||||
), | ), | ||||
Expanded( | Expanded( | ||||
child: Container( | |||||
color: Colors.transparent, | |||||
child: Center( | |||||
child: Text( | |||||
'确定', | |||||
style: TextStyle(fontSize: 15, color: Colors.redAccent), | |||||
child: GestureDetector( | |||||
onTap: () { | |||||
Logger.debug('确定'); | |||||
_confirmFilter(); | |||||
}, | |||||
child: Container( | |||||
color: Colors.transparent, | |||||
child: Center( | |||||
child: Text( | |||||
'确定', | |||||
style: TextStyle(fontSize: 15, color: Colors.redAccent), | |||||
), | |||||
), | ), | ||||
), | ), | ||||
), | ), | ||||
@@ -221,7 +241,8 @@ class _OrderFilterWidgetState extends State<OrderFilterWidget> { | |||||
starTime = '不限'; | starTime = '不限'; | ||||
} | } | ||||
String endTime = formatter.format(DateTime(_endTime)); | |||||
String endTime = | |||||
formatter.format(DateTime.fromMillisecondsSinceEpoch(_endTime)); | |||||
if (_endTime == 0) { | if (_endTime == 0) { | ||||
endTime = '不限'; | endTime = '不限'; | ||||
} | } | ||||
@@ -318,4 +339,57 @@ class _OrderFilterWidgetState extends State<OrderFilterWidget> { | |||||
} | } | ||||
setState(() {}); | setState(() {}); | ||||
} | } | ||||
// 确定筛选条件 | |||||
void _confirmFilter() { | |||||
List<OrderTypeModel> list = widget?.style?.filter?.providerType ?? []; | |||||
if (_currentProvider < list.length) { | |||||
widget?.filterModel?.provider = list[_currentProvider].type; | |||||
} | |||||
List<OrderTypeModel> types = widget?.style?.filter?.orderType ?? []; | |||||
if (_currentType < types.length) { | |||||
widget?.filterModel?.type = types[_currentType].type; | |||||
} | |||||
var formatter = new DateFormat('yyyy-MM-dd'); | |||||
if (_startTime == 0) { | |||||
widget.filterModel?.startTime = ''; | |||||
} else { | |||||
String starTime = | |||||
formatter.format(DateTime.fromMillisecondsSinceEpoch(_startTime)); | |||||
var sTime = DateTime.parse(starTime); | |||||
var _intendtime = (sTime.millisecondsSinceEpoch / 1000).ceil(); //方法一 | |||||
Logger.debug('${_intendtime.toString()}'); | |||||
widget.filterModel?.startTime = _intendtime.toString(); | |||||
} | |||||
if (_endTime == 0) { | |||||
widget.filterModel?.endTime = ''; | |||||
} else { | |||||
String endTime = | |||||
formatter.format(DateTime.fromMillisecondsSinceEpoch(_endTime)); | |||||
var eTime = DateTime.parse('${endTime} 23:59:59'); | |||||
var _intendtime = (eTime.millisecondsSinceEpoch / 1000).ceil(); //方法一 | |||||
Logger.debug('${_intendtime.toString()}'); | |||||
widget.filterModel?.endTime = _intendtime.toString(); | |||||
} | |||||
if (widget?.onConfirm != null) { | |||||
widget.onConfirm(widget.filterModel); | |||||
} | |||||
} | |||||
void _resetFilter() { | |||||
widget.filterModel?.type = ''; | |||||
widget.filterModel?.provider = ''; | |||||
widget.filterModel?.startTime = ''; | |||||
widget.filterModel?.endTime = ''; | |||||
_currentProvider = 0; //订单来源 | |||||
_currentType = 0; // 订单类型 | |||||
_startTime = 0; // 起始时间 | |||||
_endTime = 0; // 结束时间 | |||||
setState(() {}); | |||||
if (widget?.onReset != null) { | |||||
widget.onReset(widget.filterModel); | |||||
} | |||||
} | |||||
} | } |
@@ -37,6 +37,7 @@ class OrderTabbarWidget extends StatelessWidget { | |||||
labelColor: | labelColor: | ||||
HexColor.fromHex(model?.appActivateColor ?? '#ff4242'), | HexColor.fromHex(model?.appActivateColor ?? '#ff4242'), | ||||
unselectedLabelColor: Color(0xff999999), | unselectedLabelColor: Color(0xff999999), | ||||
tabs: titles.map((item) { | tabs: titles.map((item) { | ||||
return MyTab( | return MyTab( | ||||
// icon: CachedNetworkImage(imageUrl: item?.with_icon_color ?? '', width: 14,), | // icon: CachedNetworkImage(imageUrl: item?.with_icon_color ?? '', width: 14,), | ||||