home.dart 1.25 KB
Newer Older
1 2 3
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
4 5

import 'package:flutter/material.dart';
6
import 'package:scoped_model/scoped_model.dart';
7

8 9 10 11 12 13
import 'backdrop.dart';
import 'expanding_bottom_sheet.dart';
import 'model/app_state_model.dart';
import 'model/product.dart';
import 'supplemental/asymmetric_view.dart';

14
class ProductPage extends StatelessWidget {
15
  const ProductPage({super.key, this.category = Category.all});
16 17 18 19 20 21

  final Category category;

  @override
  Widget build(BuildContext context) {
    return ScopedModelDescendant<AppStateModel>(
22
      builder: (BuildContext context, Widget? child, AppStateModel model) {
23
        return AsymmetricView(products: model.getProducts());
24
      });
25 26 27 28 29 30 31
  }
}

class HomePage extends StatelessWidget {
  const HomePage({
    this.expandingBottomSheet,
    this.backdrop,
32 33
    super.key,
  });
34

35 36
  final ExpandingBottomSheet? expandingBottomSheet;
  final Backdrop? backdrop;
37 38 39 40 41

  @override
  Widget build(BuildContext context) {
    return Stack(
      children: <Widget>[
42 43
        if (backdrop != null)
          backdrop!,
44
        Align(alignment: Alignment.bottomRight, child: expandingBottomSheet),
45 46 47 48
      ],
    );
  }
}