Commit 6b6ec22bd73bd6e3602dc6155f492dcb4d5cf4b4

Authored by wdn127929
1 parent d9edaefb

selecttables

import 'package:one_key/models/table.dart';
import 'package:one_key/models/table.dart' as t;
class TableOuter {
String name;
... ... @@ -6,6 +7,7 @@ class TableOuter {
String rid;
bool isSelect = false; //批量选择桌位
bool isAll = false; //全选
List<t.Table> selectTables = []; //选择的桌位
TableOuter();
... ...
... ... @@ -261,11 +261,18 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> {
in tableManagerModel.tableOuterList[i].list) {
item.selected = false;
}
tableManagerModel.tableOuterList[i].selectTables = [];
//单选
setState(() {
table.selected = true;
});
}
if (table.selected) {
tableManagerModel.tableOuterList[i].selectTables.add(table);
} else {
tableManagerModel.tableOuterList[i].selectTables
.removeWhere((t) => t.id == table.id);
}
});
},
);
... ... @@ -650,27 +657,45 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> {
: Row(children: [
InkWell(
onTap: () {
for (t.Table item
in tableManagerModel
tableManagerModel
.tableOuterList[
tableManagerModel
.selectNumber]
.list) {
item.selected =
false;
}
setState(() {
tableManagerModel
.tableOuterList[
tableManagerModel
.selectNumber]
.isSelect =
!tableManagerModel
.isSelect =
!tableManagerModel
.tableOuterList[
tableManagerModel
.selectNumber]
.isSelect;
if (!tableManagerModel
.tableOuterList[
tableManagerModel
.selectNumber]
.isSelect &&
tableManagerModel
.tableOuterList[
tableManagerModel
.selectNumber]
.selectTables
.length >
1) {
for (t.Table item
in tableManagerModel
.tableOuterList[
tableManagerModel
.selectNumber]
.isSelect;
});
.list) {
item.selected =
false;
}
tableManagerModel
.tableOuterList[
tableManagerModel
.selectNumber]
.selectTables = [];
}
setState(() {});
},
child: Row(
children: [
... ... @@ -709,6 +734,11 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> {
? InkWell(
onTap: () {
tableManagerModel
.tableOuterList[
tableManagerModel
.selectNumber]
.selectTables = [];
tableManagerModel
.tableOuterList[
tableManagerModel
.selectNumber]
... ... @@ -730,6 +760,13 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> {
.list) {
item.selected =
true;
tableManagerModel
.tableOuterList[
tableManagerModel
.selectNumber]
.selectTables
.add(
item);
}
} else {
for (t.Table item
... ...
... ... @@ -25,7 +25,7 @@ import 'notebook_model.dart';
class MyTableManageHomeModel with ChangeNotifier {
List<Area> areas = []; //区域列表
List<t.Table> selectTables = []; //选择的桌位
// List<t.Table> selectTables = []; //选择的桌位
List<TableOuter> tableOuterList = []; //区域-桌位列表
... ...