|
...
|
...
|
@@ -39,6 +39,7 @@ import 'package:scrollable_positioned_list/scrollable_positioned_list.dart'; |
|
|
|
import 'package:one_key/models/table_list.dart' as table;
|
|
|
|
|
|
|
|
import '../../../provider/table_manager_model.dart';
|
|
|
|
import 'package:flutter_draggable_gridview/flutter_draggable_gridview.dart';
|
|
|
|
|
|
|
|
const scrollDuration = Duration(microseconds: 500);
|
|
|
|
|
|
...
|
...
|
@@ -97,12 +98,15 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> { |
|
|
|
@override
|
|
|
|
void dispose() {
|
|
|
|
// TODO: implement dispose
|
|
|
|
controller.removeListener(scheduleRebuild);
|
|
|
|
EventBus().emit('changeStatusColor');
|
|
|
|
super.dispose();
|
|
|
|
EventBus().off("refresh_table_area");
|
|
|
|
// EventBus().off("refresh_tablePhoto");
|
|
|
|
}
|
|
|
|
|
|
|
|
void scheduleRebuild() => setState(() {});
|
|
|
|
|
|
|
|
///刷新图片显示
|
|
|
|
// _refreshTablePhoto() async {
|
|
|
|
// List temp =
|
|
...
|
...
|
@@ -237,96 +241,227 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> { |
|
|
|
|
|
|
|
/// Generate item number [i].
|
|
|
|
Widget item(int i) {
|
|
|
|
return GridView.builder(
|
|
|
|
controller: controller,
|
|
|
|
// physics: NeverScrollableScrollPhysics(),
|
|
|
|
final List<DraggableGridItem> _listOfDraggableGridItem = [];
|
|
|
|
for (int j = 0;
|
|
|
|
j < tableManagerModel.tableOuterList[i].list.length + 1;
|
|
|
|
j++) {
|
|
|
|
DraggableGridItem draggableGridItem;
|
|
|
|
|
|
|
|
if (j == tableManagerModel.tableOuterList[i].list.length ||
|
|
|
|
tableManagerModel.tableOuterList[i].list.length == 0) {
|
|
|
|
draggableGridItem = DraggableGridItem(
|
|
|
|
// isDraggable: true,
|
|
|
|
child: Offstage(
|
|
|
|
offstage: tableManagerModel
|
|
|
|
.tableOuterList[tableManagerModel.selectNumber].isSelect,
|
|
|
|
child: InkWell(
|
|
|
|
onTap: () async {
|
|
|
|
List<String> tableTypeS = [];
|
|
|
|
for (int n = 0;
|
|
|
|
n < tableManagerModel.tableTypeList.length;
|
|
|
|
n++) {
|
|
|
|
tableTypeS.add(tableManagerModel.tableTypeList[n].name);
|
|
|
|
}
|
|
|
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
itemCount: tableManagerModel.tableOuterList[i].list.length + 1,
|
|
|
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
|
|
|
crossAxisCount: 4,
|
|
|
|
childAspectRatio: 1,
|
|
|
|
mainAxisSpacing: ScreenUtil().setWidth(28),
|
|
|
|
crossAxisSpacing: ScreenUtil().setWidth(48),
|
|
|
|
),
|
|
|
|
//添加桌位弹框
|
|
|
|
await DialogUtil.openMyTableManageCreateTableDialog(
|
|
|
|
context, tableTypeS, personNumList,
|
|
|
|
onTap: (Map<String, String> value) async {
|
|
|
|
print(value);
|
|
|
|
// 'areaname':
|
|
|
|
// areas[currentAreaIndex],
|
|
|
|
// 'name': controller.text,
|
|
|
|
// 'pnumMin': pnumMin,
|
|
|
|
// 'pnumMax': pnumMax
|
|
|
|
//添加桌位 接口参数带整合???
|
|
|
|
// 以下是旧的不去,明天添加桌位接口
|
|
|
|
// 'bjtype': baojianList[
|
|
|
|
// currentBaojianIndex],
|
|
|
|
// 'name': controller.text,
|
|
|
|
// 'pnumMin': pnumMin,
|
|
|
|
// 'pnumMax': pnumMax,
|
|
|
|
// 'mulcreate':
|
|
|
|
// mulCreate.toString(),
|
|
|
|
// 'tablenum':
|
|
|
|
// _norNumController.text
|
|
|
|
String rid;
|
|
|
|
for (Area item in tableManagerModel.areas) {
|
|
|
|
if (item.name == tableManagerModel.currentArea) {
|
|
|
|
rid = item.rid;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
if (index == tableManagerModel.tableOuterList[i].list.length ||
|
|
|
|
tableManagerModel.tableOuterList[i].list.length == 0) {
|
|
|
|
return Offstage(
|
|
|
|
offstage: tableManagerModel
|
|
|
|
.tableOuterList[tableManagerModel.selectNumber].isSelect,
|
|
|
|
child: InkWell(
|
|
|
|
onTap: () async {
|
|
|
|
Map<String, String> params = {
|
|
|
|
'rid': rid,
|
|
|
|
};
|
|
|
|
String tid;
|
|
|
|
for (int i = 0;
|
|
|
|
i < tableManagerModel.tableTypeList.length;
|
|
|
|
i++) {
|
|
|
|
if (value['bjtype'] ==
|
|
|
|
tableManagerModel.tableTypeList[i].name) {
|
|
|
|
tid = tableManagerModel.tableTypeList[i].id;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (value['mulcreate'] == 'true') {
|
|
|
|
//批量创建
|
|
|
|
params['tablenum'] = value['tablenum'];
|
|
|
|
params['pnum'] = '10';
|
|
|
|
params['most_pnum'] = '10';
|
|
|
|
// params['name'] = 'lll';
|
|
|
|
} else {
|
|
|
|
//单个创建
|
|
|
|
params['name'] = value['name'];
|
|
|
|
if (value['pnumMin'] != '') {
|
|
|
|
params['pnum'] = value['pnumMin'];
|
|
|
|
}
|
|
|
|
if (value['pnumMax'] != '') {
|
|
|
|
params['most_pnum'] = value['pnumMax'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool success = await tableManagerModel
|
|
|
|
.addTable(context, params, tid: tid);
|
|
|
|
print(success);
|
|
|
|
if (success) {
|
|
|
|
Utils.showToast('添加成功!');
|
|
|
|
// TableOuter tableOuter = TableOuter();
|
|
|
|
// tableOuter.name = value;
|
|
|
|
// tableOuter.list = [];
|
|
|
|
// tableManagerModel.tableOuterList.add(tableOuter);
|
|
|
|
// tableManagerModel.initData();
|
|
|
|
// Timer(
|
|
|
|
// Duration(milliseconds: 500),
|
|
|
|
// () => _areaController.jumpTo(
|
|
|
|
// _areaController.position.maxScrollExtent));
|
|
|
|
|
|
|
|
// await tableManagerModel
|
|
|
|
// .getTableList(context);
|
|
|
|
// await tableManagerModel
|
|
|
|
// .initData();
|
|
|
|
// TableManagerModel tableManagerModel1 =
|
|
|
|
// Provider.of<TableManagerModel>(context,
|
|
|
|
// listen: false);
|
|
|
|
// tableManagerModel1.getTableList(
|
|
|
|
// context,
|
|
|
|
// needLoading: false,
|
|
|
|
// );
|
|
|
|
await tableManagerModel.refreshTable(context);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
child: DottedBorder(
|
|
|
|
dashPattern: [8, 8, 8, 8],
|
|
|
|
borderType: BorderType.RRect,
|
|
|
|
radius: Radius.circular(ScreenUtil().setWidth(10)),
|
|
|
|
// padding: EdgeInsets.all(ScreenUtil().setWidth(70)),
|
|
|
|
color: MyColours.color_438E93,
|
|
|
|
strokeWidth: ScreenUtil().setWidth(2),
|
|
|
|
child: ClipRRect(
|
|
|
|
borderRadius: BorderRadius.all(
|
|
|
|
Radius.circular(ScreenUtil().setWidth(10))),
|
|
|
|
child: Container(
|
|
|
|
height: ScreenUtil().screenWidth -
|
|
|
|
ScreenUtil().setWidth(48 * 3 + 32 * 2),
|
|
|
|
width: ScreenUtil().screenWidth -
|
|
|
|
ScreenUtil().setWidth(48 * 3 + 32 * 2),
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Image.asset(Utils.getImgPath('add_area'),
|
|
|
|
width: ScreenUtil().setWidth(60)),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)))));
|
|
|
|
} else {
|
|
|
|
draggableGridItem = DraggableGridItem(
|
|
|
|
isDraggable: true,
|
|
|
|
dragCallback: (context, isDragging) {
|
|
|
|
print('isDragging: $isDragging');
|
|
|
|
},
|
|
|
|
child: Selector<MyTableManageHomeModel, t.Table>(
|
|
|
|
shouldRebuild: (pre, next) => true,
|
|
|
|
selector: (context, model) =>
|
|
|
|
tableManagerModel.tableOuterList[i].list[j],
|
|
|
|
builder: (context, table, _) {
|
|
|
|
return ManageTableItem(table,
|
|
|
|
canMulSelected: tableManagerModel
|
|
|
|
.tableOuterList[i].isSelect, onSelected: (table) async {
|
|
|
|
if (tableManagerModel.tableOuterList[i].isSelect) {
|
|
|
|
//多选
|
|
|
|
setState(() {
|
|
|
|
table.selected = !(table.selected ?? false);
|
|
|
|
});
|
|
|
|
if (table.selected) {
|
|
|
|
tableManagerModel.tableOuterList[i].selectTables
|
|
|
|
.add(table);
|
|
|
|
} else {
|
|
|
|
tableManagerModel.tableOuterList[i].selectTables
|
|
|
|
.removeWhere((t) => t.id == table.id);
|
|
|
|
}
|
|
|
|
// tableManagerModel
|
|
|
|
// .tableOuterList[tableManagerModel.selectNumber]
|
|
|
|
// .isAll =
|
|
|
|
// tableManagerModel.tableOuterList[i].list
|
|
|
|
// .every((element) => element.selected);
|
|
|
|
} else {
|
|
|
|
// for (t.Table item
|
|
|
|
// in tableManagerModel.tableOuterList[i].list) {
|
|
|
|
// item.selected = false;
|
|
|
|
// }
|
|
|
|
// tableManagerModel.tableOuterList[i].selectTables = [];
|
|
|
|
// //单选
|
|
|
|
// setState(() {
|
|
|
|
// table.selected = true;
|
|
|
|
// });
|
|
|
|
//修改桌位
|
|
|
|
print(table);
|
|
|
|
List<String> tableTypeS = [];
|
|
|
|
for (int i = 0;
|
|
|
|
i < tableManagerModel.tableTypeList.length;
|
|
|
|
i++) {
|
|
|
|
tableTypeS.add(tableManagerModel.tableTypeList[i].name);
|
|
|
|
}
|
|
|
|
|
|
|
|
//添加桌位弹框
|
|
|
|
await DialogUtil.openMyTableManageCreateTableDialog(
|
|
|
|
List<t.Table> selectTables = [];
|
|
|
|
if (table.tids != null && table.tids.length > 0) {
|
|
|
|
List<String> tids = table.tids.split(',');
|
|
|
|
tableManagerModel.tableOuterList.forEach((element) {
|
|
|
|
element.list.forEach((table) {
|
|
|
|
tids.forEach((tid) {
|
|
|
|
if (tid == table.id) {
|
|
|
|
selectTables.add(table);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
await DialogUtil.openMyTableManageModifyTableDialog(
|
|
|
|
context, tableTypeS, personNumList,
|
|
|
|
onTap: (Map<String, String> value) async {
|
|
|
|
print(value);
|
|
|
|
// 'areaname':
|
|
|
|
// areas[currentAreaIndex],
|
|
|
|
// 'name': controller.text,
|
|
|
|
// 'pnumMin': pnumMin,
|
|
|
|
// 'pnumMax': pnumMax
|
|
|
|
//添加桌位 接口参数带整合???
|
|
|
|
// 以下是旧的不去,明天添加桌位接口
|
|
|
|
// 'bjtype': baojianList[
|
|
|
|
// currentBaojianIndex],
|
|
|
|
// 'name': controller.text,
|
|
|
|
// 'pnumMin': pnumMin,
|
|
|
|
// 'pnumMax': pnumMax,
|
|
|
|
// 'mulcreate':
|
|
|
|
// mulCreate.toString(),
|
|
|
|
// 'tablenum':
|
|
|
|
// _norNumController.text
|
|
|
|
String rid;
|
|
|
|
for (Area item in tableManagerModel.areas) {
|
|
|
|
if (item.name == tableManagerModel.currentArea) {
|
|
|
|
rid = item.rid;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
name: table.name,
|
|
|
|
tidStr: table.tidStr,
|
|
|
|
pnumMin: table.table_pnum ?? '',
|
|
|
|
pnumMax: table.most_pnum ?? '',
|
|
|
|
isLock: table.isLock ?? '0',
|
|
|
|
isMerge: table.isMerge ?? '0',
|
|
|
|
tableid: table.id,
|
|
|
|
table: table,
|
|
|
|
selectTables: selectTables,
|
|
|
|
onTapDel: (Map<String, dynamic> value) async {
|
|
|
|
Map<String, String> params = {
|
|
|
|
'rid': rid,
|
|
|
|
'sid': Provider.of<UserModel>(context, listen: false)
|
|
|
|
.user
|
|
|
|
.sellerid,
|
|
|
|
'tid': table.id
|
|
|
|
};
|
|
|
|
String tid;
|
|
|
|
for (int i = 0;
|
|
|
|
i < tableManagerModel.tableTypeList.length;
|
|
|
|
i++) {
|
|
|
|
if (value['bjtype'] ==
|
|
|
|
tableManagerModel.tableTypeList[i].name) {
|
|
|
|
tid = tableManagerModel.tableTypeList[i].id;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (value['mulcreate'] == 'true') {
|
|
|
|
//批量创建
|
|
|
|
params['tablenum'] = value['tablenum'];
|
|
|
|
params['pnum'] = '10';
|
|
|
|
params['most_pnum'] = '10';
|
|
|
|
// params['name'] = 'lll';
|
|
|
|
} else {
|
|
|
|
//单个创建
|
|
|
|
params['name'] = value['name'];
|
|
|
|
if (value['pnumMin'] != '') {
|
|
|
|
params['pnum'] = value['pnumMin'];
|
|
|
|
}
|
|
|
|
if (value['pnumMax'] != '') {
|
|
|
|
params['most_pnum'] = value['pnumMax'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool success = await tableManagerModel
|
|
|
|
.addTable(context, params, tid: tid);
|
|
|
|
bool success = await tableManagerModel.delSellerTables(
|
|
|
|
context, params);
|
|
|
|
print(success);
|
|
|
|
if (success) {
|
|
|
|
Utils.showToast('添加成功!');
|
|
|
|
Utils.showToast('删除成功!');
|
|
|
|
// TableOuter tableOuter = TableOuter();
|
|
|
|
// tableOuter.name = value;
|
|
|
|
// tableOuter.list = [];
|
|
...
|
...
|
@@ -341,191 +476,113 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> { |
|
|
|
// .getTableList(context);
|
|
|
|
// await tableManagerModel
|
|
|
|
// .initData();
|
|
|
|
// TableManagerModel tableManagerModel1 =
|
|
|
|
// TableManagerModel tableManagerModel =
|
|
|
|
// Provider.of<TableManagerModel>(context,
|
|
|
|
// listen: false);
|
|
|
|
// tableManagerModel1.getTableList(
|
|
|
|
// tableManagerModel.getTableList(
|
|
|
|
// context,
|
|
|
|
// needLoading: false,
|
|
|
|
// );
|
|
|
|
await tableManagerModel.refreshTable(context);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
child: DottedBorder(
|
|
|
|
dashPattern: [8, 8, 8, 8],
|
|
|
|
borderType: BorderType.RRect,
|
|
|
|
radius: Radius.circular(ScreenUtil().setWidth(10)),
|
|
|
|
// padding: EdgeInsets.all(ScreenUtil().setWidth(70)),
|
|
|
|
color: MyColours.color_438E93,
|
|
|
|
strokeWidth: ScreenUtil().setWidth(2),
|
|
|
|
child: ClipRRect(
|
|
|
|
borderRadius: BorderRadius.all(
|
|
|
|
Radius.circular(ScreenUtil().setWidth(10))),
|
|
|
|
child: Container(
|
|
|
|
height: ScreenUtil().screenWidth -
|
|
|
|
ScreenUtil().setWidth(48 * 3 + 32 * 2),
|
|
|
|
width: ScreenUtil().screenWidth -
|
|
|
|
ScreenUtil().setWidth(48 * 3 + 32 * 2),
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Image.asset(Utils.getImgPath('add_area'),
|
|
|
|
width: ScreenUtil().setWidth(60)),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
))));
|
|
|
|
} else {
|
|
|
|
return Selector<MyTableManageHomeModel, t.Table>(
|
|
|
|
shouldRebuild: (pre, next) => true,
|
|
|
|
selector: (context, model) =>
|
|
|
|
tableManagerModel.tableOuterList[i].list[index],
|
|
|
|
builder: (context, table, _) {
|
|
|
|
return ManageTableItem(table,
|
|
|
|
canMulSelected: tableManagerModel.tableOuterList[i].isSelect,
|
|
|
|
onSelected: (table) async {
|
|
|
|
if (tableManagerModel.tableOuterList[i].isSelect) {
|
|
|
|
//多选
|
|
|
|
setState(() {
|
|
|
|
table.selected = !(table.selected ?? false);
|
|
|
|
});
|
|
|
|
if (table.selected) {
|
|
|
|
tableManagerModel.tableOuterList[i].selectTables.add(table);
|
|
|
|
} else {
|
|
|
|
tableManagerModel.tableOuterList[i].selectTables
|
|
|
|
.removeWhere((t) => t.id == table.id);
|
|
|
|
}
|
|
|
|
// tableManagerModel
|
|
|
|
// .tableOuterList[tableManagerModel.selectNumber]
|
|
|
|
// .isAll =
|
|
|
|
// tableManagerModel.tableOuterList[i].list
|
|
|
|
// .every((element) => element.selected);
|
|
|
|
} else {
|
|
|
|
// for (t.Table item
|
|
|
|
// in tableManagerModel.tableOuterList[i].list) {
|
|
|
|
// item.selected = false;
|
|
|
|
// }
|
|
|
|
// tableManagerModel.tableOuterList[i].selectTables = [];
|
|
|
|
// //单选
|
|
|
|
// setState(() {
|
|
|
|
// table.selected = true;
|
|
|
|
// });
|
|
|
|
//修改桌位
|
|
|
|
print(table);
|
|
|
|
List<String> tableTypeS = [];
|
|
|
|
for (int i = 0;
|
|
|
|
i < tableManagerModel.tableTypeList.length;
|
|
|
|
i++) {
|
|
|
|
tableTypeS.add(tableManagerModel.tableTypeList[i].name);
|
|
|
|
}
|
|
|
|
List<t.Table> selectTables = [];
|
|
|
|
if (table.tids != null && table.tids.length > 0) {
|
|
|
|
List<String> tids = table.tids.split(',');
|
|
|
|
tableManagerModel.tableOuterList.forEach((element) {
|
|
|
|
element.list.forEach((table) {
|
|
|
|
tids.forEach((tid) {
|
|
|
|
if (tid == table.id) {
|
|
|
|
selectTables.add(table);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
await DialogUtil.openMyTableManageModifyTableDialog(
|
|
|
|
context, tableTypeS, personNumList,
|
|
|
|
name: table.name,
|
|
|
|
tidStr: table.tidStr,
|
|
|
|
pnumMin: table.table_pnum ?? '',
|
|
|
|
pnumMax: table.most_pnum ?? '',
|
|
|
|
isLock: table.isLock ?? '0',
|
|
|
|
isMerge: table.isMerge ?? '0',
|
|
|
|
tableid: table.id,
|
|
|
|
table: table,
|
|
|
|
selectTables: selectTables,
|
|
|
|
onTapDel: (Map<String, dynamic> value) async {
|
|
|
|
Map<String, String> params = {
|
|
|
|
'sid': Provider.of<UserModel>(context, listen: false)
|
|
|
|
.user
|
|
|
|
.sellerid,
|
|
|
|
'tid': table.id
|
|
|
|
};
|
|
|
|
|
|
|
|
bool success = await tableManagerModel.delSellerTables(
|
|
|
|
context, params);
|
|
|
|
print(success);
|
|
|
|
if (success) {
|
|
|
|
Utils.showToast('删除成功!');
|
|
|
|
// TableOuter tableOuter = TableOuter();
|
|
|
|
// tableOuter.name = value;
|
|
|
|
// tableOuter.list = [];
|
|
|
|
// tableManagerModel.tableOuterList.add(tableOuter);
|
|
|
|
// tableManagerModel.initData();
|
|
|
|
// Timer(
|
|
|
|
// Duration(milliseconds: 500),
|
|
|
|
// () => _areaController.jumpTo(
|
|
|
|
// _areaController.position.maxScrollExtent));
|
|
|
|
|
|
|
|
// await tableManagerModel
|
|
|
|
// .getTableList(context);
|
|
|
|
// await tableManagerModel
|
|
|
|
// .initData();
|
|
|
|
// TableManagerModel tableManagerModel =
|
|
|
|
// Provider.of<TableManagerModel>(context,
|
|
|
|
// listen: false);
|
|
|
|
// tableManagerModel.getTableList(
|
|
|
|
// context,
|
|
|
|
// needLoading: false,
|
|
|
|
// );
|
|
|
|
await tableManagerModel.refreshTable(context);
|
|
|
|
}
|
|
|
|
}, onTap: (Map<String, String> value) async {
|
|
|
|
// String rid;
|
|
|
|
// for (Area item in tableManagerModel.areas) {
|
|
|
|
// if (item.name == tableManagerModel.currentArea) {
|
|
|
|
// rid = item.rid;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
// Map<String, String> params = {
|
|
|
|
// 'rid': rid,
|
|
|
|
// };
|
|
|
|
_setData(value, table);
|
|
|
|
}, onTap: (Map<String, String> value) async {
|
|
|
|
// String rid;
|
|
|
|
// for (Area item in tableManagerModel.areas) {
|
|
|
|
// if (item.name == tableManagerModel.currentArea) {
|
|
|
|
// rid = item.rid;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
// Map<String, String> params = {
|
|
|
|
// 'rid': rid,
|
|
|
|
// };
|
|
|
|
_setData(value, table);
|
|
|
|
|
|
|
|
// if(isMerge == '1'){
|
|
|
|
// //
|
|
|
|
// }
|
|
|
|
|
|
|
|
// if (success) {
|
|
|
|
// Utils.showToast('修改成功!');
|
|
|
|
// // TableOuter tableOuter = TableOuter();
|
|
|
|
// // tableOuter.name = value;
|
|
|
|
// // tableOuter.list = [];
|
|
|
|
// // tableManagerModel.tableOuterList.add(tableOuter);
|
|
|
|
// // tableManagerModel.initData();
|
|
|
|
// // Timer(
|
|
|
|
// // Duration(milliseconds: 500),
|
|
|
|
// // () => _areaController.jumpTo(
|
|
|
|
// // _areaController.position.maxScrollExtent));
|
|
|
|
|
|
|
|
// // await tableManagerModel
|
|
|
|
// // .getTableList(context);
|
|
|
|
// // await tableManagerModel
|
|
|
|
// // .initData();
|
|
|
|
// await tableManagerModel.refreshTable(context);
|
|
|
|
// }
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
// if (success) {
|
|
|
|
// Utils.showToast('修改成功!');
|
|
|
|
// // TableOuter tableOuter = TableOuter();
|
|
|
|
// // tableOuter.name = value;
|
|
|
|
// // tableOuter.list = [];
|
|
|
|
// // tableManagerModel.tableOuterList.add(tableOuter);
|
|
|
|
// // tableManagerModel.initData();
|
|
|
|
// // Timer(
|
|
|
|
// // Duration(milliseconds: 500),
|
|
|
|
// // () => _areaController.jumpTo(
|
|
|
|
// // _areaController.position.maxScrollExtent));
|
|
|
|
|
|
|
|
// // await tableManagerModel
|
|
|
|
// // .getTableList(context);
|
|
|
|
// // await tableManagerModel
|
|
|
|
// // .initData();
|
|
|
|
// await tableManagerModel.refreshTable(context);
|
|
|
|
// }
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
// draggableGridItem = DraggableGridItem(
|
|
|
|
// dragCallback: (context, isDragging) {
|
|
|
|
// print('isDragging: $isDragging');
|
|
|
|
// },
|
|
|
|
// child: Container(
|
|
|
|
// color: Colors.red,
|
|
|
|
// width: 100,
|
|
|
|
// height: 100,
|
|
|
|
// ),isDraggable: true);
|
|
|
|
_listOfDraggableGridItem.add(draggableGridItem);
|
|
|
|
}
|
|
|
|
|
|
|
|
return DraggableGridViewBuilder(
|
|
|
|
controller: controller,
|
|
|
|
// physics: NeverScrollableScrollPhysics(),
|
|
|
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
// itemCount: tableManagerModel.tableOuterList[i].list.length + 1,
|
|
|
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
|
|
|
crossAxisCount: 4,
|
|
|
|
childAspectRatio: 1,
|
|
|
|
mainAxisSpacing: ScreenUtil().setWidth(28),
|
|
|
|
crossAxisSpacing: ScreenUtil().setWidth(48),
|
|
|
|
),
|
|
|
|
children: _listOfDraggableGridItem,
|
|
|
|
|
|
|
|
dragCompletion: onDragAccept,
|
|
|
|
isOnlyLongPress: true,
|
|
|
|
dragFeedback: feedback,
|
|
|
|
dragPlaceHolder: placeHolder,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget feedback(List<DraggableGridItem> list, int index) {
|
|
|
|
double size =
|
|
|
|
(ScreenUtil().screenWidth - ScreenUtil().setWidth(28) * 3) / 4;
|
|
|
|
return SizedBox(
|
|
|
|
width: size * 0.8,
|
|
|
|
height: size * 0.8,
|
|
|
|
child: list[index].child,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
PlaceHolderWidget placeHolder(List<DraggableGridItem> list, int index) {
|
|
|
|
return PlaceHolderWidget(
|
|
|
|
child: Container(
|
|
|
|
color: Colors.white,
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
void onDragAccept(
|
|
|
|
List<DraggableGridItem> list, int beforeIndex, int afterIndex) {
|
|
|
|
print('onDragAccept: $beforeIndex -> $afterIndex');
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
tableManagerModel =
|
...
|
...
|
|