Version 0.0 of a gallery demo of the Material Design "Shrine" app (#4327)

This commit is contained in:
Hans Muller
2016-06-02 14:23:20 -07:00
parent a464052191
commit 309b9f8010
16 changed files with 1070 additions and 13 deletions

View File

@@ -183,7 +183,7 @@ class AppBar extends StatelessWidget {
final double statusBarHeight = MediaQuery.of(context).padding.top;
final ThemeData theme = Theme.of(context);
IconThemeData iconTheme = theme.primaryIconTheme;
IconThemeData iconTheme = IconTheme.of(context) ?? theme.primaryIconTheme;
TextStyle centerStyle = textTheme?.title ?? theme.primaryTextTheme.title;
TextStyle sideStyle = textTheme?.body1 ?? theme.primaryTextTheme.body1;

View File

@@ -17,8 +17,9 @@ class Card extends StatelessWidget {
/// Creates a material design card.
const Card({
Key key,
this.child,
this.color
this.color,
this.elevation: 2,
this.child
}) : super(key: key);
/// The widget below this widget in the tree.
@@ -27,6 +28,9 @@ class Card extends StatelessWidget {
/// The color of material used for this card.
final Color color;
/// The following elevations have defined shadows: 1, 2, 3, 4, 6, 8, 9, 12, 16, 24
final int elevation;
@override
Widget build(BuildContext context) {
return new Container(
@@ -34,7 +38,7 @@ class Card extends StatelessWidget {
child: new Material(
color: color,
type: MaterialType.card,
elevation: 2,
elevation: elevation,
child: child
)
);

View File

@@ -32,6 +32,10 @@ abstract class Route<T> {
/// Called after install() when the route is pushed onto the navigator.
void didPush() { }
/// When this route is popped (see [Navigator.pop]) if the result isn't
/// specified or if it's null, this value will be used instead.
T get currentResult => null;
/// Called after install() when the route replaced another in the navigator.
void didReplace(Route<dynamic> oldRoute) { }
@@ -427,7 +431,7 @@ class NavigatorState extends State<Navigator> {
assert(route._navigator == this);
bool debugPredictedWouldPop;
assert(() { debugPredictedWouldPop = !route.willHandlePopInternally; return true; });
if (route.didPop(result)) {
if (route.didPop(result ?? route.currentResult)) {
assert(debugPredictedWouldPop);
if (_history.length > 1) {
setState(() {
@@ -564,11 +568,12 @@ class NavigatorTransaction {
/// (if any) is notified using its didPop() method, and the previous route is
/// notified using [Route.didChangeNext].
///
/// If non-null, [result] will be used as the result of the route. Routes
/// such as dialogs or popup menus typically use this mechanism to return the
/// value selected by the user to the widget that created their route. The
/// type of [result], if provided, must match the type argument of the class
/// of the current route. (In practice, this is usually "dynamic".)
/// If non-null, [result] will be used as the result of the route, otherwise
/// the route's [Route.currentValue] will be used. Routes such as dialogs or
/// popup menus typically use this mechanism to return the value selected by
/// the user to the widget that created their route. The type of [result],
/// if provided, must match the type argument of the class of the current
/// route. (In practice, this is usually "dynamic".)
///
/// Returns true if a route was popped; returns false if there are no further
/// previous routes.