feat: improve address page txt field

This commit is contained in:
Rafael Saes 2023-08-30 17:41:28 -03:00
parent 256c48d61a
commit 0a30e6d9e1

View file

@ -12,7 +12,8 @@ class CurrencyInputField extends StatelessWidget {
required this.onTapPicker, required this.onTapPicker,
required this.selectedCurrency, required this.selectedCurrency,
this.focusNode, this.focusNode,
required this.controller, required this.isLight, required this.controller,
required this.isLight,
}); });
final Function() onTapPicker; final Function() onTapPicker;
@ -28,96 +29,89 @@ class CurrencyInputField extends StatelessWidget {
color: Theme.of(context).extension<DashboardPageTheme>()!.textColor, color: Theme.of(context).extension<DashboardPageTheme>()!.textColor,
height: 8, height: 8,
); );
final _width = MediaQuery.of(context).size.width;
return Column( return SizedBox(
children: [ height: 42,
Padding( child: Align(
padding: EdgeInsets.only(top: 20), alignment: Alignment.center,
child: SizedBox( child: BaseTextFormField(
height: 40, focusNode: focusNode,
child: BaseTextFormField( controller: controller,
focusNode: focusNode, keyboardType: TextInputType.numberWithOptions(signed: false, decimal: true),
controller: controller, inputFormatters: [FilteringTextInputFormatter.allow(RegExp(r'^\d+(\.|\,)?\d{0,8}'))],
keyboardType: TextInputType.numberWithOptions(signed: false, decimal: true), hintText: '0.000',
inputFormatters: [FilteringTextInputFormatter.allow(RegExp(r'^\d+(\.|\,)?\d{0,8}'))], placeholderTextStyle: isLight
hintText: '0.000', ? null
placeholderTextStyle: isLight : TextStyle(
? null color: Theme.of(context).extension<SendPageTheme>()!.textFieldBorderColor,
: TextStyle( fontWeight: FontWeight.w600,
color: Theme.of(context).extension<SendPageTheme>()!.textFieldBorderColor, ),
fontWeight: FontWeight.w600, borderColor: Theme.of(context).extension<PickerTheme>()!.dividerColor,
textColor: Theme.of(context).extension<DashboardPageTheme>()!.textColor,
textStyle: TextStyle(
color: Theme.of(context).extension<DashboardPageTheme>()!.textColor,
),
prefixIcon: Container(
padding: EdgeInsets.only(right: 8),
child: InkWell(
onTap: onTapPicker,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Padding(
padding: EdgeInsets.only(right: 5),
child: arrowBottomPurple,
), ),
borderColor: Theme.of(context).extension<PickerTheme>()!.dividerColor, Text(
textColor: Theme.of(context).extension<DashboardPageTheme>()!.textColor, selectedCurrency.name.toUpperCase(),
textStyle: TextStyle( style: TextStyle(
color: Theme.of(context).extension<DashboardPageTheme>()!.textColor, fontWeight: FontWeight.w600,
), fontSize: 16,
prefixIcon: Padding( color: Theme.of(context).extension<DashboardPageTheme>()!.textColor,
padding: EdgeInsets.only( ),
left: _width / 4, ),
), if (selectedCurrency.tag != null)
child: Container( Padding(
padding: EdgeInsets.only(right: 8), padding: const EdgeInsets.only(right: 3.0),
child: InkWell( child: Container(
onTap: onTapPicker, decoration: BoxDecoration(
child: Row( color:
mainAxisAlignment: MainAxisAlignment.spaceBetween, Theme.of(context).extension<SendPageTheme>()!.textFieldButtonColor,
mainAxisSize: MainAxisSize.min, borderRadius: BorderRadius.all(
children: <Widget>[ Radius.circular(6),
Padding(
padding: EdgeInsets.only(right: 5),
child: arrowBottomPurple,
),
Text(
selectedCurrency.name.toUpperCase(),
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 16,
color: Theme.of(context).extension<DashboardPageTheme>()!.textColor,
), ),
), ),
if (selectedCurrency.tag != null) child: Center(
Padding(
padding: const EdgeInsets.only(right: 3.0),
child: Container(
decoration: BoxDecoration(
color: Theme.of(context).extension<SendPageTheme>()!.textFieldButtonColor,
borderRadius: BorderRadius.all(
Radius.circular(6),
),
),
child: Center(
child: Text(
selectedCurrency.tag!,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.bold,
color: Theme.of(context).extension<SendPageTheme>()!.textFieldButtonIconColor,
),
),
),
),
),
Padding(
padding: const EdgeInsets.only(bottom: 3.0),
child: Text( child: Text(
':', selectedCurrency.tag!,
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.w600, fontSize: 12,
fontSize: 20, fontWeight: FontWeight.bold,
color: Theme.of(context).extension<DashboardPageTheme>()!.textColor, color: Theme.of(context)
.extension<SendPageTheme>()!
.textFieldButtonIconColor,
), ),
), ),
), ),
]), ),
), ),
), Padding(
), padding: const EdgeInsets.only(bottom: 4.0),
child: Text(
':',
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 20,
color: Theme.of(context).extension<DashboardPageTheme>()!.textColor,
),
),
),
]),
), ),
), ),
), ),
], ),
); );
} }
} }