|
|
|
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 StoreIntroducePage extends StatefulWidget {
|
|
|
|
StoreIntroducePage({Key key}) : super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
_StoreIntroducePageState createState() => _StoreIntroducePageState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _StoreIntroducePageState extends State<StoreIntroducePage> {
|
|
|
|
int currIndex = 0; //样式按钮默认选中第一个
|
|
|
|
|
|
|
|
String sellername; //店铺名称
|
|
|
|
|
|
|
|
TextEditingController storeIntroduceC = TextEditingController();
|
|
|
|
FocusNode storeIntroduceNode = 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() {
|
|
|
|
return Container(
|
|
|
|
alignment: Alignment.centerLeft,
|
|
|
|
padding: EdgeInsets.all(w(15)),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
'Introduce',
|
|
|
|
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: MyColours.color_515151, fontSize: font(14)),
|
|
|
|
),
|
|
|
|
VEmptyView(32),
|
|
|
|
Container(
|
|
|
|
width: double.infinity,
|
|
|
|
margin: EdgeInsets.symmetric(horizontal: w(10)),
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: w(8)),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
border: Border(
|
|
|
|
left: BorderSide(
|
|
|
|
width: w(2), color: MyColours.color_EEAE74))),
|
|
|
|
child: Container(
|
|
|
|
width: double.infinity,
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(12),
|
|
|
|
),
|
|
|
|
alignment: Alignment.topLeft,
|
|
|
|
child: TextField(
|
|
|
|
textAlign: TextAlign.left,
|
|
|
|
controller: storeIntroduceC,
|
|
|
|
focusNode: storeIntroduceNode,
|
|
|
|
style: TextStyle(
|
|
|
|
height: 2,
|
|
|
|
color: MyColours.color_515151,
|
|
|
|
fontSize: ScreenUtil().setSp(20),
|
|
|
|
textBaseline: TextBaseline.alphabetic),
|
|
|
|
textAlignVertical: TextAlignVertical.center,
|
|
|
|
maxLines: 7,
|
|
|
|
decoration: InputDecoration(
|
|
|
|
hintText: "点这里录入餐厅介绍文字",
|
|
|
|
hintStyle: TextStyle(
|
|
|
|
color: MyColours.color_999999,
|
|
|
|
fontSize: ScreenUtil().setSp(20),
|
|
|
|
),
|
|
|
|
contentPadding: EdgeInsets.zero,
|
|
|
|
border: OutlineInputBorder(borderSide: BorderSide.none),
|
|
|
|
),
|
|
|
|
keyboardType: TextInputType.text,
|
|
|
|
onChanged: (value) {
|
|
|
|
setState(() {
|
|
|
|
// currentRemark = value ?? "";
|
|
|
|
});
|
|
|
|
}),
|
|
|
|
)),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget _uploadImage(bool hasupload) {
|
|
|
|
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(
|
|
|
|
height: w(25),
|
|
|
|
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),
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
VEmptyView(80),
|
|
|
|
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) {
|
|
|
|
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),
|
|
|
|
_introduceWidget(),
|
|
|
|
VEmptyView(18),
|
|
|
|
_uploadImage(false),
|
|
|
|
VEmptyView(18),
|
|
|
|
_uploadImage(true),
|
|
|
|
VEmptyView(18),
|
|
|
|
_uploadImage(false),
|
|
|
|
VEmptyView(18),
|
|
|
|
_uploadImage(true),
|
|
|
|
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: () {},
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
));
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|