Created
April 5, 2020 22:04
-
-
Save VB10/3a632779244e908529bd56f0acc71c14 to your computer and use it in GitHub Desktop.
Shoppi Web - Product Update
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UpdateProductView extends StatelessWidget { | |
final ProductModel product; | |
final TextEditingController controller; | |
final Function(ProductModel product) onComplete; | |
const UpdateProductView( | |
{Key key, | |
@required this.product, | |
@required this.controller, | |
this.onComplete}) | |
: super(key: key); | |
@override | |
Widget build(BuildContext context) { | |
return Padding( | |
padding: const EdgeInsets.all(8.0), | |
child: Row( | |
mainAxisSize: MainAxisSize.min, | |
children: <Widget>[ | |
Expanded(child: TextField(controller: controller)), | |
NumberCounterWidget( | |
value: product.total, | |
onChange: (val) { | |
product.total = val; | |
}, | |
), | |
RaisedButton.icon( | |
onPressed: () { | |
product.price = double.tryParse(controller.text); | |
onComplete(product); | |
}, | |
icon: Icon(Icons.update), | |
label: Text("Update")) | |
], | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment