|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
import '../../../../provider/marketing_center_provider.dart';
|
|
|
|
import '../../../../res/colors.dart';
|
|
|
|
import '../../../../utils/screen_util.dart';
|
|
|
|
import '../../../../utils/utils.dart';
|
|
|
|
import '../../../../widgets/round_button.dart';
|
|
|
|
import '../../../../widgets/system_app_bar.dart';
|
|
|
|
import '../../../../widgets/v_empty_view.dart';
|
|
|
|
|
|
|
|
/***
|
|
|
|
* 菜品展示
|
|
|
|
*/
|
|
|
|
|
|
|
|
class DishShowPage extends StatefulWidget {
|
|
|
|
DishShowPage({Key key}) : super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
_DishShowPageState createState() => _DishShowPageState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _DishShowPageState extends State<DishShowPage> {
|
|
|
|
MarketingCenterProvider marketingCenterProvider;
|
|
|
|
bool addDish = false;
|
|
|
|
|
|
|
|
Widget _item(String title, {bool select, GestureTapCallback onTap}) {
|
|
|
|
return InkWell(
|
|
|
|
onTap: onTap,
|
|
|
|
child: Container(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
border: Border(
|
|
|
|
bottom: BorderSide(
|
|
|
|
color: MyColours.color_E7E7E7, width: w(0.5)))),
|
|
|
|
margin: EdgeInsets.only(left: w(16)),
|
|
|
|
padding: EdgeInsets.only(top: w(12), bottom: w(12), right: w(16)),
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
title,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_515151,
|
|
|
|
fontSize: ScreenUtil().setWidth(32)),
|
|
|
|
),
|
|
|
|
Spacer(),
|
|
|
|
Container(
|
|
|
|
padding:
|
|
|
|
EdgeInsets.symmetric(horizontal: w(7), vertical: w(4)),
|
|
|
|
child: Image.asset(
|
|
|
|
Utils.getImgPath(select ? 'swich_on' : 'swich_off'),
|
|
|
|
width: w(44),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
)));
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget _uploadImage(bool hasupload, {EdgeInsets padding = EdgeInsets.zero}) {
|
|
|
|
return InkWell(
|
|
|
|
onTap: () {},
|
|
|
|
child: hasupload
|
|
|
|
? InkWell(
|
|
|
|
onTap: () {
|
|
|
|
print('object');
|
|
|
|
},
|
|
|
|
child: Stack(alignment: Alignment.bottomCenter, children: [
|
|
|
|
Image.network(
|
|
|
|
'https://www.ssfiction.com/wp-content/uploads/2020/08/20200805_5f2b1669e9a24.jpg',
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
height: w(280),
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
width: w(150),
|
|
|
|
height: w(30),
|
|
|
|
color: MyColours.color_4D000000,
|
|
|
|
margin: padding,
|
|
|
|
alignment: Alignment.center,
|
|
|
|
child: Text(
|
|
|
|
'点击图片可以更换',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_F8F9FD,
|
|
|
|
fontSize: font(14),
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
)),
|
|
|
|
]))
|
|
|
|
: Container(
|
|
|
|
color: MyColours.color_d9d9d9,
|
|
|
|
width: double.infinity,
|
|
|
|
height: w(280),
|
|
|
|
padding: padding,
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Image.asset(
|
|
|
|
Utils.getImgPath('add_img'),
|
|
|
|
width: w(63),
|
|
|
|
),
|
|
|
|
VEmptyView(28),
|
|
|
|
Container(
|
|
|
|
width: w(139),
|
|
|
|
height: w(60),
|
|
|
|
child: Text(
|
|
|
|
'点击上传照片\n为了更好的效果\n建议上传4:3照片',
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
style: TextStyle(
|
|
|
|
height: 1.4,
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
fontSize: font(14),
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
))
|
|
|
|
],
|
|
|
|
),
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
marketingCenterProvider =
|
|
|
|
Provider.of<MarketingCenterProvider>(context, listen: true);
|
|
|
|
|
|
|
|
return Scaffold(
|
|
|
|
backgroundColor: MyColours.color_ffffff,
|
|
|
|
appBar: SystemAppBar(
|
|
|
|
'招牌菜展示',
|
|
|
|
onTap: () {
|
|
|
|
Navigator.pop(context);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
body: Column(children: [
|
|
|
|
Expanded(
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
child: Column(children: [
|
|
|
|
_item('附加招牌菜展示', select: addDish, onTap: () {
|
|
|
|
setState(() {
|
|
|
|
addDish = !addDish;
|
|
|
|
});
|
|
|
|
}),
|
|
|
|
VEmptyView(24),
|
|
|
|
Container(
|
|
|
|
alignment: Alignment.centerLeft,
|
|
|
|
padding: EdgeInsets.only(left: w(16)),
|
|
|
|
height: w(48),
|
|
|
|
child: Text(
|
|
|
|
'效果预览',
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: font(16), color: MyColours.color_515151),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
addDish
|
|
|
|
? Column(
|
|
|
|
children: [
|
|
|
|
VEmptyView(24),
|
|
|
|
_uploadImage(false),
|
|
|
|
VEmptyView(18),
|
|
|
|
_uploadImage(true),
|
|
|
|
VEmptyView(18),
|
|
|
|
_uploadImage(true),
|
|
|
|
VEmptyView(18),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
: SizedBox()
|
|
|
|
]))),
|
|
|
|
Container(
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
left: w(45), right: w(45), top: w(12), bottom: w(25)),
|
|
|
|
child: RoundButton(
|
|
|
|
text: '保存',
|
|
|
|
gradientStart: MyColours.color_199095,
|
|
|
|
gradientEnd: MyColours.color_199095,
|
|
|
|
// borderColor: MyColours.color_999999,
|
|
|
|
radius: r(5),
|
|
|
|
fontSize: 34,
|
|
|
|
height: w(40),
|
|
|
|
isBold: true,
|
|
|
|
onPressed: () {},
|
|
|
|
),
|
|
|
|
)
|
|
|
|
]));
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|