1
0
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:
Pierre-Louis
2020-02-05 20:11:54 +01:00
committed by GitHub
parent 082592e9a9
commit cee267cf88
762 changed files with 12 additions and 12 deletions

View File

@@ -0,0 +1,52 @@
// 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:gallery/layout/adaptive.dart';
class PageStatus extends InheritedWidget {
const PageStatus({
Key key,
@required this.cartController,
@required this.menuController,
@required Widget child,
}) : assert(cartController != null),
assert(menuController != null),
super(key: key, child: child);
final AnimationController cartController;
final AnimationController menuController;
static PageStatus of(BuildContext context) {
return context.dependOnInheritedWidgetOfExactType<PageStatus>();
}
@override
bool updateShouldNotify(PageStatus old) =>
old.cartController != cartController ||
old.menuController != menuController;
}
bool productPageIsVisible(BuildContext context) {
return _cartControllerOf(context).isDismissed &&
(_menuControllerOf(context).isCompleted || isDisplayDesktop(context));
}
bool menuPageIsVisible(BuildContext context) {
return _cartControllerOf(context).isDismissed &&
(_menuControllerOf(context).isDismissed || isDisplayDesktop(context));
}
bool cartPageIsVisible(BuildContext context) {
return _cartControllerOf(context).isCompleted;
}
AnimationController _cartControllerOf(BuildContext context) {
return PageStatus.of(context).cartController;
}
AnimationController _menuControllerOf(BuildContext context) {
return PageStatus.of(context).menuController;
}