|
...
|
...
|
@@ -8,10 +8,13 @@ import '../../../widgets/MyDivider.dart'; |
|
|
|
import '../../../widgets/h_empty_view.dart';
|
|
|
|
import '../../../widgets/round_button.dart';
|
|
|
|
import '../../../widgets/v_empty_view.dart';
|
|
|
|
import '../../models/cookbook_model.dart';
|
|
|
|
import '../../provider/plan_dish_provider.dart';
|
|
|
|
import '../../route/navigator_util.dart';
|
|
|
|
|
|
|
|
class OrderEditListShowPage extends StatefulWidget {
|
|
|
|
OrderEditListShowPage({Key key}) : super(key: key);
|
|
|
|
final List<MenuModel> data;
|
|
|
|
OrderEditListShowPage({Key key, this.data}) : super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
_OrderEditListShowPageState createState() => _OrderEditListShowPageState();
|
|
...
|
...
|
@@ -19,6 +22,9 @@ class OrderEditListShowPage extends StatefulWidget { |
|
|
|
|
|
|
|
class _OrderEditListShowPageState extends State<OrderEditListShowPage> {
|
|
|
|
ScrollController controller = ScrollController();
|
|
|
|
List<MenuSunModel> dataLocalShowMore = []; //二级菜单
|
|
|
|
List<MenuModel> dataLocalShowOne = []; //一级菜单
|
|
|
|
|
|
|
|
Widget _laduWidget() {
|
|
|
|
// if (labelIcon[widget
|
|
|
|
// .cookBookList.labelList[index].icon] is int) {
|
|
...
|
...
|
@@ -42,6 +48,62 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { |
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
dataLocalShowMore = []; //二级菜单
|
|
|
|
dataLocalShowOne = []; //一级菜单
|
|
|
|
|
|
|
|
if (widget.data != null) {
|
|
|
|
widget.data.forEach((element) {
|
|
|
|
if (element.className == '套餐' || element.className == '我的排菜') {
|
|
|
|
//如果是套餐,则看cooklist有没有选中的
|
|
|
|
element.cookbooklist.forEach((value) {
|
|
|
|
if (value.amount > 0) {
|
|
|
|
dataLocalShowMore.add(value);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
} else if (element.className == '店内常点') {
|
|
|
|
// //如果是我的排菜,则看cooklist有没有选中的
|
|
|
|
|
|
|
|
// bool hasmMine =
|
|
|
|
// element.cookbooklist.any(((value) => value.amount > 0));
|
|
|
|
// if (hasmMine) {
|
|
|
|
// //套餐中有被选中
|
|
|
|
// maxIndex++;
|
|
|
|
// }
|
|
|
|
} else if (element.className == '临时加菜') {
|
|
|
|
} else {
|
|
|
|
//单菜
|
|
|
|
bool hasmMenu =
|
|
|
|
element.cookbooklist.any(((value) => value.amount > 0));
|
|
|
|
if (hasmMenu) {
|
|
|
|
//单品此类有选中菜品
|
|
|
|
MenuModel menuModel = MenuModel();
|
|
|
|
menuModel.className = element.className;
|
|
|
|
menuModel.classLabel = element.classLabel;
|
|
|
|
menuModel.classType = element.classType;
|
|
|
|
menuModel.id = element.id;
|
|
|
|
menuModel.order = element.order;
|
|
|
|
menuModel.sellerid = element.sellerid;
|
|
|
|
menuModel.status = element.status;
|
|
|
|
menuModel.cookbooklist = [];
|
|
|
|
List<MenuSunModel> cookbooklist = [];
|
|
|
|
element.cookbooklist.forEach((value) {
|
|
|
|
if (value.amount > 0) {
|
|
|
|
cookbooklist.add(value);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
menuModel.cookbooklist.addAll(cookbooklist);
|
|
|
|
dataLocalShowOne.add(menuModel);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
print(dataLocalShowMore);
|
|
|
|
print(dataLocalShowOne);
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Scaffold(
|
|
|
|
appBar: SystemAppBar('排菜单'),
|
|
...
|
...
|
@@ -121,12 +183,282 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { |
|
|
|
],
|
|
|
|
)),
|
|
|
|
ListView.builder(
|
|
|
|
itemCount: 20,
|
|
|
|
controller: controller,
|
|
|
|
itemCount: dataLocalShowMore.length,
|
|
|
|
shrinkWrap: true,
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
MenuSunModel menuSunModel =
|
|
|
|
dataLocalShowMore[index];
|
|
|
|
return ListView.builder(
|
|
|
|
itemCount: 2,
|
|
|
|
controller: controller,
|
|
|
|
shrinkWrap: true,
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
if (index == 0) {
|
|
|
|
return Column(
|
|
|
|
children: [
|
|
|
|
//头
|
|
|
|
Container(
|
|
|
|
width: double.infinity,
|
|
|
|
// width: w(32),
|
|
|
|
height: w(48),
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: w(10)),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
border: Border(
|
|
|
|
bottom: BorderSide(
|
|
|
|
width: w(1),
|
|
|
|
color: MyColours
|
|
|
|
.color_DBDBDB))),
|
|
|
|
// constraints: BoxConstraints(minWidth: w(20)),
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment:
|
|
|
|
MainAxisAlignment
|
|
|
|
.spaceBetween,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
menuSunModel.name,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: font(16),
|
|
|
|
color: MyColours
|
|
|
|
.color_515151,
|
|
|
|
fontWeight:
|
|
|
|
FontWeight.bold),
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
'6道',
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: font(14),
|
|
|
|
color:
|
|
|
|
MyColours.color_515151,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
))
|
|
|
|
],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ListView.builder(
|
|
|
|
itemCount: menuSunModel.cookList.length,
|
|
|
|
shrinkWrap: true,
|
|
|
|
controller: controller,
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
MenuModel menuModel =
|
|
|
|
menuSunModel.cookList[index];
|
|
|
|
return ListView.builder(
|
|
|
|
itemCount:
|
|
|
|
menuModel.cookbooklist.length +
|
|
|
|
1,
|
|
|
|
shrinkWrap: true,
|
|
|
|
controller: controller,
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
if (index == 0) {
|
|
|
|
return Column(
|
|
|
|
children: [
|
|
|
|
//头
|
|
|
|
Container(
|
|
|
|
width: double.infinity,
|
|
|
|
// width: w(32),
|
|
|
|
height: w(48),
|
|
|
|
padding: EdgeInsets
|
|
|
|
.symmetric(
|
|
|
|
horizontal:
|
|
|
|
w(10)),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
border: Border(
|
|
|
|
bottom: BorderSide(
|
|
|
|
width: w(1),
|
|
|
|
color: MyColours
|
|
|
|
.color_DBDBDB))),
|
|
|
|
// constraints: BoxConstraints(minWidth: w(20)),
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment:
|
|
|
|
MainAxisAlignment
|
|
|
|
.spaceBetween,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
menuModel
|
|
|
|
.className,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize:
|
|
|
|
font(16),
|
|
|
|
color: MyColours
|
|
|
|
.color_515151,
|
|
|
|
fontWeight:
|
|
|
|
FontWeight
|
|
|
|
.bold),
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
'6道',
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize:
|
|
|
|
font(14),
|
|
|
|
color: MyColours
|
|
|
|
.color_515151,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
))
|
|
|
|
],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
int indexReal = index - 1;
|
|
|
|
MenuSunModel menuSunModel =
|
|
|
|
menuModel
|
|
|
|
.cookbooklist[indexReal];
|
|
|
|
return Container(
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: w(20),
|
|
|
|
vertical: w(13)),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
border: Border(
|
|
|
|
bottom: BorderSide(
|
|
|
|
width: w(1),
|
|
|
|
color: MyColours
|
|
|
|
.color_DBDBDB))),
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
constraints:
|
|
|
|
BoxConstraints(
|
|
|
|
maxWidth:
|
|
|
|
w(80)),
|
|
|
|
child: Text(
|
|
|
|
menuSunModel.name,
|
|
|
|
maxLines: 10,
|
|
|
|
overflow: TextOverflow
|
|
|
|
.ellipsis,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize:
|
|
|
|
font(14),
|
|
|
|
color: MyColours
|
|
|
|
.color_515151),
|
|
|
|
)),
|
|
|
|
// HEmptyView(8),
|
|
|
|
// _laduWidget(),
|
|
|
|
Spacer(),
|
|
|
|
Text(
|
|
|
|
'${menuSunModel.price}元/${menuSunModel.unit}',
|
|
|
|
maxLines: 2,
|
|
|
|
overflow:
|
|
|
|
TextOverflow.ellipsis,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: font(12),
|
|
|
|
color: MyColours
|
|
|
|
.color_999999),
|
|
|
|
),
|
|
|
|
HEmptyView(28),
|
|
|
|
Text(
|
|
|
|
'${menuSunModel.member_price}元/${menuSunModel.unit}',
|
|
|
|
maxLines: 2,
|
|
|
|
overflow:
|
|
|
|
TextOverflow.ellipsis,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: font(10),
|
|
|
|
color: MyColours
|
|
|
|
.color_8EBBBE),
|
|
|
|
),
|
|
|
|
HEmptyView(20),
|
|
|
|
Image.asset(
|
|
|
|
Utils.getImgPath(
|
|
|
|
'plan_dish_minus'),
|
|
|
|
width: w(16),
|
|
|
|
),
|
|
|
|
HEmptyView(8),
|
|
|
|
Container(
|
|
|
|
width: w(32),
|
|
|
|
height: w(16),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius:
|
|
|
|
BorderRadius
|
|
|
|
.circular(
|
|
|
|
r(5)),
|
|
|
|
border: Border.all(
|
|
|
|
width: w(1),
|
|
|
|
color: MyColours
|
|
|
|
.color_999999)),
|
|
|
|
// constraints: BoxConstraints(minWidth: w(20)),
|
|
|
|
child: TextField(
|
|
|
|
maxLines: 1,
|
|
|
|
controller:
|
|
|
|
menuSunModel
|
|
|
|
.amountC,
|
|
|
|
// focusNode: _focusNode,
|
|
|
|
// autofocus: true,
|
|
|
|
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours
|
|
|
|
.color_438E93,
|
|
|
|
fontSize:
|
|
|
|
font(12)),
|
|
|
|
textAlign:
|
|
|
|
TextAlign.center,
|
|
|
|
// textAlignVertical: TextAlignVertical.center,
|
|
|
|
decoration:
|
|
|
|
InputDecoration(
|
|
|
|
hintText: "数量",
|
|
|
|
hintStyle:
|
|
|
|
TextStyle(
|
|
|
|
color: MyColours
|
|
|
|
.color_999999,
|
|
|
|
fontSize:
|
|
|
|
font(12),
|
|
|
|
),
|
|
|
|
// isCollapsed:
|
|
|
|
// true, //重点,相当于高度包裹的意思,必须设置为true,不然有默认奇妙的最小高度
|
|
|
|
border: OutlineInputBorder(
|
|
|
|
borderSide:
|
|
|
|
BorderSide
|
|
|
|
.none),
|
|
|
|
contentPadding:
|
|
|
|
EdgeInsets.zero,
|
|
|
|
),
|
|
|
|
keyboardType:
|
|
|
|
TextInputType
|
|
|
|
.number,
|
|
|
|
textInputAction:
|
|
|
|
TextInputAction
|
|
|
|
.done,
|
|
|
|
|
|
|
|
onChanged: (value) {
|
|
|
|
// setState(() {});
|
|
|
|
// _searchSellerLocation();
|
|
|
|
// customerProvider.searchData(value);
|
|
|
|
},
|
|
|
|
onEditingComplete:
|
|
|
|
() {
|
|
|
|
FocusScope.of(
|
|
|
|
context)
|
|
|
|
.requestFocus(
|
|
|
|
FocusNode()); //点击空白处隐藏键盘
|
|
|
|
// contantShowModel.searchData(
|
|
|
|
// contantShowModel.controller.text);
|
|
|
|
// _searchSellerLocation();
|
|
|
|
// _focusNode.unfocus();
|
|
|
|
},
|
|
|
|
)),
|
|
|
|
HEmptyView(8),
|
|
|
|
Image.asset(
|
|
|
|
Utils.getImgPath(
|
|
|
|
'plan_dish_add'),
|
|
|
|
width: w(16),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}),
|
|
|
|
ListView.builder(
|
|
|
|
itemCount: dataLocalShowOne.length,
|
|
|
|
shrinkWrap: true,
|
|
|
|
controller: controller,
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
MenuModel menuModel = dataLocalShowOne[index];
|
|
|
|
return ListView.builder(
|
|
|
|
itemCount: 2 + 1,
|
|
|
|
itemCount: menuModel.cookbooklist.length + 1,
|
|
|
|
shrinkWrap: true,
|
|
|
|
controller: controller,
|
|
|
|
itemBuilder: (context, index) {
|
|
...
|
...
|
@@ -153,7 +485,7 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { |
|
|
|
.spaceBetween,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
'热菜',
|
|
|
|
menuModel.className,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: font(16),
|
|
|
|
color: MyColours
|
|
...
|
...
|
@@ -175,6 +507,8 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { |
|
|
|
);
|
|
|
|
}
|
|
|
|
int indexReal = index - 1;
|
|
|
|
MenuSunModel menuSunModel =
|
|
|
|
menuModel.cookbooklist[indexReal];
|
|
|
|
return Container(
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: w(20), vertical: w(13)),
|
|
...
|
...
|
@@ -190,7 +524,7 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { |
|
|
|
constraints:
|
|
|
|
BoxConstraints(maxWidth: w(80)),
|
|
|
|
child: Text(
|
|
|
|
'山城辣子鸡',
|
|
|
|
menuSunModel.name,
|
|
|
|
maxLines: 10,
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
style: TextStyle(
|
|
...
|
...
|
@@ -198,11 +532,11 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { |
|
|
|
color:
|
|
|
|
MyColours.color_515151),
|
|
|
|
)),
|
|
|
|
HEmptyView(8),
|
|
|
|
_laduWidget(),
|
|
|
|
// HEmptyView(8),
|
|
|
|
// _laduWidget(),
|
|
|
|
Spacer(),
|
|
|
|
Text(
|
|
|
|
'38元/份',
|
|
|
|
'${menuSunModel.price}元/${menuSunModel.unit}',
|
|
|
|
maxLines: 2,
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
style: TextStyle(
|
|
...
|
...
|
@@ -211,7 +545,7 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { |
|
|
|
),
|
|
|
|
HEmptyView(28),
|
|
|
|
Text(
|
|
|
|
'38元/份',
|
|
|
|
'${menuSunModel.member_price}元/${menuSunModel.unit}',
|
|
|
|
maxLines: 2,
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
style: TextStyle(
|
|
...
|
...
|
@@ -237,7 +571,7 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { |
|
|
|
// constraints: BoxConstraints(minWidth: w(20)),
|
|
|
|
child: TextField(
|
|
|
|
maxLines: 1,
|
|
|
|
// controller:
|
|
|
|
controller: menuSunModel.amountC,
|
|
|
|
// focusNode: _focusNode,
|
|
|
|
// autofocus: true,
|
|
|
|
|
...
|
...
|
|