input_buttom_widget.dart
6.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
import 'package:flutter/material.dart';
import '../../../res/colors.dart';
import '../../../utils/screen_util.dart';
import '../../../widgets/h_empty_view.dart';
import '../../../widgets/round_button.dart';
class InputButtomWidget extends StatefulWidget {
final ValueChanged onEditingCompleteText;
InputButtomWidget({Key key, this.onEditingCompleteText}) : super(key: key);
@override
_InputButtomWidgetState createState() => _InputButtomWidgetState();
}
class _InputButtomWidgetState extends State<InputButtomWidget> {
final TextEditingController controller = TextEditingController();
@override
Widget build(BuildContext context) {
return new Scaffold(
backgroundColor: Colors.transparent,
body: new Column(
children: <Widget>[
Expanded(
child: new GestureDetector(
child: new Container(
color: Colors.transparent,
),
onTap: () {
if (Navigator.canPop(context)) {
Navigator.pop(context);
}
},
)),
new Container(
color: Color(0xFFF4F4F4),
padding: EdgeInsets.only(left: 16, top: 8, bottom: 8, right: 16),
child: Row(children: [
// Container(
// decoration: BoxDecoration(color: Colors.white),
// child: TextField(
// controller: controller,
// autofocus: true,
// style: TextStyle(fontSize: 16),
// //设置键盘按钮为发送
// textInputAction: TextInputAction.send,
// keyboardType: TextInputType.multiline,
// onEditingComplete: () {
// //点击发送调用
// print('onEditingComplete');
// onEditingCompleteText(controller.text);
// Navigator.pop(context);
// },
// decoration: InputDecoration(
// hintText: '评论',
// isDense: true,
// contentPadding: EdgeInsets.only(
// left: 10, top: 5, bottom: 5, right: 10),
// border: const OutlineInputBorder(
// gapPadding: 0,
// borderSide: BorderSide(
// width: 0,
// style: BorderStyle.none,
// ),
// ),
// ),
// minLines: 1,
// maxLines: 5,
// ),
// ),
Expanded(
child: Container(
decoration: BoxDecoration(
color: MyColours.color_ffffff,
borderRadius: BorderRadius.circular(r(8))),
padding:
EdgeInsets.symmetric(horizontal: w(4), vertical: 0),
child: TextField(
controller: controller,
minLines: 1,
maxLines: 5,
autofocus: true,
// //光标颜色
// cursorColor:
// widget.isSelect ? Colors.white : MyColours.color_199095,
//输入文本的样式
// inputFormatters: lenghtLimit
// ? [
// LengthLimitingTextInputFormatter(10),
// ]
// : [],
// textAlignVertical: TextAlignVertical.center,
textAlign: TextAlign.left,
style: TextStyle(
fontSize: font(14),
),
decoration: InputDecoration(
contentPadding: EdgeInsets.zero,
border:
OutlineInputBorder(borderSide: BorderSide.none),
hintText: '评论',
hintStyle: TextStyle(
color: MyColours.color_999999,
fontSize: font(14),
),
enabledBorder: new UnderlineInputBorder(
borderSide: BorderSide.none,
),
focusedBorder: new UnderlineInputBorder(
borderSide: BorderSide.none,
),
),
onChanged: (value) {
// name = value;
setState(() {});
},
//设置键盘按钮为发送
// textInputAction: TextInputAction.send,
keyboardType: TextInputType.multiline,
onEditingComplete: () {
//点击发送调用
// print('onEditingComplete');
// onEditingCompleteText(controller.text);
// Navigator.pop(context);
},
))),
HEmptyView(20),
RoundButton(
text: '发送',
width: w(54),
height: w(28),
gradientStart: controller.text.trim().length > 0
? MyColours.color_438E93
: MyColours.color_ffffff,
gradientEnd: controller.text.trim().length > 0
? MyColours.color_438E93
: MyColours.color_ffffff,
textColor: controller.text.trim().length > 0
? MyColours.color_F8F9FD
: MyColours.color_999999,
fontSize: 24,
borderColor: controller.text.trim().length > 0
? MyColours.color_438E93
: MyColours.color_999999,
radius: r(15),
onPressed: () {
if (controller.text.trim().length == 0) {
return;
}
print('onEditingComplete');
widget.onEditingCompleteText(controller.text);
if (Navigator.canPop(context)) {
Navigator.pop(context);
}
},
),
]))
],
),
);
}
}