Commit 17e37967931d365d40e58e832aeacec793b468dd

Authored by wdn127929
1 parent 43305ba9

桌位菜单联动

... ... @@ -11,14 +11,14 @@ if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = "232"
def flutterVersionCode = "250"
if (flutterVersionCode == null) {
flutterVersionCode = '232'
flutterVersionCode = '250'
}
def flutterVersionName = "2.3.2"
def flutterVersionName = "2.5.0"
if (flutterVersionName == null) {
flutterVersionName = '2.3.2'
flutterVersionName = '2.5.0'
}
apply plugin: 'com.android.application'
... ...
... ... @@ -452,7 +452,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.1;
MTL_ENABLE_DEBUG_INFO = NO;
PROVISIONING_PROFILE_SPECIFIER = "Push Development Profile";
SDKROOT = iphoneos;
... ... @@ -487,7 +487,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
MARKETING_VERSION = 2.3.2;
MARKETING_VERSION = 2.5.0;
PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine;
PRODUCT_NAME = Runner;
PROVISIONING_PROFILE_SPECIFIER = "";
... ... @@ -545,7 +545,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.1;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
PROVISIONING_PROFILE_SPECIFIER = "Push Development Profile";
... ... @@ -596,7 +596,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.1;
MTL_ENABLE_DEBUG_INFO = NO;
PROVISIONING_PROFILE_SPECIFIER = "Push Development Profile";
SDKROOT = iphoneos;
... ... @@ -631,7 +631,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
MARKETING_VERSION = 2.3.2;
MARKETING_VERSION = 2.5.0;
PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine;
PRODUCT_NAME = Runner;
PROVISIONING_PROFILE_SPECIFIER = "";
... ... @@ -666,7 +666,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
MARKETING_VERSION = 2.3.2;
MARKETING_VERSION = 2.5.0;
PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine;
PRODUCT_NAME = Runner;
PROVISIONING_PROFILE_SPECIFIER = "";
... ...
... ... @@ -24,75 +24,76 @@ class AreaItemTableState extends State<AreaItemTable> {
// TODO: implement build
Area area = widget.area;
bool isSelected = area.name == widget.currentArea;
return GestureDetector(
onTap: () {
if (widget.selectCallback != null) {
widget.selectCallback(widget.area);
}
},
child: Stack(
overflow: Overflow.visible,
alignment: Alignment.topLeft,
children: <Widget>[
Container(
width: ScreenUtil().setWidth(104 * 2),
height: ScreenUtil().setWidth(80),
margin: EdgeInsets.only(
right: ScreenUtil().setWidth(20),
top: ScreenUtil().setWidth(20),
),
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(20),
vertical: ScreenUtil().setWidth(10)),
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10)),
return
// GestureDetector(
// onTap: () {
// if (widget.selectCallback != null) {
// widget.selectCallback(widget.area);
// }
// },
// child:
Stack(
overflow: Overflow.visible,
alignment: Alignment.topLeft,
children: <Widget>[
Container(
width: ScreenUtil().setWidth(104 * 2),
height: ScreenUtil().setWidth(80),
margin: EdgeInsets.only(
right: ScreenUtil().setWidth(20),
top: ScreenUtil().setWidth(20),
),
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(20),
vertical: ScreenUtil().setWidth(10)),
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10)),
color:
isSelected ? MyColours.color_199095 : MyColours.color_ffffff,
border: Border.all(
color: MyColours.color_199095,
width: ScreenUtil().setWidth(2))),
child: Text(
area.name,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: isSelected
? MyColours.color_199095
: MyColours.color_ffffff,
border: Border.all(
color: MyColours.color_199095,
width: ScreenUtil().setWidth(2))),
child: Text(
area.name,
style: TextStyle(
color: isSelected
? MyColours.color_ffffff
: MyColours.color_199095,
fontSize: ScreenUtil().setSp(28),
decoration: TextDecoration.none,
fontWeight: FontWeight.normal),
),
? MyColours.color_ffffff
: MyColours.color_199095,
fontSize: ScreenUtil().setSp(28),
decoration: TextDecoration.none,
fontWeight: FontWeight.normal),
),
area.count == -1
? Container()
: Positioned(
left: 0,
top: 0,
child: Container(
width: ScreenUtil().setWidth(78),
height: ScreenUtil().setWidth(30),
alignment: Alignment.center,
decoration: BoxDecoration(
color: area.count <= 0
? MyColours.color_999999
: MyColours.color_63a6d1,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(ScreenUtil().setWidth(10)),
topRight:
Radius.circular(ScreenUtil().setWidth(15)),
bottomRight:
Radius.circular(ScreenUtil().setWidth(15)))),
child: Text(area.count == 0 ? "满座" : "余${area.count}",
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(26),
decoration: TextDecoration.none,
fontWeight: FontWeight.normal)),
),
),
area.count == -1
? Container()
: Positioned(
left: 0,
top: 0,
child: Container(
width: ScreenUtil().setWidth(78),
height: ScreenUtil().setWidth(30),
alignment: Alignment.center,
decoration: BoxDecoration(
color: area.count <= 0
? MyColours.color_999999
: MyColours.color_63a6d1,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(ScreenUtil().setWidth(10)),
topRight: Radius.circular(ScreenUtil().setWidth(15)),
bottomRight:
Radius.circular(ScreenUtil().setWidth(15)))),
child: Text(area.count == 0 ? "满座" : "余${area.count}",
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(26),
decoration: TextDecoration.none,
fontWeight: FontWeight.normal)),
),
],
),
),
],
);
}
}
... ...
import 'dart:async';
import 'dart:ui';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/provider/table_manager_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/utils/dialog_util.dart';
import 'package:one_key/utils/utils.dart';
import 'package:scroll_to_index/scroll_to_index.dart';
class CCMenuPage extends StatefulWidget {
///默认源数据数组
final List<String> menuList;
///头部
final Widget headerWidget;
///底部
final Widget bottomWidget;
///滚动页面列表样式
final IndexedWidgetBuilder itemBuilder;
///默认选中
final int selectIndex;
///点击顶部菜单回调
final ValueChanged<int> onTap;
///下拉刷新事件
final onRefresh;
///顶部菜单样式
final IndexedWidgetBuilder tabBuilder;
///菜单个数
final int itemCount;
///设置选中时的字体选中样式
final TextStyle labelStyle;
///设置未选中字体样式
final TextStyle unselectedLabelStyle;
///设置未选中字体颜色
final Color unselectedLabelColor;
///设置选中字体颜色
final Color labelColor;
///选中下划线的颜色
final Color indicatorColor;
///选中下划线的长度
final TabBarIndicatorSize indicatorSize;
///选中下划线的高度
final double indicatorWeight;
final EdgeInsetsGeometry indicatorPadding;
final TableManagerModel tableManagerModel;
///是否滚动 默认true
final bool isScrollable;
/// 菜单栏高度
final double tabHeight;
/// 空数据样式
final Widget refreshEmptyWidget;
///下拉刷新header样式
final Header refreshHeaderWidget;
CCMenuPage(
{@required this.menuList,
@required this.itemBuilder,
this.headerWidget,
this.bottomWidget,
this.selectIndex = 0,
this.onTap,
this.onRefresh,
this.refreshEmptyWidget,
this.refreshHeaderWidget,
Key key,
this.tableManagerModel})
: this.tabBuilder = null,
this.itemCount = null,
this.labelStyle = null,
this.unselectedLabelStyle = null,
this.unselectedLabelColor = null,
this.labelColor = null,
this.indicatorColor = null,
this.indicatorSize = null,
this.indicatorWeight = null,
this.indicatorPadding = null,
this.isScrollable = null,
this.tabHeight = null,
super(key: key);
CCMenuPage.builder({
Key key,
@required this.tabBuilder,
@required this.itemCount,
@required this.itemBuilder,
this.headerWidget,
this.bottomWidget,
this.selectIndex = 0,
this.onTap,
this.onRefresh,
this.refreshEmptyWidget,
this.refreshHeaderWidget,
this.tableManagerModel,
}) : this.labelStyle = null,
this.unselectedLabelStyle = null,
this.unselectedLabelColor = null,
this.labelColor = null,
this.indicatorColor = null,
this.indicatorSize = null,
this.indicatorWeight = null,
this.indicatorPadding = null,
this.isScrollable = null,
this.menuList = null,
this.tabHeight = null,
super(key: key);
@override
CCMenuPageState createState() => CCMenuPageState();
}
class CCMenuPageState extends State<CCMenuPage> with TickerProviderStateMixin {
List _keyList = [];
List _offsetList = [];
ScrollController _scrollController;
bool _isScrollView = false;
final GlobalKey headerGlobalKey = GlobalKey();
double _headerHeight = 0;
int _selectNumber = 0;
int _itemCount = 0;
double _tabHeight = 0;
EasyRefreshController _easyRefreshController;
// ScrollController _areaController = ScrollController();
AutoScrollController controller;
@override
void initState() {
// TODO: implement initState
super.initState();
initData();
controller = AutoScrollController(
viewportBoundaryGetter: () =>
Rect.fromLTRB(0, 0, 0, MediaQuery.of(context).padding.bottom),
axis: Axis.horizontal);
}
@override
void dispose() {
super.dispose();
_easyRefreshController?.dispose();
_scrollController?.dispose();
}
initData() {
_getItemHeight();
_selectNumber = widget.selectIndex;
_itemCount = _getItemCount();
// _getMenuList();
_keyList = List.generate(_itemCount, (index) => GlobalKey());
_scrollController = new ScrollController();
_scrollController.addListener(() {
var of = _scrollController.offset;
if (of == _scrollController.position.maxScrollExtent) {
_isScrollView = false;
} else {
if (_isScrollView == true) {
return;
}
var oneOffset = _offsetList[0];
bool isOffset = false;
for (int i = _offsetList.length - 1; i > 0; i--) {
var nowOffset = _offsetList[i];
if (of > (nowOffset - oneOffset)) {
isOffset = true;
// _tabController.animateTo(i);
// _areaController.animateTo(i * ScreenUtil().setWidth(104 * 2),
// duration: new Duration(milliseconds: 500), curve: Curves.ease);
_scrollToIndex(i);
widget.tableManagerModel.currentArea =
widget.tableManagerModel.areas[i].name;
widget.tableManagerModel.currentTables = widget.tableManagerModel
.areaTableMap[widget.tableManagerModel.currentArea];
setState(() {});
break;
}
}
if (isOffset == false) {
_scrollToIndex(0);
// _areaController.animateTo(0 * ScreenUtil().setWidth(104 * 2),
// duration: new Duration(milliseconds: 500), curve: Curves.ease);
widget.tableManagerModel.currentArea =
widget.tableManagerModel.areas[0].name;
widget.tableManagerModel.currentTables = widget.tableManagerModel
.areaTableMap[widget.tableManagerModel.currentArea];
setState(() {});
}
}
});
WidgetsBinding.instance.addPostFrameCallback((callback) {
_subInitState();
_anmationMenu();
});
}
updateMenu() {
_itemCount = _getItemCount();
_keyList = List.generate(_itemCount, (index) => GlobalKey());
setState(() {});
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
_subInitState();
_anmationMenu();
});
}
@override
Widget build(BuildContext context) {
// TODO: implement build
return Column(
children: [
Container(
width: double.infinity,
child: _tabBarWidget(),
),
Expanded(
child: Container(
height: MediaQuery.of(context).size.height -
_headerHeight -
MediaQueryData.fromWindow(window).padding.top,
child: SingleChildScrollView(
controller: _scrollController,
child: Column(
children: [
_getListWidget(),
],
),
),
))
],
);
}
Future _scrollToIndex(int index) async {
await controller.scrollToIndex(index,
preferPosition: AutoScrollPosition.begin);
}
Widget _getRow(int index, Widget widget) {
return _wrapScrollTag(
index: index,
child: widget,
);
}
Widget _wrapScrollTag({int index, Widget child}) => AutoScrollTag(
key: ValueKey(index),
controller: controller,
index: index,
child: child,
highlightColor: Colors.transparent,
);
Widget _tabBarWidget() {
return Container(
height: ScreenUtil().setWidth(80),
color: MyColours.color_ffffff,
margin: EdgeInsets.only(bottom: ScreenUtil().setWidth(20)),
child: ListView.builder(
itemCount: widget.tableManagerModel.areas.length + 1,
padding: EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(40)),
controller: controller,
scrollDirection: Axis.horizontal,
cacheExtent: ScreenUtil().setWidth(104 * 2),
itemBuilder: (BuildContext context, int index) {
return InkWell(
onTap: () async {
if (index == widget.tableManagerModel.areas.length ||
widget.tableManagerModel.areas.length == 0) {
// widget.onTap(index);
//添加区域弹框
await DialogUtil.openCreateAreaDialog(context,
onTap: (value) async {
print(value);
//添加区域
bool success = await widget.tableManagerModel
.addTableAreas(context, value);
print(success);
if (success) {
Utils.showToast('添加成功!');
await widget.tableManagerModel
.getTableList(context, needLoading: false);
widget.tableManagerModel.initData();
setState(() {
updateMenu();
});
_scrollToIndex(widget.tableManagerModel.areas.length);
// Timer(
// Duration(milliseconds: 500),
// () => _areaController.jumpTo(
// _areaController.position.maxScrollExtent));
}
});
} else {
setState(() {
_selectNumber = index;
widget.tableManagerModel.currentArea =
widget.tableManagerModel.areas[index].name;
widget.tableManagerModel.currentTables = widget
.tableManagerModel
.areaTableMap[widget.tableManagerModel.currentArea];
_anmationMenu();
});
if (widget.onTap != null) {
widget.onTap(index);
}
}
},
child: _getRow(
index,
Container(
child: widget.tabBuilder(context, index),
)));
},
));
}
Widget _getListWidget() {
if (_itemCount == 0) {
return SizedBox();
}
return ListView.builder(
shrinkWrap: true,
physics: new NeverScrollableScrollPhysics(),
itemCount: widget.tableManagerModel.areas.length,
padding: EdgeInsets.zero,
itemBuilder: (BuildContext context, int index) {
GlobalKey itemKey = _keyList[index];
return Container(
key: itemKey, child: widget.itemBuilder(context, index));
},
);
}
_subInitState() {
_offsetList = [];
for (int i = 0; i < _keyList.length; i++) {
var globalKey = _keyList[i];
var offsetY = getY(globalKey.currentContext);
_offsetList.add(offsetY);
}
}
double getY(BuildContext buildContext) {
if (buildContext == null) {
return 0;
}
final RenderBox box = buildContext.findRenderObject();
final topLeftPosition = box.localToGlobal(Offset.zero);
return topLeftPosition.dy;
}
int _getItemCount() {
return widget.tableManagerModel.areas.length;
}
_getItemHeight() {
if (widget.tabBuilder == null && widget.itemCount == null) {
if (widget.tabHeight != null) {
_tabHeight = widget.tabHeight;
} else {
_tabHeight = 30;
}
} else {
_tabHeight = null;
}
}
_anmationMenu() {
if (_selectNumber == 0) {
_isScrollView = false;
_scrollToIndex(_selectNumber);
// _areaController.animateTo(_selectNumber * ScreenUtil().setWidth(104 * 2),
// duration: new Duration(milliseconds: 500), curve: Curves.ease);
// _tabController.animateTo(_selectNumber);
_scrollController.jumpTo(0);
} else {
_isScrollView = false;
// _tabController.animateTo(_selectNumber);
_scrollToIndex(_selectNumber);
// _areaController.animateTo(_selectNumber * ScreenUtil().setWidth(104 * 2),
// duration: new Duration(milliseconds: 500), curve: Curves.ease);
var oneOffset = _offsetList[0];
var nowOffset = _offsetList[_selectNumber] - oneOffset + _headerHeight;
if (nowOffset <= _scrollController.position.maxScrollExtent) {
_scrollController
.jumpTo(_offsetList[_selectNumber] - _offsetList[0] + 2);
} else {
//滚动到底部
_isScrollView = true;
if (_scrollController.offset ==
_scrollController.position.maxScrollExtent) {
//如果已经滚动到底部 不会走滚动监听回调
_isScrollView = false;
} else {
_scrollController.jumpTo(_scrollController.position.maxScrollExtent);
}
}
}
}
}
... ...
// import 'dart:async';
// import 'package:common_utils/common_utils.dart';
// import 'package:dotted_border/dotted_border.dart';
// import 'package:flutter/material.dart';
// import 'package:flutter_screenutil/flutter_screenutil.dart';
// import 'package:one_key/constant/state.dart';
// import 'package:one_key/models/area.dart';
// import 'package:one_key/models/notebook_detail.dart';
// import 'package:one_key/models/tableOuter.dart';
// import 'package:one_key/pages/table/area_item_table.dart';
// import 'package:one_key/provider/table_manager_model.dart';
// import 'package:one_key/res/colors.dart';
// import 'package:one_key/utils/dialog_util.dart';
// import 'package:one_key/utils/event_bus.dart';
// import 'package:one_key/route/navigator_util.dart';
// import 'package:one_key/utils/utils.dart';
// import 'package:one_key/widgets/MyDivider.dart';
// import 'package:one_key/widgets/app_bar.dart';
// import 'package:one_key/widgets/area_item.dart';
// import 'package:one_key/widgets/common_button.dart';
// import 'package:one_key/widgets/page_exception.dart';
// import 'package:one_key/widgets/system_app_bar.dart';
// import 'package:one_key/widgets/table_item.dart';
// import 'package:one_key/models/table.dart' as t;
// import 'package:one_key/widgets/v_empty_view.dart';
// import 'package:provider/provider.dart';
// import 'dart:convert' as convert;
// import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
// import 'package:scroll_to_index/scroll_to_index.dart';
// const scrollDuration = Duration(microseconds: 500);
// class TableManagerPage extends StatefulWidget {
// @override
// State<StatefulWidget> createState() {
// // TODO: implement createState
// return new TableManagerPageState();
// }
// }
// class TableManagerPageState extends State<TableManagerPage> {
// TableManagerModel tableManagerModel;
// final ItemScrollController itemScrollController = ItemScrollController();
// bool isTap = false;
// // 进度监听对象
// int min;
// int max;
// ScrollController _areaController = ScrollController();
// AutoScrollController controller;
// List<String> personNumList = [];
// final ItemPositionsListener itemPositionsListener =
// ItemPositionsListener.create();
// @override
// void initState() {
// // TODO: implement initState
// super.initState();
// LogUtil.v("table_manager_page initState");
// for (int i = 1; i < 31; i++) {
// personNumList.add(i.toString());
// }
// controller = AutoScrollController(
// viewportBoundaryGetter: () =>
// Rect.fromLTRB(0, 0, 0, MediaQuery.of(context).padding.bottom),
// axis: Axis.vertical);
// // personNumList.add('30以上');
// tableManagerModel = Provider.of<TableManagerModel>(context, listen: false);
// WidgetsBinding.instance.addPostFrameCallback((_) {
// tableManagerModel.initTime(context);
// EventBus().on("refresh_tablemanager", (arg) {
// //订座-完成预订 刷新管理桌位
// tableManagerModel.getReserveList(context);
// print(tableManagerModel);
// });
// });
// }
// Widget list(List data) => new ListView.custom(
// controller: controller,
// cacheExtent: 1.0, // 只有设置了1.0 才能够准确的标记position 位置
// childrenDelegate: MyChildrenDelegate(
// (BuildContext context, int index) {
// if (!isTap) {
// print(index);
// // setState(() {
// // });
// // tableManagerModel.selectIndex = index;
// // // tableManagerModel.notifyListeners();
// // tableManagerModel.currentArea =
// // tableManagerModel.areas[tableManagerModel.selectIndex].name;
// _areaController.animateTo(index * ScreenUtil().setWidth(104 * 2),
// duration: new Duration(milliseconds: 500),
// curve: Curves.ease);
// }
// return item(index);
// },
// childCount: data.length,
// ),
// );
// // ;
// // void scrollTo(int index) => itemScrollController
// // .scrollTo(
// // index: index,
// // duration: scrollDuration,
// // curve: Curves.easeInOutCubic,
// // alignment: 0)
// // .then((value) {
// // print(tableManagerModel.selectIndex);
// // // _selectIndex = _selectIndex;
// // // // }
// // // isTap = false;
// // // this.setState(() {});
// // }).whenComplete(() {
// // // print('');
// // });
// // void jumpTo(int index) =>
// // itemScrollController.jumpTo(index: index, alignment: 0);
// Widget item(int index) {
// return _wrapScrollTag(index: index, child: itemSun(index));
// }
// Widget _wrapScrollTag({int index, Widget child}) => AutoScrollTag(
// key: ValueKey(index),
// controller: controller,
// index: index,
// child: child,
// highlightColor: Colors.black.withOpacity(0.1),
// );
// /// Generate item number [i].
// Widget itemSun(int i) {
// return SingleChildScrollView(
// child: Column(
// children: [
// VEmptyView(40),
// Container(
// alignment: Alignment.center,
// height: ScreenUtil().setWidth(21 * 2),
// child: Text(tableManagerModel.areas[i].name,
// style: TextStyle(
// fontSize: ScreenUtil().setWidth(30),
// color: MyColours.color_199095)),
// ),
// VEmptyView(30),
// GridView.builder(
// // controller: _areaController,
// physics: NeverScrollableScrollPhysics(),
// padding: EdgeInsets.only(top: 0),
// shrinkWrap: true,
// itemCount: tableManagerModel
// .areaTableMap[tableManagerModel.areas[i].name].length +
// 1,
// gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
// crossAxisCount: 4,
// childAspectRatio: 8 / 9,
// ),
// // mainAxisSpacing: ScreenUtil().setWidth(15 * 2),
// // crossAxisSpacing: ScreenUtil().setWidth(38 * 2)),
// itemBuilder: (BuildContext context, int index) {
// if (index ==
// tableManagerModel
// .areaTableMap[tableManagerModel.areas[i].name].length ||
// tableManagerModel
// .areaTableMap[tableManagerModel.areas[i].name].length ==
// 0) {
// return InkWell(
// onTap: () async {
// List<String> areas = [];
// for (int i = 0; i < tableManagerModel.areas.length; i++) {
// areas.add(tableManagerModel.areas[i].name);
// }
// //添加桌位弹框
// await DialogUtil.openCreateTableDialog(
// context, areas, i, personNumList,
// onTap: (Map<String, String> value) async {
// print(value);
// // 'areaname':
// // areas[currentAreaIndex],
// // 'name': controller.text,
// // 'pnumMin': pnumMin,
// // 'pnumMax': pnumMax
// //添加桌位 接口参数带整合???
// // 以下是旧的不去,明天添加桌位接口
// String rid;
// for (Area item in tableManagerModel.areas) {
// if (item.name == value['areaname']) {
// rid = item.rid;
// }
// }
// Map<String, String> params = {
// 'rid': rid,
// '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);
// 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.refreshTable(context);
// }
// });
// },
// child: Container(
// margin: EdgeInsets.all(ScreenUtil().setWidth(9)),
// child: DottedBorder(
// dashPattern: [5, 5, 5, 5],
// borderType: BorderType.RRect,
// radius: Radius.circular(ScreenUtil().setWidth(10)),
// // padding: EdgeInsets.all(ScreenUtil().setWidth(70)),
// color: MyColours.color_199095,
// strokeWidth: ScreenUtil().setWidth(2),
// child: ClipRRect(
// borderRadius: BorderRadius.all(
// Radius.circular(ScreenUtil().setWidth(10))),
// child: Container(
// height: ScreenUtil().setWidth(90 * 2),
// width: ScreenUtil().setWidth(80 * 2),
// child: Column(
// mainAxisAlignment: MainAxisAlignment.center,
// children: [
// Image.asset(Utils.getImgPath('add_area'),
// width: ScreenUtil().setWidth(32)),
// ],
// ),
// ),
// ),
// )));
// } else {
// return Selector<TableManagerModel, t.Table>(
// shouldRebuild: (pre, next) => true,
// selector: (context, model) => tableManagerModel
// .areaTableMap[tableManagerModel.areas[i].name][index],
// builder: (context, table, _) {
// return TableItem(table, onSelected: (table) {
// if ((table as t.Table).selected) {
// tableManagerModel.selectTables.add(table);
// } else {
// tableManagerModel.selectTables
// .removeWhere((t) => t.id == table.id);
// }
// DialogUtil.showTableManagerDialog(context, table)
// .then((value) {
// if (value != null) {
// switch (value) {
// case 1: //查看详情
// NavigatorUtil.goNotebookDetailPage(context,
// tableManagerModel.tableMap[table.id].id);
// break;
// case 2: //订座
// NavigatorUtil.goNoteBookChangePage(
// context,
// NotebookDetail.fromTableManager(
// tableManagerModel.getCurrDdateStr(),
// tableManagerModel.currTimeIndex.toString(),
// table),
// "");
// break;
// case 3: //停用,启用桌位
// Map<String, String> params = {
// "id": (table as t.Table).id,
// "status":
// (table as t.Table).enable == "1" ? "0" : "1"
// };
// tableManagerModel
// .setSwitchStatus(context, params)
// .then((value) {
// if (value != null) {
// (table as t.Table).enable =
// ((int.parse((table as t.Table).enable) +
// 1) %
// 2)
// .toString();
// if ((table as t.Table).enable == "1") {
// for (Area area in tableManagerModel.areas) {
// if (area.name ==
// tableManagerModel.currentArea) {
// if (table.sign != '5' &&
// table.sign != '1') {
// //已预订
// area.count++;
// }
// break;
// }
// }
// } else {
// for (Area area in tableManagerModel.areas) {
// if (area.name ==
// tableManagerModel.currentArea) {
// if (table.sign != '5' &&
// table.sign != '1') {
// //已预订
// area.count--;
// }
// break;
// }
// }
// }
// tableManagerModel.notifyListeners();
// }
// });
// break;
// }
// }
// });
// },
// canSelected: false,
// fromPage: 'table_manage',
// tableMap: tableManagerModel.tableMap,
// rid: "");
// },
// );
// }
// },
// ),
// ],
// ));
// }
// @override
// Widget build(BuildContext context) {
// return Consumer<TableManagerModel>(
// builder: (context, model, child) {
// return Column(
// children: <Widget>[
// SystemAppBar("桌位", showLeading: false),
// Container(
// color: MyColours.color_ffffff,
// width: double.infinity,
// padding:
// EdgeInsets.symmetric(vertical: ScreenUtil().setHeight(16)),
// child: Row(
// crossAxisAlignment: CrossAxisAlignment.center,
// children: <Widget>[
// Expanded(
// child: Center(
// child: GestureDetector(
// onTap: () {
// DialogUtil.showCalendarDialog(
// context, tableManagerModel.dateTime)
// .then((day) {
// if (day != null) {
// tableManagerModel.createDateText(context, day);
// }
// });
// },
// child: Container(
// child: Text(
// tableManagerModel.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:
// tableManagerModel.morning == "00:00-00:00"
// ? true
// : false,
// child: Padding(
// padding: EdgeInsets.only(
// right: ScreenUtil().setWidth(18)),
// child: CommonButton(
// content: "早市",
// state: tableManagerModel.currTimeIndex == 1
// ? 1
// : 0,
// width: 92,
// height: 48,
// fontSize: 32,
// onPress: () {
// if (tableManagerModel.currTimeIndex == 1)
// return;
// tableManagerModel.currTimeIndex = 1;
// tableManagerModel.getReserveList(context);
// },
// ))),
// Offstage(
// offstage: tableManagerModel.noon == "00:00-00:00"
// ? true
// : false,
// child: Padding(
// padding: EdgeInsets.only(
// right: ScreenUtil().setWidth(18)),
// child: CommonButton(
// content: "午市",
// state: tableManagerModel.currTimeIndex == 2
// ? 1
// : 0,
// width: 92,
// height: 48,
// fontSize: 32,
// onPress: () {
// if (tableManagerModel.currTimeIndex == 2)
// return;
// tableManagerModel.currTimeIndex = 2;
// tableManagerModel.getReserveList(context);
// },
// ))),
// Offstage(
// offstage: tableManagerModel.night == "00:00-00:00"
// ? true
// : false,
// child: Container(
// // padding: EdgeInsets.symmetric(
// // horizontal: ScreenUtil().setWidth(10)),
// child: CommonButton(
// content: "晚市",
// state:
// tableManagerModel.currTimeIndex == 3 ? 1 : 0,
// width: 92,
// height: 48,
// fontSize: 32,
// onPress: () {
// if (tableManagerModel.currTimeIndex == 3)
// return;
// tableManagerModel.currTimeIndex = 3;
// tableManagerModel.getReserveList(context);
// },
// )),
// ),
// ],
// ),
// ),
// )
// ],
// ),
// ),
// Expanded(
// child: Consumer<TableManagerModel>(
// builder: (context, model, child) {
// if (model.pageState != PageState.Success) {
// return ExceptionPage(
// pageState: model.pageState,
// callback: () {
// if (tableManagerModel.tableOuterList.isEmpty) {
// tableManagerModel.getTableList(context);
// } else {
// tableManagerModel.getReserveList(context);
// }
// },
// emptyMsg: "暂时没有桌位哦",
// emptyImg: "empty_search",
// showMsg: "加载中,请稍后...",
// );
// } else {
// return Container(
// color: MyColours.color_ffffff,
// child: Column(children: <Widget>[
// ValueListenableBuilder<Iterable<ItemPosition>>(
// valueListenable:
// itemPositionsListener.itemPositions,
// builder: (context, positions, child) {
// if (positions.isNotEmpty) {
// max = positions
// .where((ItemPosition position) =>
// position.itemLeadingEdge < 1)
// .reduce((ItemPosition max,
// ItemPosition position) =>
// position.itemLeadingEdge >
// max.itemLeadingEdge
// ? position
// : max)
// .index;
// min = positions
// .where((ItemPosition position) =>
// position.itemTrailingEdge > 0)
// .reduce((ItemPosition min,
// ItemPosition position) =>
// position.itemTrailingEdge <
// min.itemTrailingEdge
// ? position
// : min)
// .index;
// // if (isTap) {
// // if (min >= _selectIndex) {
// // _selectIndex = min;
// // } else {
// // //点击按钮的时候
// // _selectIndex = _selectIndex;
// // }
// // isTap = false;
// // } else {
// //手动滑动列表的时候
// // if (max == tableManagerModel.areas.length - 1) {
// // _selectIndex = _selectIndex;
// // } else if (min >= _selectIndex ||
// // max <= _selectIndex) {
// // _selectIndex = min;
// // } else {
// // //点击按钮的时候
// // _selectIndex = _selectIndex;
// // }
// // tableManagerModel.currentArea =
// // tableManagerModel.areas[_selectIndex].name;
// // _areaController.animateTo(
// // _selectIndex *
// // ScreenUtil().setWidth(104 * 2),
// // duration: new Duration(milliseconds: 500),
// // curve: Curves.ease);
// }
// return Container(
// height: ScreenUtil().setWidth(80),
// color: MyColours.color_ffffff,
// margin: EdgeInsets.only(
// bottom: ScreenUtil().setWidth(20)),
// child: ListView.builder(
// padding: EdgeInsets.symmetric(
// horizontal: ScreenUtil().setWidth(40)),
// controller: _areaController,
// scrollDirection: Axis.horizontal,
// itemBuilder: (context, index) {
// if (index ==
// tableManagerModel.areas.length ||
// tableManagerModel.areas.length == 0) {
// return InkWell(
// onTap: () async {
// //添加区域弹框
// await DialogUtil
// .openCreateAreaDialog(context,
// onTap: (value) async {
// print(value);
// //添加区域
// bool success =
// await tableManagerModel
// .addTableAreas(
// context, value);
// print(success);
// if (success) {
// Utils.showToast('添加成功!');
// // TableOuter tableOuter =
// // TableOuter();
// // tableOuter.name = value;
// // tableOuter.list = [];
// // tableManagerModel.tableOuterList
// // .add(tableOuter);
// await tableManagerModel
// .getTableList(context,
// needLoading: false);
// tableManagerModel.initData();
// Timer(
// Duration(milliseconds: 500),
// () => _areaController
// .jumpTo(_areaController
// .position
// .maxScrollExtent));
// // await tableManagerModel
// // .getTableList(context);
// // await tableManagerModel
// // .initData();
// }
// });
// },
// child: Column(
// children: [
// VEmptyView(20),
// DottedBorder(
// dashPattern: [5, 5, 5, 5],
// borderType: BorderType.RRect,
// radius: Radius.circular(
// ScreenUtil().setWidth(10)),
// // padding: EdgeInsets.all(ScreenUtil().setWidth(70)),
// color: MyColours.color_199095,
// strokeWidth:
// ScreenUtil().setWidth(2),
// child: ClipRRect(
// borderRadius: BorderRadius
// .all(Radius.circular(
// ScreenUtil()
// .setWidth(10))),
// child: Container(
// height: ScreenUtil()
// .setWidth(25 * 2),
// width: ScreenUtil()
// .setWidth(104 * 2),
// child: Column(
// mainAxisAlignment:
// MainAxisAlignment
// .center,
// children: [
// Image.asset(
// Utils.getImgPath(
// 'add_area'),
// width: ScreenUtil()
// .setWidth(24)),
// ],
// ),
// ),
// ),
// )
// ],
// ));
// } else {
// return Selector<TableManagerModel, Area>(
// selector: (context, model) =>
// model.areas[index],
// builder: (context, area, _) {
// return AreaItemTable(area,
// tableManagerModel.currentArea,
// (area) async {
// isTap = true;
// setState(() {
// tableManagerModel.selectIndex =
// index;
// });
// await controller.scrollToIndex(
// index,
// preferPosition:
// AutoScrollPosition.begin);
// // scrollTo(index);
// tableManagerModel.currentArea =
// tableManagerModel
// .areas[index].name;
// tableManagerModel.currentTables =
// tableManagerModel.areaTableMap[
// tableManagerModel
// .currentArea];
// });
// },
// );
// }
// },
// itemExtent: ScreenUtil().setWidth(104 * 2),
// itemCount: tableManagerModel.areas.length + 1,
// ),
// );
// }),
// Expanded(
// child: Container(
// color: MyColours.color_f5f5f5,
// padding: EdgeInsets.symmetric(
// horizontal: ScreenUtil().setWidth(24)),
// width: double.infinity,
// child: list(tableManagerModel.areas)),
// ),
// ]),
// );
// }
// },
// ),
// ),
// ],
// );
// },
// );
// }
// @override
// void dispose() {
// // TODO: implement dispose
// super.dispose();
// EventBus().off("refresh_tablemanager");
// }
// }
// class _SaltedValueKey extends ValueKey<Key> {
// const _SaltedValueKey(Key key)
// : assert(key != null),
// super(key);
// }
// class MyChildrenDelegate extends SliverChildBuilderDelegate {
// MyChildrenDelegate(
// Widget Function(BuildContext, int) builder, {
// int childCount,
// bool addAutomaticKeepAlive = true,
// bool addRepaintBoundaries = true,
// }) : super(builder,
// childCount: childCount,
// addAutomaticKeepAlives: addAutomaticKeepAlive,
// addRepaintBoundaries: addRepaintBoundaries);
// // Return a Widget for the given Exception
// Widget _createErrorWidget(dynamic exception, StackTrace stackTrace) {
// final FlutterErrorDetails details = FlutterErrorDetails(
// exception: exception,
// stack: stackTrace,
// library: 'widgets library',
// context: ErrorDescription('building'),
// );
// FlutterError.reportError(details);
// return ErrorWidget.builder(details);
// }
// @override
// Widget build(BuildContext context, int index) {
// assert(builder != null);
// if (index < 0 || (childCount != null && index >= childCount)) return null;
// Widget child;
// try {
// child = builder(context, index);
// } catch (exception, stackTrace) {
// child = _createErrorWidget(exception, stackTrace);
// }
// if (child == null) return null;
// final Key key = child.key != null ? _SaltedValueKey(child.key) : null;
// if (addRepaintBoundaries) child = RepaintBoundary(child: child);
// if (addSemanticIndexes) {
// final int semanticIndex = semanticIndexCallback(child, index);
// if (semanticIndex != null)
// child = IndexedSemantics(
// index: semanticIndex + semanticIndexOffset, child: child);
// }
// if (addAutomaticKeepAlives) child = AutomaticKeepAlive(child: child);
// return KeyedSubtree(child: child, key: key);
// }
// @override
// void didFinishLayout(int firstIndex, int lastIndex) {
// // TODO: implement didFinishLayout
// super.didFinishLayout(firstIndex, lastIndex);
// }
// ///监听 在可见的列表中 显示的第一个位置和最后一个位置
// @override
// double estimateMaxScrollOffset(int firstIndex, int lastIndex,
// double leadingScrollOffset, double trailingScrollOffset) {
// print(
// 'firstIndex sss : $firstIndex, lastIndex ssss : $lastIndex, leadingScrollOffset ssss : $leadingScrollOffset,'
// 'trailingScrollOffset ssss : $trailingScrollOffset ');
// return super.estimateMaxScrollOffset(
// firstIndex, lastIndex, leadingScrollOffset, trailingScrollOffset);
// }
// }
... ...
... ... @@ -9,6 +9,7 @@ import 'package:one_key/models/area.dart';
import 'package:one_key/models/notebook_detail.dart';
import 'package:one_key/models/tableOuter.dart';
import 'package:one_key/pages/table/area_item_table.dart';
import 'package:one_key/pages/table/cc_menu_wdn.dart';
import 'package:one_key/provider/table_manager_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/utils/dialog_util.dart';
... ... @@ -42,9 +43,10 @@ class TableManagerPageState extends State<TableManagerPage> {
TableManagerModel tableManagerModel;
final ItemScrollController itemScrollController = ItemScrollController();
bool isTap = false;
// 进度监听对象
int min;
int max;
int _selectIndex;
int _selectIndex = 0;
ScrollController _areaController = ScrollController();
List<String> personNumList = [];
... ... @@ -59,6 +61,7 @@ class TableManagerPageState extends State<TableManagerPage> {
for (int i = 1; i < 31; i++) {
personNumList.add(i.toString());
}
// personNumList.add('30以上');
tableManagerModel = Provider.of<TableManagerModel>(context, listen: false);
WidgetsBinding.instance.addPostFrameCallback((_) {
... ... @@ -87,8 +90,13 @@ class TableManagerPageState extends State<TableManagerPage> {
curve: Curves.easeInOutCubic,
alignment: 0)
.then((value) {
// print(_selectIndex);
// this.setState(() {});
print(_selectIndex);
// _selectIndex = _selectIndex;
// // }
// isTap = false;
this.setState(() {});
}).whenComplete(() {
// print('');
});
void jumpTo(int index) =>
... ... @@ -447,204 +455,125 @@ class TableManagerPageState extends State<TableManagerPage> {
showMsg: "加载中,请稍后...",
);
} else {
return Container(
color: MyColours.color_ffffff,
child: Column(children: <Widget>[
// VEmptyView(20),
ValueListenableBuilder<Iterable<ItemPosition>>(
valueListenable:
itemPositionsListener.itemPositions,
builder: (context, positions, child) {
if (positions.isNotEmpty) {
// max = positions
// .where((ItemPosition position) =>
// position.itemLeadingEdge < 1)
// .reduce((ItemPosition max,
// ItemPosition position) =>
// position.itemLeadingEdge >
// max.itemLeadingEdge
// ? position
// : max)
// .index;
min = positions
.where((ItemPosition position) =>
position.itemTrailingEdge > 0)
.reduce((ItemPosition min,
ItemPosition position) =>
position.itemTrailingEdge <
min.itemTrailingEdge
? position
: min)
.index;
return CCMenuPage.builder(
tableManagerModel: tableManagerModel,
itemCount: tableManagerModel.areas.length,
onTap: (index) async {
// //添加区域弹框
// await DialogUtil.openCreateAreaDialog(context,
// onTap: (value) async {
// print(value);
// //添加区域
// bool success = await tableManagerModel.addTableAreas(
// context, value);
// print(success);
// if (success) {
// Utils.showToast('添加成功!');
if (isTap) {
if (min >= _selectIndex) {
_selectIndex = min;
} else {
_selectIndex = _selectIndex;
}
isTap = false;
} else {
_selectIndex = min;
}
tableManagerModel.currentArea =
tableManagerModel.areas[_selectIndex].name;
_areaController.animateTo(
_selectIndex *
ScreenUtil().setWidth(104 * 2),
duration: new Duration(milliseconds: 500),
curve: Curves.ease);
}
return Container(
height: ScreenUtil().setWidth(80),
color: MyColours.color_ffffff,
margin: EdgeInsets.only(
bottom: ScreenUtil().setWidth(20)),
child: ListView.builder(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40)),
controller: _areaController,
scrollDirection: Axis.horizontal,
itemBuilder: (context, index) {
if (index ==
tableManagerModel.areas.length ||
tableManagerModel.areas.length == 0) {
return InkWell(
onTap: () async {
//添加区域弹框
await DialogUtil
.openCreateAreaDialog(context,
onTap: (value) async {
print(value);
//添加区域
bool success =
await tableManagerModel
.addTableAreas(
context, value);
print(success);
if (success) {
Utils.showToast('添加成功!');
// TableOuter tableOuter =
// TableOuter();
// tableOuter.name = value;
// tableOuter.list = [];
// tableManagerModel.tableOuterList
// .add(tableOuter);
await tableManagerModel
.getTableList(context,
needLoading: false);
tableManagerModel.initData();
Timer(
Duration(milliseconds: 500),
() => _areaController
.jumpTo(_areaController
.position
.maxScrollExtent));
// await tableManagerModel.getTableList(context,
// needLoading: false);
// tableManagerModel.initData();
// await tableManagerModel
// .getTableList(context);
// await tableManagerModel
// .initData();
}
});
},
child: Column(
children: [
VEmptyView(20),
DottedBorder(
dashPattern: [5, 5, 5, 5],
borderType: BorderType.RRect,
radius: Radius.circular(
ScreenUtil().setWidth(10)),
// padding: EdgeInsets.all(ScreenUtil().setWidth(70)),
color: MyColours.color_199095,
strokeWidth:
ScreenUtil().setWidth(2),
child: ClipRRect(
borderRadius: BorderRadius
.all(Radius.circular(
ScreenUtil()
.setWidth(10))),
child: Container(
height: ScreenUtil()
.setWidth(25 * 2),
width: ScreenUtil()
.setWidth(104 * 2),
child: Column(
mainAxisAlignment:
MainAxisAlignment
.center,
children: [
Image.asset(
Utils.getImgPath(
'add_area'),
width: ScreenUtil()
.setWidth(24)),
],
),
),
),
)
],
));
} else {
return Selector<TableManagerModel, Area>(
selector: (context, model) =>
model.areas[index],
builder: (context, area, _) {
return AreaItemTable(area,
tableManagerModel.currentArea,
(area) {
isTap = true;
_selectIndex = index;
scrollTo(index);
// setState(() {
tableManagerModel.currentArea =
tableManagerModel
.areas[index].name;
tableManagerModel.currentTables =
tableManagerModel.areaTableMap[
tableManagerModel
.currentArea];
// setState(() {});
// if (position.value.first.itemLeadingEdge ==
// itemPositionsListener
// .itemPositions.value.first.itemLeadingEdge) {
// setState(() {
// _selectIndex = index;
// });
// }
// setState(() {});
// Timer(
// Duration(milliseconds: 500),
// () => _areaController.jumpTo(
// _areaController.position.maxScrollExtent));
// }
// });
},
tabBuilder: (BuildContext context, int index) {
if (index == tableManagerModel.areas.length ||
tableManagerModel.areas.length == 0) {
// return InkWell(
// onTap: () async {
// //添加区域弹框
// await DialogUtil.openCreateAreaDialog(context,
// onTap: (value) async {
// print(value);
// //添加区域
// bool success = await tableManagerModel
// .addTableAreas(context, value);
// print(success);
// if (success) {
// Utils.showToast('添加成功!');
// // TableOuter tableOuter =
// // TableOuter();
// // tableOuter.name = value;
// // tableOuter.list = [];
// // tableManagerModel.tableOuterList
// // .add(tableOuter);
// await tableManagerModel.getTableList(
// context,
// needLoading: false);
// tableManagerModel.initData();
// Timer(
// Duration(milliseconds: 500),
// () => _areaController.jumpTo(
// _areaController
// .position.maxScrollExtent));
// });
// setState(() {
// tableManagerModel.currentArea =
// (area as Area).name;
// tableManagerModel.currentTables =
// tableManagerModel.areaTableMap[
// tableManagerModel
// .currentArea];
// });
});
},
);
}
},
itemExtent: ScreenUtil().setWidth(104 * 2),
itemCount: tableManagerModel.areas.length + 1,
// // await tableManagerModel
// // .getTableList(context);
// // await tableManagerModel
// // .initData();
// }
// });
// },
return Column(
children: [
VEmptyView(20),
DottedBorder(
dashPattern: [5, 5, 5, 5],
borderType: BorderType.RRect,
radius:
Radius.circular(ScreenUtil().setWidth(10)),
// padding: EdgeInsets.all(ScreenUtil().setWidth(70)),
color: MyColours.color_199095,
strokeWidth: ScreenUtil().setWidth(2),
child: ClipRRect(
borderRadius: BorderRadius.all(
Radius.circular(
ScreenUtil().setWidth(10))),
child: Container(
height: ScreenUtil().setWidth(25 * 2),
width: ScreenUtil().setWidth(104 * 2),
child: Column(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
Image.asset(
Utils.getImgPath('add_area'),
width: ScreenUtil().setWidth(24)),
],
),
),
),
);
}),
Expanded(
child: Container(
color: MyColours.color_f5f5f5,
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(24)),
width: double.infinity,
child: list(tableManagerModel.areas)),
),
]),
)
],
);
} else {
return AreaItemTable(
model.areas[index], tableManagerModel.currentArea,
(area) {
// isTap = true;
// _selectIndex = index;
// // scrollTo(index);
// tableManagerModel.currentArea =
// tableManagerModel.areas[index].name;
// tableManagerModel.currentTables =
// tableManagerModel.areaTableMap[
// tableManagerModel.currentArea];
});
}
},
itemBuilder: (BuildContext context, int index) {
return item(index);
},
);
}
},
... ...
... ... @@ -31,6 +31,7 @@ class TableManagerModel with ChangeNotifier {
Map<String, Notebook> tableMap = {}; //记录已预订桌位对应的订单
String currentArea; //当前选中区域
int selectIndex = 0;
DateTime dateTime = DateTime.now();
... ... @@ -526,6 +527,8 @@ class TableManagerModel with ChangeNotifier {
} else {
Utils.showToast(baseResp.msg ?? '新增区域失败!');
}
} else {
Utils.showToast(baseResp.msg ?? '新增区域失败!');
}
return false;
}
... ... @@ -554,6 +557,7 @@ class TableManagerModel with ChangeNotifier {
Future<bool> addTable(
BuildContext context, Map<String, String> params) async {
params["sellerid"] = userModel.user.sellerid;
params["tid"] = '2';
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.get, HttpUrl.add_table,
data: params, showLoading: true)
... ... @@ -583,6 +587,8 @@ class TableManagerModel with ChangeNotifier {
} else {
Utils.showToast(baseResp.msg ?? '新增桌位失败!');
}
} else {
Utils.showToast(baseResp.msg ?? '新增桌位失败!');
}
return false;
}
... ...
... ... @@ -383,7 +383,7 @@ packages:
name: flutter_easyrefresh
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.6"
version: "2.2.1"
flutter_picker:
dependency: "direct main"
description:
... ... @@ -793,6 +793,13 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.24.1"
scroll_to_index:
dependency: "direct main"
description:
name: scroll_to_index
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.0"
scrollable_positioned_list:
dependency: "direct main"
description:
... ...
... ... @@ -114,6 +114,8 @@ dependencies:
amap_map_fluttify: 0.25.0
#虚线边框
dotted_border: ^1.0.7
scroll_to_index: ^2.0.0
... ...