mirror of
https://github.com/flutter/samples.git
synced 2025-11-12 07:48:55 +00:00
[Gallery] Fix directory structure (#312)
This commit is contained in:
74
gallery/lib/studies/shrine/home.dart
Normal file
74
gallery/lib/studies/shrine/home.dart
Normal file
@@ -0,0 +1,74 @@
|
||||
// Copyright 2019 The Flutter team. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/semantics.dart';
|
||||
import 'package:gallery/data/gallery_options.dart';
|
||||
import 'package:gallery/layout/adaptive.dart';
|
||||
import 'package:gallery/studies/shrine/expanding_bottom_sheet.dart';
|
||||
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();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final bool isDesktop = isDisplayDesktop(context);
|
||||
|
||||
return ScopedModelDescendant<AppStateModel>(
|
||||
builder: (context, child, model) {
|
||||
return isDesktop
|
||||
? DesktopAsymmetricView(products: model.getProducts())
|
||||
: MobileAsymmetricView(products: model.getProducts());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
class HomePage extends StatelessWidget {
|
||||
const HomePage({
|
||||
this.expandingBottomSheet,
|
||||
this.scrim,
|
||||
this.backdrop,
|
||||
Key key,
|
||||
}) : super(key: key);
|
||||
|
||||
final ExpandingBottomSheet expandingBottomSheet;
|
||||
final Widget scrim;
|
||||
final Widget backdrop;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final bool isDesktop = isDisplayDesktop(context);
|
||||
|
||||
// Use sort keys to make sure the cart button is always on the top.
|
||||
// This way, a11y users do not have to scroll through the entire list to
|
||||
// find the cart, and can easily get to the cart from anywhere on the page.
|
||||
return ApplyTextOptions(
|
||||
child: Stack(
|
||||
children: [
|
||||
Semantics(
|
||||
container: true,
|
||||
child: backdrop,
|
||||
sortKey: OrdinalSortKey(1, name: _ordinalSortKeyName),
|
||||
),
|
||||
ExcludeSemantics(child: scrim),
|
||||
Align(
|
||||
child: Semantics(
|
||||
container: true,
|
||||
child: expandingBottomSheet,
|
||||
sortKey: OrdinalSortKey(0, name: _ordinalSortKeyName),
|
||||
),
|
||||
alignment: isDesktop
|
||||
? AlignmentDirectional.topEnd
|
||||
: AlignmentDirectional.bottomEnd,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user