Created
April 9, 2020 20:30
-
-
Save parzibyte/d9f0383eb9218dc853c900b073107b21 to your computer and use it in GitHub Desktop.
This file contains 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
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
title: Text("Detalle de venta #$idVenta"), | |
), | |
/* | |
* es | |
* detalle["productos"][index]["descripcion"] | |
* */ | |
body: detalle == null | |
? Center(child: CircularProgressIndicator()) | |
: Column( | |
crossAxisAlignment: CrossAxisAlignment.start, | |
mainAxisSize: MainAxisSize.min, | |
children: <Widget>[ | |
Padding( | |
padding: EdgeInsets.only( | |
left: 5, | |
bottom: 5, | |
), | |
child: Text( | |
"Venta #$idVenta", | |
style: TextStyle(fontSize: 20), | |
), | |
), | |
Padding( | |
padding: EdgeInsets.only( | |
left: 5, | |
bottom: 5, | |
), | |
child: Row( | |
children: <Widget>[ | |
Icon( | |
Icons.person, | |
color: Colors.green, | |
), | |
Text( | |
detalle["cliente"]["nombre"], | |
style: TextStyle(fontSize: 20), | |
), | |
], | |
), | |
), | |
Padding( | |
padding: EdgeInsets.only( | |
left: 5, | |
bottom: 5, | |
), | |
child: Row( | |
children: <Widget>[ | |
Icon( | |
Icons.format_list_bulleted, | |
color: Colors.amber, | |
), | |
Text( | |
"Productos", | |
style: TextStyle(fontSize: 20), | |
), | |
], | |
), | |
), | |
Divider(), | |
Expanded( | |
child: ListView.builder( | |
itemCount: | |
detalle == null ? 0 : detalle["productos"].length, | |
itemBuilder: (BuildContext context, int index) { | |
return ListTile( | |
title: Text(detalle["productos"][index]["descripcion"]), | |
subtitle: Column( | |
mainAxisSize: MainAxisSize.min, | |
children: <Widget>[ | |
Row( | |
children: <Widget>[ | |
Padding( | |
padding: EdgeInsets.only( | |
left: 0, | |
top: 0, | |
right: 5, | |
bottom: 0, | |
), | |
child: Text( | |
"Código", | |
style: | |
TextStyle(fontWeight: FontWeight.bold), | |
), | |
), | |
Text(detalle["productos"][index] | |
["codigo_barras"]), | |
], | |
), | |
Row( | |
children: <Widget>[ | |
Padding( | |
padding: EdgeInsets.only( | |
left: 0, | |
top: 0, | |
right: 5, | |
bottom: 0, | |
), | |
child: Text("Precio", | |
style: TextStyle( | |
fontWeight: FontWeight.bold)), | |
), | |
Text( | |
"\$" + | |
formateador.format(double.parse( | |
detalle["productos"][index] | |
["precio"])), | |
), | |
], | |
), | |
Row( | |
children: <Widget>[ | |
Padding( | |
padding: EdgeInsets.only( | |
left: 0, | |
top: 0, | |
right: 5, | |
bottom: 0, | |
), | |
child: Text( | |
"Cantidad", | |
style: | |
TextStyle(fontWeight: FontWeight.bold), | |
), | |
), | |
Text( | |
"\$" + | |
formateador.format(double.parse( | |
detalle["productos"][index] | |
["cantidad"])), | |
), | |
], | |
), | |
Row( | |
children: <Widget>[ | |
Padding( | |
padding: EdgeInsets.only( | |
left: 0, | |
top: 0, | |
right: 5, | |
bottom: 0, | |
), | |
child: Text("Subtotal", | |
style: TextStyle( | |
fontWeight: FontWeight.bold)), | |
), | |
Text( | |
"\$" + | |
formateador.format((double.parse( | |
detalle["productos"][index] | |
["precio"]) * | |
double.parse(detalle["productos"] | |
[index]["cantidad"]))), | |
), | |
], | |
), | |
Divider(), | |
], | |
), | |
); | |
}, | |
), | |
), | |
Padding( | |
padding: EdgeInsets.only( | |
left: 5, | |
bottom: 5, | |
), | |
child: Text( | |
"Total: \$" + formateador.format(total), | |
style: TextStyle(fontSize: 20), | |
), | |
), | |
], | |
), | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment