Commit 067e3a299c57112ffc0d9cfa11c845c400173aef

Authored by wdn127929
1 parent ef8f6dff

新建宴会部分UI

import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/widgets/MyDivider.dart';
import 'package:one_key/widgets/v_empty_view.dart';
import '../../res/colors.dart';
import '../../utils/dialog_util.dart';
import '../../utils/screen_util.dart';
import '../../utils/utils.dart';
import '../../widgets/h_empty_view.dart';
import '../../widgets/system_app_bar.dart';
class FeastCreatePage extends StatefulWidget {
FeastCreatePage({Key key}) : super(key: key);
@override
_FeastCreatePageState createState() => _FeastCreatePageState();
}
class _FeastCreatePageState extends State<FeastCreatePage> {
TextEditingController nameC = TextEditingController();
TextEditingController phoneC = TextEditingController();
FocusNode nameF = FocusNode();
FocusNode phoneF = FocusNode();
TextEditingController customC = TextEditingController();
FocusNode customF = FocusNode();
List sexList;
int sexSelectIndex = 0;
String sexStr = '先生';
@override
void initState() {
// TODO: implement initState
super.initState();
Utils.changeStatusColor(color: MyColours.color_438E93);
initSexList();
}
///称谓
initSexList() {
String sexStr = '1';
sexList = [
{
'title': '先生',
'select': sexStr == '1' ? true : false,
'code': '1',
'hasLeftBorder': true
},
{
'title': '女士',
'select': sexStr == '2' ? true : false,
'code': '2',
'hasLeftBorder': false
},
{
'title': '公司',
'select': sexStr == '3' ? true : false,
'code': '3',
'hasLeftBorder': false
}
];
}
Widget menuBtn(String title, bool select) {
return Container(
width: w(40),
height: h(40),
alignment: Alignment.center,
decoration: BoxDecoration(
color: select ? MyColours.color_438E93 : MyColours.color_BFC4D4,
borderRadius: BorderRadius.circular(r(20))),
child: Text(
title,
style: TextStyle(color: MyColours.color_F6F6F6, fontSize: font(14)),
),
);
}
Widget arrow() {
return Image.asset(
Utils.getImgPath('f_arrow'),
width: w(24),
height: h(24),
);
}
Widget menu() {
return Padding(
padding: EdgeInsets.all(w(24)),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
menuBtn('意向', true),
arrow(),
menuBtn('选台', false),
arrow(),
menuBtn('定金', false),
arrow(),
menuBtn('签约', false),
],
),
);
}
Widget _selectWidget(String title, String labelShow) {
return InkWell(
onTap: () {
// FocusScope.of(context).requestFocus(FocusNode()); //隐藏键盘
// DialogUtil.showSelectCusmanDialog(
// context,
// customerProvider.labelList.map((item) {
// return item.label;
// }).toList(), (value) {
// if (value != null) {
// setState(() {
// customerProvider.labelSelIndex = value.first;
// labelShow = customerProvider
// .labelList[customerProvider.labelSelIndex].label;
// });
// }
// },
// selecteds: customerProvider.labelSelIndex == null
// ? []
// : [customerProvider.labelSelIndex])
// .then((value) {});
},
child: Container(
// height: ScreenUtil().setWidth(60),
padding: EdgeInsets.only(
left: w(16),
right: w(8),
top: ScreenUtil().setWidth(18 * 2),
bottom: h(14)),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
width: ScreenUtil().setWidth(2),
color: MyColours.color_DBDBDB))),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
width: w(80),
child: RichText(
textScaleFactor: 1,
overflow: TextOverflow.ellipsis,
// textDirection: TextDirection.ltr,
text: TextSpan(
children: [
TextSpan(
text: title,
style: TextStyle(
color: MyColours.color_515151,
fontSize: ScreenUtil().setSp(28)),
recognizer: TapGestureRecognizer()
..onTap = () {}),
TextSpan(
text: '*',
style: TextStyle(
color: MyColours.color_E34D59,
fontSize: ScreenUtil().setSp(28)),
//点击事件
recognizer: TapGestureRecognizer()
..onTap = () {}),
],
))),
Expanded(
child: Text(
labelShow,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: MyColours.color_515151,
fontSize: ScreenUtil().setSp(28),
),
)),
HEmptyView(10),
Image.asset(
Utils.getImgPath('f_arrow_down'),
width: ScreenUtil().setWidth(32 * 2),
// height: ScreenUtil().setWidth(10),
)
],
),
));
}
Widget _inputWidget(String title, String labelShow,
TextEditingController controller, FocusNode node) {
return InkWell(
onTap: () {
// FocusScope.of(context).requestFocus(FocusNode()); //隐藏键盘
// DialogUtil.showSelectCusmanDialog(
// context,
// customerProvider.labelList.map((item) {
// return item.label;
// }).toList(), (value) {
// if (value != null) {
// setState(() {
// customerProvider.labelSelIndex = value.first;
// labelShow = customerProvider
// .labelList[customerProvider.labelSelIndex].label;
// });
// }
// },
// selecteds: customerProvider.labelSelIndex == null
// ? []
// : [customerProvider.labelSelIndex])
// .then((value) {});
},
child: Container(
// height: ScreenUtil().setWidth(60),
padding: EdgeInsets.only(
left: w(16),
right: w(8),
top: ScreenUtil().setWidth(18 * 2),
bottom: h(14)),
decoration: BoxDecoration(
color: MyColours.color_ffffff,
border: Border(
bottom: BorderSide(
width: ScreenUtil().setWidth(2),
color: MyColours.color_DBDBDB))),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
width: w(80),
child: RichText(
textScaleFactor: 1,
overflow: TextOverflow.ellipsis,
// textDirection: TextDirection.ltr,
text: TextSpan(
children: [
TextSpan(
text: title,
style: TextStyle(
color: MyColours.color_515151,
fontSize: ScreenUtil().setSp(28)),
recognizer: TapGestureRecognizer()
..onTap = () {}),
TextSpan(
text: '*',
style: TextStyle(
color: MyColours.color_E34D59,
fontSize: ScreenUtil().setSp(28)),
//点击事件
recognizer: TapGestureRecognizer()
..onTap = () {}),
],
))),
Expanded(
child: Container(
height: h(40),
child: TextField(
maxLines: 1,
//输入文本的样式
style: TextStyle(
fontSize: ScreenUtil().setSp(28),
color: MyColours.color_515151),
controller: controller,
focusNode: node,
// textAlignVertical: TextAlignVertical.top,
decoration: InputDecoration(
hintText: labelShow,
hintStyle: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(28),
),
// contentPadding:
// EdgeInsets.only(bottom: ScreenUtil().setWidth(17)),
// border: InputBorder.none,
contentPadding: EdgeInsets.zero,
border: OutlineInputBorder(borderSide: BorderSide.none),
),
onChanged: (value) {
print('ggg');
// nameStr = value;
},
onEditingComplete: () {
print('fff');
node.unfocus();
// _homeEnterModel.nameController.text =
// nameStr + _nameSuffix();
// _addNameSuffix(nameStr, sexStr);
},
keyboardType: title == '电话'
? TextInputType.number
: TextInputType.text,
)),
),
title == '电话' ? SizedBox() : HEmptyView(10),
title == '电话'
? SizedBox()
: InkWell(
onTap: () {
FocusScope.of(context).requestFocus(FocusNode()); //隐藏键盘
List<String> list = [];
for (Map item in sexList) {
list.add(item['title']);
}
DialogUtil.showSelectCusmanDialog(context, list,
(value) async {
if (value != null) {
sexSelectIndex = value.first;
sexStr = list[sexSelectIndex];
// if (nameStr != null && nameStr != '') {
// _addNameSuffix(nameStr, sexStr);
// }
setState(() {});
}
}, selecteds: [sexSelectIndex]).then((value) {});
},
child: Row(children: [
Text(
sexStr,
style: TextStyle(
color: MyColours.color_515151,
fontSize: ScreenUtil().setSp(28),
),
),
Image.asset(Utils.getImgPath('quan_down_f'),
width: ScreenUtil().setWidth(28),
height: ScreenUtil().setWidth(28)),
]),
)
],
),
));
}
Widget remark() {
return Padding(
padding:
EdgeInsets.only(top: h(29), left: w(16), right: w(18), bottom: h(22)),
child: //输入框
Container(
width: double.infinity,
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(30),
vertical: ScreenUtil().setWidth(18)),
alignment: Alignment.topLeft,
decoration: BoxDecoration(
color: MyColours.color_ffffff,
border: Border.all(
color: MyColours.color_DBDBDB, width: ScreenUtil().setWidth(2)),
borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10))),
child: TextField(
controller: customC,
focusNode: customF,
style: TextStyle(
color: MyColours.color_515151,
fontSize: ScreenUtil().setSp(28),
textBaseline: TextBaseline.alphabetic),
textAlignVertical: TextAlignVertical.center,
maxLines: 5,
maxLength: 100,
decoration: InputDecoration(
hintText: "请输入备注",
hintStyle: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(28),
),
contentPadding: EdgeInsets.zero,
border: OutlineInputBorder(borderSide: BorderSide.none),
),
keyboardType: TextInputType.text,
onChanged: (value) {
// setState(() {
// currentRemark = value ?? "";
// });
// if (value.length < currRemark.length &&
// currRemark.substring(value.length) != ',') {
// setState(() {
// currRemark = value ?? "";
// });
// if (sum == 0) {
// for (int i = 0; i < remarks.length; i++) {
// if (remarks[i].isSelect &&
// remarks[i].remark == selectItem.last) {
// setState(() {
// remarks[i].isSelect = false;
// });
// }
// }
// }
// sum++;
// if (sum == selectItem.last.length ||
// selectItem.length == 1 ||
// selectItem.length == 0) {
// selectItem.removeLast();
// sum = 0;
// }
// } else {
// setState(() {
// currRemark = value ?? "";
// });
// }
}),
),
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: MyColours.color_ffffff,
appBar: SystemAppBar(
'新建宴会',
needWhite: true,
bgColor: MyColours.color_438E93,
titleColor: MyColours.color_F6F6F6,
onTap: () {
Navigator.pop(context);
},
),
body: SingleChildScrollView(
child: Column(children: <Widget>[
menu(),
MyDivider(double.infinity, h(1), color: MyColours.color_DBDBDB),
VEmptyView(26),
_selectWidget('宴会日期', '2022-08-02(周二 七月十五)'),
_selectWidget('接单人', '刘经理'),
_selectWidget('跟单人', '请选择'),
_selectWidget('宴会类型', '请选择'),
_inputWidget('预订人', '请输入', nameC, nameF),
_inputWidget('电话', '请输入', phoneC, phoneF),
remark()
])));
}
}
... ...
... ... @@ -56,7 +56,9 @@ class _FeastPageState extends State<FeastPage> {
upAndDown('y_kanban', '宴会看板', onTap: () {
NavigatorUtil.goFeastBoardPage(context);
}),
upAndDown('y_new', '新建宴会'),
upAndDown('y_new', '新建宴会', onTap: () {
NavigatorUtil.goFeastCreatePage(context);
}),
Stack(clipBehavior: Clip.none, children: [
upAndDown('y_schedule', '待跟进'),
Positioned(
... ...
... ... @@ -847,4 +847,11 @@ class NavigatorUtil {
{replace = false, bool onlyShow = false}) {
return _navigateTo(context, "${Routes.feast_board_page}", replace: replace);
}
///宴会----新建宴会
static Future<dynamic> goFeastCreatePage(BuildContext context,
{replace = false, bool onlyShow = false}) {
return _navigateTo(context, "${Routes.feast_create_page}",
replace: replace);
}
}
... ...
... ... @@ -142,6 +142,7 @@ import 'package:one_key/utils/utils.dart';
import 'package:provider/provider.dart';
import '../pages/feast/feast_board.dart';
import '../pages/feast/feast_create_page.dart';
import '../provider/feast_model.dart';
// 登录页
... ... @@ -1329,3 +1330,13 @@ var feastBoardPageHandle = new Handler(
return ChangeNotifierProvider<FeastModel>(
create: (_) => FeastModel(), child: FeastBoardPage());
});
///宴会----新建宴会
var feastCreatePageHandle = new Handler(
handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
// String uids = params["uids"].first;
// bool onlyShow = FluroConvertUtils.string2bool(params["onlyShow"].first);
return ChangeNotifierProvider<FeastModel>(
create: (_) => FeastModel(), child: FeastCreatePage());
});
... ...
... ... @@ -115,9 +115,8 @@ class Routes {
"/coupon_create_select_type_page"; //选择优惠券类型
static String coupon_to_personnel_page =
"/coupon_to_personnel_page"; //优惠券----可发放员工
static String feast_board_page =
"/FeastBoardPage"; //宴会----宴会看板
static String feast_board_page = "/feast_board_page"; //宴会----宴会看板
static String feast_create_page = "/feast_create_page"; //宴会----新建宴会
static void configureRoutes(FluroRouter router) {
router.notFoundHandler = new Handler(
... ... @@ -236,9 +235,7 @@ static String feast_board_page =
handler: couponCreateSelectTypePageHandle);
router.define(coupon_to_personnel_page,
handler: couponToPersonnelPageHandle);
router.define(feast_board_page,
handler: feastBoardPageHandle);
router.define(feast_board_page, handler: feastBoardPageHandle);
router.define(feast_create_page, handler: feastCreatePageHandle);
}
}
... ...
import 'package:flutter_screenutil/flutter_screenutil.dart';
double w(num width) {
return ScreenUtil().setWidth(width * 2);
}
double h(num height) {
return ScreenUtil().setWidth(height * 2);
}
double r(num radius) {
return ScreenUtil().radius(radius * 2);
}
double font(num fontsize) {
return ScreenUtil().setSp(fontsize * 2);
}
... ...