|
...
|
...
|
@@ -3,6 +3,7 @@ import 'package:dio/dio.dart'; |
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_easyrefresh/easy_refresh.dart';
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
import 'package:one_key/app.dart';
|
|
|
|
import 'package:one_key/constant/state.dart';
|
|
|
|
import 'package:one_key/models/notebook.dart';
|
|
|
|
import 'package:one_key/pages/notebook/notebook_item_f.dart';
|
|
...
|
...
|
@@ -68,6 +69,7 @@ class NoteBookPageState extends State<NoteBookPage> { |
|
|
|
void initState() {
|
|
|
|
// TODO: implement initState
|
|
|
|
super.initState();
|
|
|
|
isSimple = App.sp.getBool("isSimple") ?? true;
|
|
|
|
tabIndex = widget.tabIndex;
|
|
|
|
LogUtil.v("notebook_page initState");
|
|
|
|
|
|
...
|
...
|
@@ -521,6 +523,26 @@ class NoteBookPageState extends State<NoteBookPage> { |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//获取全选按钮的状态 true or false
|
|
|
|
getCheckValue() {
|
|
|
|
bool temp = noteBookModel.notebooks.any((value) {
|
|
|
|
return value.issimple == false;
|
|
|
|
});
|
|
|
|
if (temp == true) {
|
|
|
|
isSimple = false;
|
|
|
|
} else {
|
|
|
|
isSimple = true;
|
|
|
|
}
|
|
|
|
setState(() {});
|
|
|
|
App.sp.setBool("isSimple", isSimple);
|
|
|
|
}
|
|
|
|
|
|
|
|
///单个item切换模式
|
|
|
|
_itemChangeSimple(Notebook notebook) {
|
|
|
|
notebook.issimple = !notebook.issimple;
|
|
|
|
getCheckValue();
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
// TODO: implement build
|
|
...
|
...
|
@@ -570,8 +592,8 @@ class NoteBookPageState extends State<NoteBookPage> { |
|
|
|
dateText = '更多\n日期';
|
|
|
|
});
|
|
|
|
|
|
|
|
// _currTimeIndex();
|
|
|
|
// _getSellerTableClass();
|
|
|
|
_getReserveList();
|
|
|
|
_reserveCountDay();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
availableGestures: AvailableGestures.none,
|
|
...
|
...
|
@@ -942,6 +964,7 @@ class NoteBookPageState extends State<NoteBookPage> { |
|
|
|
isSimple = !isSimple;
|
|
|
|
});
|
|
|
|
_simpleState();
|
|
|
|
App.sp.setBool("isSimple", isSimple);
|
|
|
|
},
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
...
|
...
|
@@ -991,9 +1014,15 @@ class NoteBookPageState extends State<NoteBookPage> { |
|
|
|
bottom: ScreenUtil().setWidth(24)),
|
|
|
|
child: model.notebooks[index].issimple
|
|
|
|
? NoteBookItemSimple(
|
|
|
|
model.notebooks[index], index)
|
|
|
|
model.notebooks[index], index, () {
|
|
|
|
_itemChangeSimple(
|
|
|
|
model.notebooks[index]);
|
|
|
|
})
|
|
|
|
: NoteBookItemF(
|
|
|
|
model.notebooks[index], index),
|
|
|
|
model.notebooks[index], index, () {
|
|
|
|
_itemChangeSimple(
|
|
|
|
model.notebooks[index]);
|
|
|
|
}),
|
|
|
|
);
|
|
|
|
}, childCount: model.notebooks.length),
|
|
|
|
// itemExtent: ScreenUtil().setWidth(112),
|
|
...
|
...
|
@@ -1009,173 +1038,5 @@ class NoteBookPageState extends State<NoteBookPage> { |
|
|
|
],
|
|
|
|
)),
|
|
|
|
);
|
|
|
|
return Container(
|
|
|
|
width: double.infinity,
|
|
|
|
height: double.infinity,
|
|
|
|
color: MyColours.color_f5f5f5,
|
|
|
|
child: Column(
|
|
|
|
children: <Widget>[
|
|
|
|
_buildTabbar(),
|
|
|
|
Container(
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
width: double.infinity,
|
|
|
|
padding: EdgeInsets.only(bottom: ScreenUtil().setWidth(16)),
|
|
|
|
child: Row(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: <Widget>[
|
|
|
|
Expanded(
|
|
|
|
child: Center(
|
|
|
|
child: GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
DialogUtil.showCalendarDialog(context, dateTimeNow)
|
|
|
|
.then((day) {
|
|
|
|
if (day != null) {
|
|
|
|
_createDateText(day);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
child: Text(
|
|
|
|
dateText,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_199095,
|
|
|
|
fontSize: ScreenUtil().setSp(34)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
MyDivider(
|
|
|
|
ScreenUtil().setWidth(2),
|
|
|
|
ScreenUtil().setHeight(68),
|
|
|
|
color: MyColours.color_E0E0E0,
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
child: Padding(
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(30)),
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: <Widget>[
|
|
|
|
Offstage(
|
|
|
|
offstage: morning == "00:00-00:00" ? true : false,
|
|
|
|
child: Padding(
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
right: ScreenUtil().setWidth(18)),
|
|
|
|
child: CommonButton(
|
|
|
|
content: "早市",
|
|
|
|
state: currTimeIndex == 1 ? 1 : 0,
|
|
|
|
width: 92,
|
|
|
|
height: 48,
|
|
|
|
fontSize: 32,
|
|
|
|
onPress: () {
|
|
|
|
if (currTimeIndex == 1) return;
|
|
|
|
setState(() {
|
|
|
|
currTimeIndex = 1;
|
|
|
|
});
|
|
|
|
_getReserveList();
|
|
|
|
},
|
|
|
|
))),
|
|
|
|
Offstage(
|
|
|
|
offstage: noon == "00:00-00:00" ? true : false,
|
|
|
|
child: Padding(
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
right: ScreenUtil().setWidth(18)),
|
|
|
|
child: CommonButton(
|
|
|
|
content: "午市",
|
|
|
|
state: currTimeIndex == 2 ? 1 : 0,
|
|
|
|
width: 92,
|
|
|
|
height: 48,
|
|
|
|
fontSize: 32,
|
|
|
|
onPress: () {
|
|
|
|
if (currTimeIndex == 2) return;
|
|
|
|
setState(() {
|
|
|
|
currTimeIndex = 2;
|
|
|
|
});
|
|
|
|
_getReserveList();
|
|
|
|
},
|
|
|
|
))),
|
|
|
|
Offstage(
|
|
|
|
offstage: night == "00:00-00:00" ? true : false,
|
|
|
|
child: Container(
|
|
|
|
// padding: EdgeInsets.symmetric(
|
|
|
|
// horizontal: ScreenUtil().setWidth(10)),
|
|
|
|
child: CommonButton(
|
|
|
|
content: "晚市",
|
|
|
|
state: currTimeIndex == 3 ? 1 : 0,
|
|
|
|
width: 92,
|
|
|
|
height: 48,
|
|
|
|
fontSize: 32,
|
|
|
|
onPress: () {
|
|
|
|
if (currTimeIndex == 3) return;
|
|
|
|
setState(() {
|
|
|
|
currTimeIndex = 3;
|
|
|
|
});
|
|
|
|
_getReserveList();
|
|
|
|
},
|
|
|
|
)),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
// Selector<NoteBookModel, String>(
|
|
|
|
// selector: (context, model) => model.total,
|
|
|
|
// builder: (context, total, child) {
|
|
|
|
// return Container(
|
|
|
|
// width: double.infinity,
|
|
|
|
// alignment: Alignment.centerLeft,
|
|
|
|
// padding: EdgeInsets.only(left: ScreenUtil().setWidth(38)),
|
|
|
|
// height: ScreenUtil().setHeight(72),
|
|
|
|
// color: MyColours.color_f5f5f5,
|
|
|
|
// child: Text(
|
|
|
|
// total,
|
|
|
|
// style: TextStyle(
|
|
|
|
// color: MyColours.color_353535,
|
|
|
|
// fontSize: ScreenUtil().setSp(26)),
|
|
|
|
// ),
|
|
|
|
// );
|
|
|
|
// },
|
|
|
|
// ),
|
|
|
|
_buildListTitle(),
|
|
|
|
Expanded(child: Consumer<NoteBookModel>(
|
|
|
|
builder: (context, model, _) {
|
|
|
|
if (model.pageState != PageState.Success) {
|
|
|
|
return ExceptionPage(
|
|
|
|
pageState: model.pageState,
|
|
|
|
callback: () {
|
|
|
|
_getReserveList();
|
|
|
|
_reserveCountDay();
|
|
|
|
},
|
|
|
|
emptyMsg: "暂时没有预订哦",
|
|
|
|
emptyImg: "empty_search",
|
|
|
|
showMsg: "加载中,请稍后...",
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
return EasyRefresh.custom(
|
|
|
|
controller: _controller,
|
|
|
|
slivers: [
|
|
|
|
SliverList(
|
|
|
|
delegate: SliverChildBuilderDelegate(
|
|
|
|
(BuildContext context, int index) {
|
|
|
|
return NoteBookItem(model.notebooks[index], index);
|
|
|
|
}, childCount: model.notebooks.length),
|
|
|
|
// itemExtent: ScreenUtil().setWidth(112),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
onRefresh: () async {
|
|
|
|
_getReserveList();
|
|
|
|
},
|
|
|
|
);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
))
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|