You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

244 lines
7.4 KiB

import 'package:flutter/material.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class EditRemarksPage extends StatefulWidget {
final Map<String, dynamic>? arguments;
EditRemarksPage({this.arguments});
@override
State<StatefulWidget> createState() {
return _EditRemarksPage();
}
}
class _EditRemarksPage extends State<EditRemarksPage> {
TextEditingController commentTextController = TextEditingController();
@override
void initState() {
super.initState();
if (widget.arguments?["remake"] != null &&
widget.arguments?["remake"] != "")
commentTextController.text = widget.arguments?["remake"];
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: MyAppBar(
title: S.of(context).beizhu,
titleColor: Colors.black,
leadingColor: Colors.black,
),
body: GestureDetector(
behavior: HitTestBehavior.translucent,
onTap: () {
FocusScope.of(context).requestFocus(FocusNode());
},
child: Column(
children: [
Expanded(
child: Container(
margin: EdgeInsets.only(
left: 16.w,
top: 20.h,
right: 16.w,
),
width: MediaQuery.of(context).size.width,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"快捷输入",
style: TextStyle(
fontSize: 16.sp,
fontWeight: FontWeight.bold,
color: Color(0xFF353535),
),
),
SizedBox(
height: 24.h,
),
Wrap(
spacing: 12.w,
runSpacing: 10.h,
children: remarks(),
),
SizedBox(
height: 32.h,
),
Container(
height: 128.h,
padding: EdgeInsets.all(16.w),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8.w),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(12),
offset: Offset(0, 3),
blurRadius: 14,
spreadRadius: 0,
)
],
),
child: TextField(
controller: commentTextController,
keyboardType: TextInputType.multiline,
maxLines: 10,
decoration: InputDecoration(
isDense: true,
hintText: '请填写备注信息,例如:面包切一刀',
hintStyle: TextStyle(
color: Color(0xFF353535),
fontSize: 16.sp,
),
border: InputBorder.none,
suffixIconConstraints: BoxConstraints(
minHeight: 128.h,
maxHeight: 128.h,
),
),
),
),
],
),
),
flex: 1,
),
GestureDetector(
onTap: () {
String notes = commentTextController.text;
Navigator.pop(context, notes);
},
child: Container(
padding: EdgeInsets.all(16.h),
width: MediaQuery.of(context).size.width,
alignment: Alignment.center,
color: Color(0xFF32A060),
child: Text(
S.of(context).tijiao,
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 16.sp,
),
),
),
),
],
),
),
);
}
addRemarksCnt(cnt) {
setState(() {
commentTextController.text = commentTextController.text + cnt;
});
}
List<Widget> remarks() {
return [
GestureDetector(
child: Container(
padding: EdgeInsets.symmetric(vertical: 6.h, horizontal: 22.w),
decoration: BoxDecoration(
color: Color(0xFF32A060),
borderRadius: BorderRadius.circular(4.w),
),
child: Text(
"面包",
style: TextStyle(
color: Colors.white,
fontSize: 12.sp,
),
),
),
onTap: () {
addRemarksCnt("面包");
},
),
GestureDetector(
child: Container(
padding: EdgeInsets.symmetric(vertical: 6.h, horizontal: 22.w),
decoration: BoxDecoration(
color: Color(0xFF32A060),
borderRadius: BorderRadius.circular(4.w),
),
child: Text(
"面包要切好",
style: TextStyle(
color: Colors.white,
fontSize: 12.sp,
),
),
),
onTap: () {
addRemarksCnt("面包要切好");
},
),
GestureDetector(
child: Container(
padding: EdgeInsets.symmetric(vertical: 6.h, horizontal: 22.w),
decoration: BoxDecoration(
color: Color(0xFF32A060),
borderRadius: BorderRadius.circular(4.w),
),
child: Text(
"一点",
style: TextStyle(
color: Colors.white,
fontSize: 12.sp,
),
),
),
onTap: () {
addRemarksCnt("一点");
},
),
GestureDetector(
child: Container(
padding: EdgeInsets.symmetric(vertical: 6.h, horizontal: 22.w),
decoration: BoxDecoration(
color: Color(0xFF32A060),
borderRadius: BorderRadius.circular(4.w),
),
child: Text(
"",
style: TextStyle(
color: Colors.white,
fontSize: 12.sp,
),
),
),
onTap: () {
addRemarksCnt("");
},
),
GestureDetector(
child: Container(
padding: EdgeInsets.symmetric(vertical: 6.h, horizontal: 22.w),
decoration: BoxDecoration(
color: Color(0xFF32A060),
borderRadius: BorderRadius.circular(4.w),
),
child: Text(
"软一点",
style: TextStyle(
color: Colors.white,
fontSize: 12.sp,
),
),
),
onTap: () {
addRemarksCnt("软一点");
},
),
];
}
}