Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
@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
You can’t perform that action at this time.