CAKE-232 | reworked ALL button on the send page
OleksandrSobol committed
Jan 13, 2021 at 18:27 UTC
d21c31964cb1ea6bb6b64c010fcfd2f4cf55f7b3
1 file changed
+74
-61
lib/src/screens/send/send_page.dart
+74
-61
@@ -43,6 +43,9 @@ class SendPage extends BasePage {
43
});
44
}
45
46
+ static const prefixIconWidth = 34.0;
47
+ static const prefixIconHeight = 34.0;
48
+
49
final SendViewModel sendViewModel;
50
final TextEditingController _addressController;
51
final TextEditingController _cryptoAmountController;
@@ -172,72 +175,82 @@ class SendPage extends BasePage {
175
Observer(
176
builder: (_) => Padding(
177
padding: const EdgeInsets.only(top: 20),
175
- child: BaseTextFormField(
176
- focusNode: _cryptoAmountFocus,
177
- controller: _cryptoAmountController,
178
- keyboardType:
179
- TextInputType.numberWithOptions(
180
- signed: false, decimal: true),
181
- prefixIcon: Padding(
182
- padding: EdgeInsets.only(top: 9),
183
- child: Text(
184
- sendViewModel.currency.title +
185
- ':',
186
- style: TextStyle(
187
- fontSize: 16,
188
- fontWeight: FontWeight.w600,
189
- color: Colors.white,
190
- )),
191
- ),
192
- suffixIcon: Container(
193
- height: 32,
194
- width: 32,
195
- margin: EdgeInsets.only(
196
- left: 14, top: 4, bottom: 10),
197
- decoration: BoxDecoration(
198
- color: Theme.of(context)
199
- .primaryTextTheme
200
- .display1
201
- .color,
202
- borderRadius: BorderRadius.all(
203
- Radius.circular(6))),
204
- child: InkWell(
205
- onTap: () =>
206
- sendViewModel.setSendAll(),
207
- child: Center(
208
- child: Text(S.of(context).all,
209
- textAlign: TextAlign.center,
210
- style: TextStyle(
211
- fontSize: 12,
212
- fontWeight:
213
- FontWeight.bold,
214
- color: Theme.of(context)
215
- .primaryTextTheme
216
- .display1
217
- .decorationColor)),
218
- ),
178
+ child: Stack(
179
+ children: [
180
+ BaseTextFormField(
181
+ focusNode: _cryptoAmountFocus,
182
+ controller: _cryptoAmountController,
183
+ keyboardType:
184
+ TextInputType.numberWithOptions(
185
+ signed: false, decimal: true),
186
+ prefixIcon: Padding(
187
+ padding: EdgeInsets.only(top: 9),
188
+ child: Text(
189
+ sendViewModel.currency.title +
190
+ ':',
191
+ style: TextStyle(
192
+ fontSize: 16,
193
+ fontWeight: FontWeight.w600,
194
+ color: Colors.white,
195
+ )),
196
),
220
- ),
221
- hintText: '0.0000',
222
- borderColor: Theme.of(context)
223
- .primaryTextTheme
224
- .headline
225
- .color,
226
- textStyle: TextStyle(
227
- fontSize: 14,
228
- fontWeight: FontWeight.w500,
229
- color: Colors.white),
230
- placeholderTextStyle: TextStyle(
231
- color: Theme.of(context)
197
+ suffixIcon: SizedBox(
198
+ width: prefixIconWidth,
199
+ ),
200
+ hintText: '0.0000',
201
+ borderColor: Theme.of(context)
202
.primaryTextTheme
203
.headline
234
- .decorationColor,
235
- fontWeight: FontWeight.w500,
236
- fontSize: 14),
237
- validator: sendViewModel.sendAll
204
+ .color,
205
+ textStyle: TextStyle(
206
+ fontSize: 14,
207
+ fontWeight: FontWeight.w500,
208
+ color: Colors.white),
209
+ placeholderTextStyle: TextStyle(
210
+ color: Theme.of(context)
211
+ .primaryTextTheme
212
+ .headline
213
+ .decorationColor,
214
+ fontWeight: FontWeight.w500,
215
+ fontSize: 14),
216
+ validator: sendViewModel.sendAll
217
? sendViewModel.allAmountValidator
218
: sendViewModel
240
- .amountValidator))),
219
+ .amountValidator),
220
+ Positioned(
221
+ top: 2,
222
+ right: 0,
223
+ child: Container(
224
+ width: prefixIconWidth,
225
+ height: prefixIconHeight,
226
+ child: InkWell(
227
+ onTap: () async =>
228
+ sendViewModel.setSendAll(),
229
+ child: Container(
230
+ decoration: BoxDecoration(
231
+ color: Theme.of(context)
232
+ .primaryTextTheme
233
+ .display1
234
+ .color,
235
+ borderRadius:
236
+ BorderRadius.all(
237
+ Radius.circular(6))),
238
+ child: Center(
239
+ child: Text(
240
+ S.of(context).all,
241
+ textAlign:
242
+ TextAlign.center,
243
+ style: TextStyle(
244
+ fontSize: 12,
245
+ fontWeight:
246
+ FontWeight.bold,
247
+ color:
248
+ Theme.of(context)
249
+ .primaryTextTheme
250
+ .display1
251
+ .decorationColor))),
252
+ ))))])
253
+ )),
254
Observer(
255
builder: (_) => Padding(
256
padding: EdgeInsets.only(top: 10),