Commit 56d9d85f authored by Hans Muller's avatar Hans Muller

Remove PopupMenu margin

The margins make using showMenu's menuPosition argument difficult and they're not really needed.

I also made a few small gratuitous changes in navigator.dart.
parent 2d0d1645
......@@ -6,12 +6,14 @@ part of stocks;
enum _MenuItems { autorefresh, autorefreshCheckbox, add, remove }
const double _kMenuMargin = 16.0; // 24.0 on tablet
Future showStockMenu(NavigatorState navigator, { bool autorefresh, ValueChanged onAutorefreshChanged }) async {
switch (await showMenu(
navigator: navigator,
position: new MenuPosition(
right: sky.view.paddingRight,
top: sky.view.paddingTop
right: sky.view.paddingRight + _kMenuMargin,
top: sky.view.paddingTop + _kMenuMargin
),
builder: (NavigatorState navigator) {
return <PopupMenuItem>[
......
......@@ -63,16 +63,11 @@ class NavigatorState extends State<Navigator> {
}
void pushNamed(String name) {
RouteBuilder builder;
if (!config.routes.containsKey(name)) {
RouteBuilder generateRoute() {
assert(config.onGenerateRoute != null);
builder = config.onGenerateRoute(name);
} else {
builder = config.routes[name];
return config.onGenerateRoute(name);
}
if (builder == null)
builder = config.onUnknownRoute; // 404!
assert(builder != null); // 404 getting your 404!
RouteBuilder builder = config.routes[name] ?? generateRoute() ?? config.onUnknownRoute;
push(new PageRoute(builder));
}
......@@ -87,7 +82,6 @@ class NavigatorState extends State<Navigator> {
assert(!_debugCurrentlyHaveRoute(route));
setState(() {
while (currentRoute.ephemeral) {
assert(currentRoute.ephemeral);
currentRoute.didPop(null);
_currentPosition -= 1;
}
......
......@@ -21,7 +21,6 @@ import 'package:sky/src/widgets/transitions.dart';
const Duration _kMenuDuration = const Duration(milliseconds: 300);
const double _kMenuCloseIntervalEnd = 2.0 / 3.0;
const double _kMenuWidthStep = 56.0;
const double _kMenuMargin = 16.0; // 24.0 on tablet
const double _kMenuMinWidth = 2.0 * _kMenuWidthStep;
const double _kMenuMaxWidth = 5.0 * _kMenuWidthStep;
const double _kMenuHorizontalPadding = 16.0;
......@@ -75,8 +74,6 @@ class PopupMenu extends StatelessComponent {
return new FadeTransition(
performance: performance,
opacity: new AnimatedValue<double>(0.0, end: 1.0, curve: new Interval(0.0, 1.0 / 3.0)),
child: new Container(
margin: new EdgeDims.all(_kMenuMargin),
child: new BuilderTransition(
performance: performance,
variables: [width, height],
......@@ -108,7 +105,6 @@ class PopupMenu extends StatelessComponent {
);
}
)
)
);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment