Created
April 18, 2020 05:34
-
-
Save vicradon/0dcaa634b31cb05fc70cdde90e8ed154 to your computer and use it in GitHub Desktop.
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 Checkout extends StatelessWidget { | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar(title: Text('Checkout')), | |
body: StreamBuilder( | |
stream: bloc.getStream, | |
initialData: bloc.allItems, | |
builder: (context, snapshot) { | |
return snapshot.data['cart items'].length > 0 | |
? Column( | |
children: <Widget>[ | |
/// The [checkoutListBuilder] has to be fixed | |
/// in an expanded widget to ensure it | |
/// doesn't occupy the whole screen and leaves | |
/// room for the the RaisedButton | |
Expanded(child: checkoutListBuilder(snapshot)), | |
RaisedButton( | |
onPressed: () {}, | |
child: Text("Checkout"), | |
color: Theme.of(context).primaryColor, | |
), | |
SizedBox(height: 40) | |
], | |
) | |
: Center(child: Text("You haven't taken any item yet")); | |
}, | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment