1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-10 14:58:34 +00:00

[Shrine] New Shrine with expanding cart bottom sheet from experimenal (#18)

This commit is contained in:
Will Larche
2018-09-27 11:36:30 -04:00
committed by Andrew Brogdon
parent b5ce05e934
commit 4b4d5fef9c
11 changed files with 857 additions and 88 deletions

View File

@@ -90,6 +90,7 @@ class AsymmetricView extends StatelessWidget {
scrollDirection: Axis.horizontal,
padding: EdgeInsets.fromLTRB(0.0, 34.0, 16.0, 44.0),
children: _buildColumns(context),
physics: AlwaysScrollableScrollPhysics(),
);
}
}

View File

@@ -44,42 +44,47 @@ class ProductCard extends StatelessWidget {
builder: (context, child, model) => GestureDetector(
onTap: () {
model.addProductToCart(product.id);
Scaffold.of(context).showSnackBar(SnackBar(
content:
Text('${product.name} has been added to your cart.'),
));
// TODO: Add Snackbar
},
child: child,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
child: Stack(
children: <Widget>[
AspectRatio(
aspectRatio: imageAspectRatio,
child: imageWidget,
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
AspectRatio(
aspectRatio: imageAspectRatio,
child: imageWidget,
),
SizedBox(
height: kTextBoxHeight * MediaQuery.of(context).textScaleFactor,
width: 121.0,
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text(
product == null ? '' : product.name,
style: theme.textTheme.button,
softWrap: false,
overflow: TextOverflow.ellipsis,
maxLines: 1,
),
SizedBox(height: 4.0),
Text(
product == null ? '' : formatter.format(product.price),
style: theme.textTheme.caption,
),
],
),
),
],
),
SizedBox(
height: kTextBoxHeight * MediaQuery.of(context).textScaleFactor,
width: 121.0,
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text(
product == null ? '' : product.name,
style: theme.textTheme.button,
softWrap: false,
overflow: TextOverflow.ellipsis,
maxLines: 1,
),
SizedBox(height: 4.0),
Text(
product == null ? '' : formatter.format(product.price),
style: theme.textTheme.caption,
),
],
),
Padding(
padding: const EdgeInsets.all(16.0),
child: Icon(Icons.add_shopping_cart),
),
],
),

View File

@@ -48,7 +48,7 @@ class TwoProductCardColumn extends StatelessWidget {
product: top,
)
: SizedBox(
height: heightOfCards,
height: heightOfCards > 0 ? heightOfCards : spacerHeight,
),
),
SizedBox(height: spacerHeight),