Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions gallery/gallery/lib/studies/shrine/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import 'package:gallery/studies/shrine/model/app_state_model.dart';
import 'package:gallery/studies/shrine/supplemental/asymmetric_view.dart';
import 'package:scoped_model/scoped_model.dart';

const _ordinalSortKeyName = 'home';

class ProductPage extends StatelessWidget {
const ProductPage();

Expand Down Expand Up @@ -52,14 +54,14 @@ class HomePage extends StatelessWidget {
Semantics(
container: true,
child: backdrop,
sortKey: OrdinalSortKey(1),
sortKey: OrdinalSortKey(1, name: _ordinalSortKeyName),
),
ExcludeSemantics(child: scrim),
Align(
child: Semantics(
container: true,
child: expandingBottomSheet,
sortKey: OrdinalSortKey(0),
sortKey: OrdinalSortKey(0, name: _ordinalSortKeyName),
),
alignment: isDesktop
? AlignmentDirectional.topEnd
Expand Down
100 changes: 56 additions & 44 deletions gallery/gallery/lib/studies/shrine/shopping_cart.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import 'package:gallery/studies/shrine/theme.dart';
import 'package:gallery/l10n/gallery_localizations.dart';

const _startColumnWidth = 60.0;
const _ordinalSortKeyName = 'shopping_cart';

class ShoppingCartPage extends StatefulWidget {
@override
Expand All @@ -39,7 +40,6 @@ class _ShoppingCartPageState extends State<ShoppingCartPage> {
@override
Widget build(BuildContext context) {
final ThemeData localTheme = Theme.of(context);

return Scaffold(
backgroundColor: shrinePink50,
body: SafeArea(
Expand All @@ -50,63 +50,75 @@ class _ShoppingCartPageState extends State<ShoppingCartPage> {
children: [
ListView(
children: [
Row(
children: [
SizedBox(
width: _startColumnWidth,
child: IconButton(
icon: const Icon(Icons.keyboard_arrow_down),
onPressed: () =>
ExpandingBottomSheet.of(context).close(),
tooltip: GalleryLocalizations.of(context)
.shrineTooltipCloseCart,
Semantics(
sortKey: OrdinalSortKey(0, name: _ordinalSortKeyName),
child: Row(
children: [
SizedBox(
width: _startColumnWidth,
child: IconButton(
icon: const Icon(Icons.keyboard_arrow_down),
onPressed: () =>
ExpandingBottomSheet.of(context).close(),
tooltip: GalleryLocalizations.of(context)
.shrineTooltipCloseCart,
),
),
),
Text(
GalleryLocalizations.of(context)
.shrineCartPageCaption,
style: localTheme.textTheme.subhead
.copyWith(fontWeight: FontWeight.w600),
),
const SizedBox(width: 16),
Text(
GalleryLocalizations.of(context)
.shrineCartItemCount(
model.totalCartQuantity,
Text(
GalleryLocalizations.of(context)
.shrineCartPageCaption,
style: localTheme.textTheme.subhead
.copyWith(fontWeight: FontWeight.w600),
),
),
],
const SizedBox(width: 16),
Text(
GalleryLocalizations.of(context)
.shrineCartItemCount(
model.totalCartQuantity,
),
),
],
),
),
const SizedBox(height: 16),
Column(
children: _createShoppingCartRows(model),
Semantics(
sortKey: OrdinalSortKey(1, name: _ordinalSortKeyName),
child: Column(
children: _createShoppingCartRows(model),
),
),
Semantics(
sortKey: OrdinalSortKey(2, name: _ordinalSortKeyName),
child: ShoppingCartSummary(model: model),
),
ShoppingCartSummary(model: model),
const SizedBox(height: 100),
],
),
PositionedDirectional(
bottom: 16,
start: 16,
end: 16,
child: RaisedButton(
shape: const BeveledRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(7)),
),
color: shrinePink100,
splashColor: shrineBrown600,
child: Padding(
padding: EdgeInsets.symmetric(vertical: 12),
child: Text(
GalleryLocalizations.of(context)
.shrineCartClearButtonCaption,
style: TextStyle(letterSpacing: largeLetterSpacing),
child: Semantics(
sortKey: OrdinalSortKey(3, name: _ordinalSortKeyName),
child: RaisedButton(
shape: const BeveledRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(7)),
),
color: shrinePink100,
splashColor: shrineBrown600,
child: Padding(
padding: EdgeInsets.symmetric(vertical: 12),
child: Text(
GalleryLocalizations.of(context)
.shrineCartClearButtonCaption,
style: TextStyle(letterSpacing: largeLetterSpacing),
),
),
onPressed: () {
model.clearCart();
ExpandingBottomSheet.of(context).close();
},
),
onPressed: () {
model.clearCart();
ExpandingBottomSheet.of(context).close();
},
),
),
],
Expand Down