desarrollo de una app
Budget: $10 – $30 USD
necesito formatear con una regex estos precios 5.00 , 24.00, 250.00 (no me sirve así)
necesito esto: 5.000, 25.000, 250.000, 1.000.000, 25.000.000, 450.000.000 (me sirve así)
si hay alguna forma de ejercer ambas monedas con esos precios estaría bien
solo necesito que me formate esta regex con este ejemplo de la foto:
Row(
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: SizedBox(
width: MediaQuery.of(context).size.width *0.4,
child: TextFormField(
validator: (value){
if (value!.isEmpty){
return'por favor ingresa el precio';
}else if (value.isValidPrice() != true){
return 'El precio es invalido';
}
return null;
},
onSaved: (value){
price = double.parse(value!);
},
keyboardType:const TextInputType.numberWithOptions(decimal: true),
decoration: textFormDecoration.copyWith(
labelText: 'Precio',
hintText: 'Precio..\$',
extension PriceValidator on String {
bool isValidPrice () {
return RegExp(r'^(\d{1,3}(\.\d{3})*|(\d+))*(\.\d{3})$').hasMatch(this);
}
}
necesito esto: 5.000, 25.000, 250.000, 1.000.000, 25.000.000, 450.000.000 (me sirve así)
si hay alguna forma de ejercer ambas monedas con esos precios estaría bien
solo necesito que me formate esta regex con este ejemplo de la foto:
Row(
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: SizedBox(
width: MediaQuery.of(context).size.width *0.4,
child: TextFormField(
validator: (value){
if (value!.isEmpty){
return'por favor ingresa el precio';
}else if (value.isValidPrice() != true){
return 'El precio es invalido';
}
return null;
},
onSaved: (value){
price = double.parse(value!);
},
keyboardType:const TextInputType.numberWithOptions(decimal: true),
decoration: textFormDecoration.copyWith(
labelText: 'Precio',
hintText: 'Precio..\$',
extension PriceValidator on String {
bool isValidPrice () {
return RegExp(r'^(\d{1,3}(\.\d{3})*|(\d+))*(\.\d{3})$').hasMatch(this);
}
}