|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
import 'package:one_key/widgets/v_empty_view.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
import '../../../../provider/user_model.dart';
|
|
|
|
import '../../../../res/colors.dart';
|
|
|
|
import '../../../../utils/screen_util.dart';
|
|
|
|
import '../../../../utils/utils.dart';
|
|
|
|
import '../../../../widgets/MyDivider.dart';
|
|
|
|
import '../../../../widgets/common_button_flat.dart';
|
|
|
|
import '../../../../widgets/round_button.dart';
|
|
|
|
import '../../../../widgets/system_app_bar.dart';
|
|
|
|
|
|
|
|
/***
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* 主厨介绍
|
|
|
|
*/
|
|
|
|
|
|
|
|
class ChefIntroducePage extends StatefulWidget {
|
|
|
|
ChefIntroducePage({Key key}) : super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
_ChefIntroducePageState createState() => _ChefIntroducePageState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _ChefIntroducePageState extends State<ChefIntroducePage> {
|
|
|
|
int currIndex = 0; //样式按钮默认选中第一个
|
|
|
|
|
|
|
|
String sellername; //店铺名称
|
|
|
|
|
|
|
|
TextEditingController chefIntroduceC = TextEditingController();
|
|
|
|
FocusNode chefIntroduceNode = FocusNode();
|
|
|
|
|
|
|
|
TextEditingController chefNameC = TextEditingController();
|
|
|
|
FocusNode chefNameNode = FocusNode();
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
|
|
|
UserModel userModel = Provider.of<UserModel>(context, listen: false);
|
|
|
|
sellername = userModel.user.sellername;
|
|
|
|
setState(() {});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
///图文合并,图文分开,无文字
|
|
|
|
Widget _selectBtnWidget() {
|
|
|
|
return 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(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
'附加主厨介绍',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_515151,
|
|
|
|
fontSize: ScreenUtil().setWidth(32)),
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(74),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Color.fromRGBO(232, 232, 232, 1),
|
|
|
|
borderRadius: BorderRadius.circular(
|
|
|
|
r(11),
|
|
|
|
),
|
|
|
|
// border: Border.all(
|
|
|
|
// width: w(1), color: MyColours.color_438E93),
|
|
|
|
),
|
|
|
|
child: Row(
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: <Widget>[
|
|
|
|
CommonButtonFlat(
|
|
|
|
content: "无介绍",
|
|
|
|
state: currIndex == 0 ? 1 : 0,
|
|
|
|
fontSize: 28,
|
|
|
|
right: false,
|
|
|
|
width: w(52),
|
|
|
|
onPress: () {
|
|
|
|
if (currIndex == 0) return;
|
|
|
|
setState(() {
|
|
|
|
currIndex = 0;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
),
|
|
|
|
currIndex == 2
|
|
|
|
? MyDivider(
|
|
|
|
ScreenUtil().setWidth(4),
|
|
|
|
ScreenUtil().setWidth(46),
|
|
|
|
color: MyColours.color_dfdfdf,
|
|
|
|
)
|
|
|
|
: SizedBox(),
|
|
|
|
CommonButtonFlat(
|
|
|
|
content: "图文合并",
|
|
|
|
state: currIndex == 1 ? 1 : 0,
|
|
|
|
fontSize: 28,
|
|
|
|
width: w(66),
|
|
|
|
left: false,
|
|
|
|
right: false,
|
|
|
|
onPress: () {
|
|
|
|
if (currIndex == 1) return;
|
|
|
|
setState(() {
|
|
|
|
currIndex = 1;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
),
|
|
|
|
currIndex == 0
|
|
|
|
? MyDivider(
|
|
|
|
ScreenUtil().setWidth(4),
|
|
|
|
ScreenUtil().setWidth(46),
|
|
|
|
color: MyColours.color_dfdfdf,
|
|
|
|
)
|
|
|
|
: SizedBox(),
|
|
|
|
Container(
|
|
|
|
child: CommonButtonFlat(
|
|
|
|
content: "图文分开",
|
|
|
|
left: false,
|
|
|
|
state: currIndex == 2 ? 1 : 0,
|
|
|
|
fontSize: 28,
|
|
|
|
width: w(66),
|
|
|
|
onPress: () {
|
|
|
|
if (currIndex == 2) return;
|
|
|
|
setState(() {
|
|
|
|
currIndex = 2;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
)),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget _introduceWidget(EdgeInsets edgeInsets,
|
|
|
|
{double width = double.infinity,
|
|
|
|
Color textColor = MyColours.color_515151,
|
|
|
|
Color hintColor = MyColours.color_999999,
|
|
|
|
BoxDecoration boxDecoration}) {
|
|
|
|
return Container(
|
|
|
|
width: width,
|
|
|
|
alignment: Alignment.centerRight,
|
|
|
|
padding: edgeInsets,
|
|
|
|
decoration: boxDecoration,
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
'Chief Cook',
|
|
|
|
style: TextStyle(color: MyColours.color_B39437, fontSize: font(14)),
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
'知名主厨',
|
|
|
|
style: TextStyle(color: MyColours.color_B39437, fontSize: font(14)),
|
|
|
|
),
|
|
|
|
VEmptyView(16),
|
|
|
|
// Text(
|
|
|
|
// '${sellername}',
|
|
|
|
// style: TextStyle(color: textColor, fontSize: font(14)),
|
|
|
|
// ),
|
|
|
|
Container(
|
|
|
|
width: double.infinity,
|
|
|
|
alignment: Alignment.topRight,
|
|
|
|
child: TextField(
|
|
|
|
textAlign: TextAlign.right,
|
|
|
|
controller: chefNameC,
|
|
|
|
focusNode: chefNameNode,
|
|
|
|
style: TextStyle(
|
|
|
|
color: textColor,
|
|
|
|
fontSize: ScreenUtil().setSp(28),
|
|
|
|
textBaseline: TextBaseline.alphabetic),
|
|
|
|
textAlignVertical: TextAlignVertical.center,
|
|
|
|
maxLines: 1,
|
|
|
|
decoration: InputDecoration(
|
|
|
|
hintText: "点这里录入主厨姓名",
|
|
|
|
hintStyle: TextStyle(
|
|
|
|
color: hintColor,
|
|
|
|
fontSize: ScreenUtil().setSp(28),
|
|
|
|
),
|
|
|
|
contentPadding: EdgeInsets.zero,
|
|
|
|
border: OutlineInputBorder(borderSide: BorderSide.none),
|
|
|
|
),
|
|
|
|
keyboardType: TextInputType.text,
|
|
|
|
onChanged: (value) {
|
|
|
|
setState(() {
|
|
|
|
// currentRemark = value ?? "";
|
|
|
|
});
|
|
|
|
}),
|
|
|
|
),
|
|
|
|
VEmptyView(32),
|
|
|
|
Container(
|
|
|
|
width: double.infinity,
|
|
|
|
// margin: EdgeInsets.symmetric(horizontal: w(10)),
|
|
|
|
// padding: EdgeInsets.symmetric(horizontal: w(6)),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
border: Border(
|
|
|
|
right: BorderSide(
|
|
|
|
width: w(2), color: MyColours.color_EEAE74))),
|
|
|
|
child: Container(
|
|
|
|
width: double.infinity,
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(12),
|
|
|
|
),
|
|
|
|
alignment: Alignment.topRight,
|
|
|
|
child: TextField(
|
|
|
|
textAlign: TextAlign.right,
|
|
|
|
controller: chefIntroduceC,
|
|
|
|
focusNode: chefIntroduceNode,
|
|
|
|
style: TextStyle(
|
|
|
|
height: 2,
|
|
|
|
color: textColor,
|
|
|
|
fontSize: ScreenUtil().setSp(20),
|
|
|
|
textBaseline: TextBaseline.alphabetic),
|
|
|
|
textAlignVertical: TextAlignVertical.center,
|
|
|
|
maxLines: 7,
|
|
|
|
decoration: InputDecoration(
|
|
|
|
hintText: "点这里录入主厨介绍文字",
|
|
|
|
hintStyle: TextStyle(
|
|
|
|
color: hintColor,
|
|
|
|
fontSize: ScreenUtil().setSp(20),
|
|
|
|
),
|
|
|
|
contentPadding: EdgeInsets.zero,
|
|
|
|
border: OutlineInputBorder(borderSide: BorderSide.none),
|
|
|
|
),
|
|
|
|
keyboardType: TextInputType.text,
|
|
|
|
onChanged: (value) {
|
|
|
|
setState(() {
|
|
|
|
// currentRemark = value ?? "";
|
|
|
|
});
|
|
|
|
}),
|
|
|
|
)),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
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),
|
|
|
|
))
|
|
|
|
],
|
|
|
|
),
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
///无文字
|
|
|
|
Widget _noTextWidget() {
|
|
|
|
return Column(
|
|
|
|
children: [
|
|
|
|
_uploadImage(false),
|
|
|
|
VEmptyView(18),
|
|
|
|
],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
///图文合并
|
|
|
|
Widget _mergingWidget() {
|
|
|
|
return Column(
|
|
|
|
children: [
|
|
|
|
Stack(
|
|
|
|
children: [
|
|
|
|
_uploadImage(
|
|
|
|
true,
|
|
|
|
padding: EdgeInsets.only(left: w(160)),
|
|
|
|
),
|
|
|
|
Positioned(
|
|
|
|
child: _introduceWidget(
|
|
|
|
EdgeInsets.only(
|
|
|
|
left: w(15), top: w(23), right: w(7), bottom: w(42)),
|
|
|
|
textColor: MyColours.color_ffffff,
|
|
|
|
hintColor: MyColours.color_ffffff,
|
|
|
|
boxDecoration: BoxDecoration(
|
|
|
|
gradient: LinearGradient(
|
|
|
|
stops: [0, 1],
|
|
|
|
begin: Alignment.topCenter,
|
|
|
|
end: Alignment.bottomCenter,
|
|
|
|
colors: [
|
|
|
|
MyColours.color_0C0F0E,
|
|
|
|
MyColours.color_4D0C0F0E,
|
|
|
|
],
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
width: w(160),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
///图文分开
|
|
|
|
Widget _separateWidget() {
|
|
|
|
return Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
|
|
|
_introduceWidget(EdgeInsets.all(w(15)),
|
|
|
|
boxDecoration: BoxDecoration(color: MyColours.color_ffffff)),
|
|
|
|
VEmptyView(18),
|
|
|
|
_uploadImage(false),
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Scaffold(
|
|
|
|
backgroundColor: MyColours.color_ffffff,
|
|
|
|
appBar: SystemAppBar(
|
|
|
|
'主厨介绍',
|
|
|
|
onTap: () {
|
|
|
|
Navigator.pop(context);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
body: Column(
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
_selectBtnWidget(),
|
|
|
|
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),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
VEmptyView(24),
|
|
|
|
currIndex == 0
|
|
|
|
? _noTextWidget()
|
|
|
|
: currIndex == 1
|
|
|
|
? _mergingWidget()
|
|
|
|
: _separateWidget(),
|
|
|
|
VEmptyView(18),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
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: () {},
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
));
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|