|
...
|
...
|
@@ -10,6 +10,7 @@ import 'package:one_key/provider/user_model.dart'; |
|
|
|
import 'package:one_key/res/colors.dart';
|
|
|
|
import 'package:one_key/route/navigator_util.dart';
|
|
|
|
import 'package:one_key/utils/event_bus.dart';
|
|
|
|
import 'package:one_key/utils/utils.dart';
|
|
|
|
import 'package:one_key/widgets/MyDivider.dart';
|
|
|
|
import 'package:one_key/widgets/h_empty_view.dart';
|
|
|
|
import 'package:one_key/widgets/page_exception.dart';
|
|
...
|
...
|
@@ -17,6 +18,7 @@ import 'package:one_key/widgets/round_button.dart'; |
|
|
|
import 'package:one_key/widgets/system_app_bar.dart';
|
|
|
|
import 'package:one_key/widgets/v_empty_view.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
|
|
|
|
|
|
|
|
class MenuManagePage extends StatefulWidget {
|
|
|
|
MenuManagePage({Key key}) : super(key: key);
|
|
...
|
...
|
@@ -76,6 +78,10 @@ class _MenuManagePageState extends State<MenuManagePage> { |
|
|
|
showMsg: "加载中,请稍后...",
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
// double cellWidth = (MediaQuery.of(context).size.width -
|
|
|
|
// ScreenUtil().setWidth(40 * 2 + 15 * 2) / 2);
|
|
|
|
// double desiredCellHeight = ScreenUtil().setWidth(700);
|
|
|
|
// double childAspectRatio = cellWidth / desiredCellHeight;
|
|
|
|
return Column(children: [
|
|
|
|
Expanded(
|
|
|
|
child: ListView.builder(
|
|
...
|
...
|
@@ -123,55 +129,105 @@ class _MenuManagePageState extends State<MenuManagePage> { |
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
GridView.builder(
|
|
|
|
controller: _controller,
|
|
|
|
physics: NeverScrollableScrollPhysics(),
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
vertical: ScreenUtil().setWidth(40)),
|
|
|
|
shrinkWrap: true,
|
|
|
|
cacheExtent: ScreenUtil().setWidth(0),
|
|
|
|
itemCount: menuManageProvider
|
|
|
|
StaggeredGridView.countBuilder(
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
vertical: ScreenUtil().setWidth(40)),
|
|
|
|
shrinkWrap: true,
|
|
|
|
crossAxisCount: 4,
|
|
|
|
itemCount: menuManageProvider
|
|
|
|
.menuModel[indexOut].cookbooklist.length,
|
|
|
|
physics: NeverScrollableScrollPhysics(),
|
|
|
|
itemBuilder:
|
|
|
|
(BuildContext context, int index) {
|
|
|
|
MenuSunModel model = menuManageProvider
|
|
|
|
.menuModel[indexOut]
|
|
|
|
.cookbooklist
|
|
|
|
.length,
|
|
|
|
gridDelegate:
|
|
|
|
SliverGridDelegateWithFixedCrossAxisCount(
|
|
|
|
crossAxisCount: 2,
|
|
|
|
childAspectRatio: 80 / 56,
|
|
|
|
mainAxisSpacing:
|
|
|
|
ScreenUtil().setWidth(15 * 2),
|
|
|
|
crossAxisSpacing:
|
|
|
|
ScreenUtil().setWidth(15 * 2)),
|
|
|
|
itemBuilder:
|
|
|
|
(BuildContext context, int index) {
|
|
|
|
MenuSunModel model = menuManageProvider
|
|
|
|
.menuModel[indexOut]
|
|
|
|
.cookbooklist[index];
|
|
|
|
return Container(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: index % 2 == 0
|
|
|
|
? Color.fromRGBO(
|
|
|
|
247, 230, 230, 1)
|
|
|
|
: Color.fromRGBO(
|
|
|
|
234, 236, 252, 1),
|
|
|
|
borderRadius: BorderRadius.circular(
|
|
|
|
ScreenUtil().setWidth(10))),
|
|
|
|
child: model.image != null
|
|
|
|
? ClipRRect(
|
|
|
|
borderRadius:
|
|
|
|
BorderRadius.circular(
|
|
|
|
ScreenUtil()
|
|
|
|
.setWidth(10)),
|
|
|
|
child: CachedNetworkImage(
|
|
|
|
imageUrl: model.image,
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
width: ScreenUtil()
|
|
|
|
.setWidth(30 * 2),
|
|
|
|
height: ScreenUtil()
|
|
|
|
.setWidth(30 * 2),
|
|
|
|
.cookbooklist[index];
|
|
|
|
double cellWidth = ((MediaQuery.of(context)
|
|
|
|
.size
|
|
|
|
.width -
|
|
|
|
ScreenUtil()
|
|
|
|
.setWidth(40 * 2 + 15 * 2)) /
|
|
|
|
2);
|
|
|
|
return model.image != null
|
|
|
|
? Stack(children: [
|
|
|
|
Column(
|
|
|
|
crossAxisAlignment:
|
|
|
|
CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius:
|
|
|
|
BorderRadius.circular(
|
|
|
|
ScreenUtil()
|
|
|
|
.setWidth(
|
|
|
|
10))),
|
|
|
|
child: ClipRRect(
|
|
|
|
borderRadius: BorderRadius
|
|
|
|
.circular(ScreenUtil()
|
|
|
|
.setWidth(10)),
|
|
|
|
child: CachedNetworkImage(
|
|
|
|
imageUrl: model.image,
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
width: cellWidth,
|
|
|
|
height: ScreenUtil()
|
|
|
|
.setWidth(210),
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
VEmptyView(15),
|
|
|
|
Text(
|
|
|
|
model.name,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours
|
|
|
|
.color_333333,
|
|
|
|
fontSize: ScreenUtil()
|
|
|
|
.setSp(34),
|
|
|
|
fontWeight:
|
|
|
|
FontWeight.bold),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
: Container(
|
|
|
|
VEmptyView(20),
|
|
|
|
Text(
|
|
|
|
'${model.price}元/${model.unit}',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours
|
|
|
|
.color_333333,
|
|
|
|
fontSize: ScreenUtil()
|
|
|
|
.setSp(28),
|
|
|
|
))
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Positioned(
|
|
|
|
bottom:
|
|
|
|
ScreenUtil().setWidth(14),
|
|
|
|
right:
|
|
|
|
ScreenUtil().setWidth(20),
|
|
|
|
child: model.status == '1'
|
|
|
|
? SizedBox()
|
|
|
|
: Image.asset(
|
|
|
|
Utils.getImgPath(
|
|
|
|
'stop-sell'),
|
|
|
|
width: ScreenUtil()
|
|
|
|
.setWidth(82),
|
|
|
|
height: ScreenUtil()
|
|
|
|
.setWidth(52),
|
|
|
|
)),
|
|
|
|
])
|
|
|
|
: Stack(children: [
|
|
|
|
Container(
|
|
|
|
width: cellWidth,
|
|
|
|
height:
|
|
|
|
ScreenUtil().setWidth(210),
|
|
|
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: index % 2 == 0
|
|
|
|
? Color.fromRGBO(
|
|
|
|
247, 230, 230, 1)
|
|
|
|
: Color.fromRGBO(
|
|
|
|
234, 236, 252, 1),
|
|
|
|
borderRadius:
|
|
|
|
BorderRadius.circular(
|
|
|
|
ScreenUtil()
|
|
|
|
.setWidth(10))),
|
|
|
|
child: Container(
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil()
|
|
|
|
.setWidth(20)),
|
|
...
|
...
|
@@ -203,17 +259,57 @@ class _MenuManagePageState extends State<MenuManagePage> { |
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
})
|
|
|
|
|
|
|
|
// VEmptyView(15),
|
|
|
|
// Text(
|
|
|
|
// ' ',
|
|
|
|
// style: TextStyle(
|
|
|
|
// color: MyColours.color_333333,
|
|
|
|
// fontSize:
|
|
|
|
// ScreenUtil().setSp(34),
|
|
|
|
// fontWeight: FontWeight.bold),
|
|
|
|
// ),
|
|
|
|
// VEmptyView(20),
|
|
|
|
// Text(' ',
|
|
|
|
// style: TextStyle(
|
|
|
|
// color: MyColours.color_333333,
|
|
|
|
// fontSize:
|
|
|
|
// ScreenUtil().setSp(28),
|
|
|
|
// ))
|
|
|
|
),
|
|
|
|
Positioned(
|
|
|
|
bottom:
|
|
|
|
ScreenUtil().setWidth(46),
|
|
|
|
right:
|
|
|
|
ScreenUtil().setWidth(20),
|
|
|
|
child: model.status == '1'
|
|
|
|
? SizedBox()
|
|
|
|
: Image.asset(
|
|
|
|
Utils.getImgPath(
|
|
|
|
'stop-sell'),
|
|
|
|
width: ScreenUtil()
|
|
|
|
.setWidth(82),
|
|
|
|
height: ScreenUtil()
|
|
|
|
.setWidth(52),
|
|
|
|
)),
|
|
|
|
]);
|
|
|
|
},
|
|
|
|
staggeredTileBuilder: (int index) =>
|
|
|
|
new StaggeredTile.count(
|
|
|
|
2,
|
|
|
|
menuManageProvider
|
|
|
|
.menuModel[indexOut]
|
|
|
|
.cookbooklist[index]
|
|
|
|
.image !=
|
|
|
|
null
|
|
|
|
? ScreenUtil().setWidth(4.2)
|
|
|
|
: ScreenUtil().setWidth(2.85)),
|
|
|
|
mainAxisSpacing:
|
|
|
|
ScreenUtil().setWidth(15 * 2),
|
|
|
|
crossAxisSpacing:
|
|
|
|
ScreenUtil().setWidth(15 * 2),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
// onRefresh: () async {
|
|
|
|
// // offset = 0;
|
|
|
|
// // getMessage(showLoading: false);
|
|
|
|
// },
|
|
|
|
// onLoad: () async {
|
|
|
|
// // offset++;
|
|
|
|
// // getMessage(showLoading: false);
|
|
|
|
// },
|
|
|
|
);
|
|
|
|
})),
|
|
|
|
Row(
|
...
|
...
|
|