fix: keyboard jumping over fields in send template
Godwin Asuquo committed
Jan 18, 2022 at 08:08 UTC
88ca47901febc158a4d0373b2ded71961ca3af52
1 file changed
+120
-116
lib/src/screens/send/send_template_page.dart
+120
-116
@@ -34,9 +34,6 @@ class SendTemplatePage extends BasePage {
34
@override
35
Color get titleColor => Colors.white;
36
37
- @override
38
- bool get resizeToAvoidBottomInset => false;
39
-
37
@override
38
bool get extendBodyBehindAppBar => true;
39
@@ -50,8 +47,8 @@ class SendTemplatePage extends BasePage {
47
return KeyboardActions(
48
config: KeyboardActionsConfig(
49
keyboardActionsPlatform: KeyboardActionsPlatform.IOS,
53
- keyboardBarColor: Theme.of(context).accentTextTheme.body2
54
- .backgroundColor,
50
+ keyboardBarColor:
51
+ Theme.of(context).accentTextTheme.body2.backgroundColor,
52
nextFocus: false,
53
actions: [
54
KeyboardActionsItem(
@@ -71,8 +68,9 @@ class SendTemplatePage extends BasePage {
68
content: Container(
69
decoration: BoxDecoration(
70
borderRadius: BorderRadius.only(
74
- bottomLeft: Radius.circular(24),
75
- bottomRight: Radius.circular(24)),
71
+ bottomLeft: Radius.circular(24),
72
+ bottomRight: Radius.circular(24),
73
+ ),
74
gradient: LinearGradient(colors: [
75
Theme.of(context).primaryTextTheme.subhead.color,
76
Theme.of(context).primaryTextTheme.subhead.decorationColor,
@@ -80,57 +78,15 @@ class SendTemplatePage extends BasePage {
78
),
79
child: Form(
80
key: _formKey,
83
- child: Column(children: <Widget>[
84
- Padding(
85
- padding: EdgeInsets.fromLTRB(24, 90, 24, 32),
86
- child: Column(
87
- children: <Widget>[
88
- BaseTextFormField(
89
- controller: _nameController,
90
- hintText: S.of(context).send_name,
91
- borderColor:
92
- Theme.of(context).primaryTextTheme.headline.color,
93
- textStyle: TextStyle(
94
- fontSize: 14,
95
- fontWeight: FontWeight.w500,
96
- color: Colors.white),
97
- placeholderTextStyle: TextStyle(
98
- color: Theme.of(context)
99
- .primaryTextTheme
100
- .headline
101
- .decorationColor,
102
- fontWeight: FontWeight.w500,
103
- fontSize: 14),
104
- validator: sendTemplateViewModel.templateValidator,
105
- ),
106
- Padding(
107
- padding: EdgeInsets.only(top: 20),
108
- child: AddressTextField(
109
- controller: _addressController,
110
- onURIScanned: (uri) {
111
- var address = '';
112
- var amount = '';
113
-
114
- if (uri != null) {
115
- address = uri.path;
116
- amount = uri.queryParameters['tx_amount'] ??
117
- uri.queryParameters['amount'];
118
- } else {
119
- address = uri.toString();
120
- }
121
-
122
- _addressController.text = address;
123
- _cryptoAmountController.text = amount;
124
- },
125
- options: [
126
- AddressTextFieldOption.paste,
127
- AddressTextFieldOption.qrCode,
128
- AddressTextFieldOption.addressBook
129
- ],
130
- buttonColor: Theme.of(context)
131
- .primaryTextTheme
132
- .display1
133
- .color,
81
+ child: Column(
82
+ children: <Widget>[
83
+ Padding(
84
+ padding: EdgeInsets.fromLTRB(24, 90, 24, 32),
85
+ child: Column(
86
+ children: <Widget>[
87
+ BaseTextFormField(
88
+ controller: _nameController,
89
+ hintText: S.of(context).send_name,
90
borderColor: Theme.of(context)
91
.primaryTextTheme
92
.headline
@@ -139,37 +95,122 @@ class SendTemplatePage extends BasePage {
95
fontSize: 14,
96
fontWeight: FontWeight.w500,
97
color: Colors.white),
142
- hintStyle: TextStyle(
143
- fontSize: 14,
144
- fontWeight: FontWeight.w500,
98
+ placeholderTextStyle: TextStyle(
99
color: Theme.of(context)
100
.primaryTextTheme
101
.headline
148
- .decorationColor),
102
+ .decorationColor,
103
+ fontWeight: FontWeight.w500,
104
+ fontSize: 14),
105
+ validator: sendTemplateViewModel.templateValidator,
106
),
150
- ),
151
- Padding(
152
- padding: const EdgeInsets.only(top: 20),
153
- child: BaseTextFormField(
154
- focusNode: _cryptoAmountFocus,
155
- controller: _cryptoAmountController,
107
+ Padding(
108
+ padding: EdgeInsets.only(top: 20),
109
+ child: AddressTextField(
110
+ controller: _addressController,
111
+ onURIScanned: (uri) {
112
+ var address = '';
113
+ var amount = '';
114
+
115
+ if (uri != null) {
116
+ address = uri.path;
117
+ amount = uri.queryParameters['tx_amount'] ??
118
+ uri.queryParameters['amount'];
119
+ } else {
120
+ address = uri.toString();
121
+ }
122
+
123
+ _addressController.text = address;
124
+ _cryptoAmountController.text = amount;
125
+ },
126
+ options: [
127
+ AddressTextFieldOption.paste,
128
+ AddressTextFieldOption.qrCode,
129
+ AddressTextFieldOption.addressBook
130
+ ],
131
+ buttonColor: Theme.of(context)
132
+ .primaryTextTheme
133
+ .display1
134
+ .color,
135
+ borderColor: Theme.of(context)
136
+ .primaryTextTheme
137
+ .headline
138
+ .color,
139
+ textStyle: TextStyle(
140
+ fontSize: 14,
141
+ fontWeight: FontWeight.w500,
142
+ color: Colors.white),
143
+ hintStyle: TextStyle(
144
+ fontSize: 14,
145
+ fontWeight: FontWeight.w500,
146
+ color: Theme.of(context)
147
+ .primaryTextTheme
148
+ .headline
149
+ .decorationColor),
150
+ ),
151
+ ),
152
+ Padding(
153
+ padding: const EdgeInsets.only(top: 20),
154
+ child: BaseTextFormField(
155
+ focusNode: _cryptoAmountFocus,
156
+ controller: _cryptoAmountController,
157
+ keyboardType: TextInputType.numberWithOptions(
158
+ signed: false, decimal: true),
159
+ inputFormatters: [
160
+ FilteringTextInputFormatter.deny(
161
+ RegExp('[\\-|\\ ]'))
162
+ ],
163
+ prefixIcon: Padding(
164
+ padding: EdgeInsets.only(top: 9),
165
+ child: Text(
166
+ sendTemplateViewModel.currency.title +
167
+ ':',
168
+ style: TextStyle(
169
+ fontSize: 16,
170
+ fontWeight: FontWeight.w600,
171
+ color: Colors.white,
172
+ )),
173
+ ),
174
+ hintText: '0.0000',
175
+ borderColor: Theme.of(context)
176
+ .primaryTextTheme
177
+ .headline
178
+ .color,
179
+ textStyle: TextStyle(
180
+ fontSize: 14,
181
+ fontWeight: FontWeight.w500,
182
+ color: Colors.white),
183
+ placeholderTextStyle: TextStyle(
184
+ color: Theme.of(context)
185
+ .primaryTextTheme
186
+ .headline
187
+ .decorationColor,
188
+ fontWeight: FontWeight.w500,
189
+ fontSize: 14),
190
+ validator:
191
+ sendTemplateViewModel.amountValidator)),
192
+ Padding(
193
+ padding: const EdgeInsets.only(top: 20),
194
+ child: BaseTextFormField(
195
+ focusNode: _fiatAmountFocus,
196
+ controller: _fiatAmountController,
197
keyboardType: TextInputType.numberWithOptions(
198
signed: false, decimal: true),
199
inputFormatters: [
159
- FilteringTextInputFormatter.deny(RegExp('[\\-|\\ ]'))
200
+ FilteringTextInputFormatter.deny(
201
+ RegExp('[\\-|\\ ]'))
202
],
203
prefixIcon: Padding(
204
padding: EdgeInsets.only(top: 9),
163
- child:
164
- Text(sendTemplateViewModel
165
- .currency.title + ':',
205
+ child: Text(
206
+ sendTemplateViewModel.fiat.title + ':',
207
style: TextStyle(
208
fontSize: 16,
209
fontWeight: FontWeight.w600,
210
color: Colors.white,
211
)),
212
),
172
- hintText: '0.0000',
213
+ hintText: '0.00',
214
borderColor: Theme.of(context)
215
.primaryTextTheme
216
.headline
@@ -185,49 +226,12 @@ class SendTemplatePage extends BasePage {
226
.decorationColor,
227
fontWeight: FontWeight.w500,
228
fontSize: 14),
188
- validator: sendTemplateViewModel
189
- .amountValidator)),
190
- Padding(
191
- padding: const EdgeInsets.only(top: 20),
192
- child: BaseTextFormField(
193
- focusNode: _fiatAmountFocus,
194
- controller: _fiatAmountController,
195
- keyboardType: TextInputType.numberWithOptions(
196
- signed: false, decimal: true),
197
- inputFormatters: [
198
- FilteringTextInputFormatter.deny(RegExp('[\\-|\\ ]'))
199
- ],
200
- prefixIcon: Padding(
201
- padding: EdgeInsets.only(top: 9),
202
- child: Text(sendTemplateViewModel
203
- .fiat.title + ':',
204
- style: TextStyle(
205
- fontSize: 16,
206
- fontWeight: FontWeight.w600,
207
- color: Colors.white,
208
- )),
209
- ),
210
- hintText: '0.00',
211
- borderColor: Theme.of(context)
212
- .primaryTextTheme
213
- .headline
214
- .color,
215
- textStyle: TextStyle(
216
- fontSize: 14,
217
- fontWeight: FontWeight.w500,
218
- color: Colors.white),
219
- placeholderTextStyle: TextStyle(
220
- color: Theme.of(context)
221
- .primaryTextTheme
222
- .headline
223
- .decorationColor,
224
- fontWeight: FontWeight.w500,
225
- fontSize: 14),
226
- )),
227
- ],
228
- ),
229
- )
230
- ]),
229
+ )),
230
+ ],
231
+ ),
232
+ )
233
+ ],
234
+ ),
235
),
236
),
237
bottomSectionPadding: