Commit cf17dd96 authored by Hans Muller's avatar Hans Muller

Merge pull request #1509 from HansMuller/remove_popup_menu_margin

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.
parents 66c6ce37 56d9d85f
...@@ -6,12 +6,14 @@ part of stocks; ...@@ -6,12 +6,14 @@ part of stocks;
enum _MenuItems { autorefresh, autorefreshCheckbox, add, remove } enum _MenuItems { autorefresh, autorefreshCheckbox, add, remove }
const double _kMenuMargin = 16.0; // 24.0 on tablet
Future showStockMenu(NavigatorState navigator, { bool autorefresh, ValueChanged onAutorefreshChanged }) async { Future showStockMenu(NavigatorState navigator, { bool autorefresh, ValueChanged onAutorefreshChanged }) async {
switch (await showMenu( switch (await showMenu(
navigator: navigator, navigator: navigator,
position: new MenuPosition( position: new MenuPosition(
right: sky.view.paddingRight, right: sky.view.paddingRight + _kMenuMargin,
top: sky.view.paddingTop top: sky.view.paddingTop + _kMenuMargin
), ),
builder: (NavigatorState navigator) { builder: (NavigatorState navigator) {
return <PopupMenuItem>[ return <PopupMenuItem>[
......
...@@ -63,16 +63,11 @@ class NavigatorState extends State<Navigator> { ...@@ -63,16 +63,11 @@ class NavigatorState extends State<Navigator> {
} }
void pushNamed(String name) { void pushNamed(String name) {
RouteBuilder builder; RouteBuilder generateRoute() {
if (!config.routes.containsKey(name)) {
assert(config.onGenerateRoute != null); assert(config.onGenerateRoute != null);
builder = config.onGenerateRoute(name); return config.onGenerateRoute(name);
} else {
builder = config.routes[name];
} }
if (builder == null) RouteBuilder builder = config.routes[name] ?? generateRoute() ?? config.onUnknownRoute;
builder = config.onUnknownRoute; // 404!
assert(builder != null); // 404 getting your 404!
push(new PageRoute(builder)); push(new PageRoute(builder));
} }
...@@ -87,7 +82,6 @@ class NavigatorState extends State<Navigator> { ...@@ -87,7 +82,6 @@ class NavigatorState extends State<Navigator> {
assert(!_debugCurrentlyHaveRoute(route)); assert(!_debugCurrentlyHaveRoute(route));
setState(() { setState(() {
while (currentRoute.ephemeral) { while (currentRoute.ephemeral) {
assert(currentRoute.ephemeral);
currentRoute.didPop(null); currentRoute.didPop(null);
_currentPosition -= 1; _currentPosition -= 1;
} }
......
...@@ -21,7 +21,6 @@ import 'package:sky/src/widgets/transitions.dart'; ...@@ -21,7 +21,6 @@ import 'package:sky/src/widgets/transitions.dart';
const Duration _kMenuDuration = const Duration(milliseconds: 300); const Duration _kMenuDuration = const Duration(milliseconds: 300);
const double _kMenuCloseIntervalEnd = 2.0 / 3.0; const double _kMenuCloseIntervalEnd = 2.0 / 3.0;
const double _kMenuWidthStep = 56.0; const double _kMenuWidthStep = 56.0;
const double _kMenuMargin = 16.0; // 24.0 on tablet
const double _kMenuMinWidth = 2.0 * _kMenuWidthStep; const double _kMenuMinWidth = 2.0 * _kMenuWidthStep;
const double _kMenuMaxWidth = 5.0 * _kMenuWidthStep; const double _kMenuMaxWidth = 5.0 * _kMenuWidthStep;
const double _kMenuHorizontalPadding = 16.0; const double _kMenuHorizontalPadding = 16.0;
...@@ -75,8 +74,6 @@ class PopupMenu extends StatelessComponent { ...@@ -75,8 +74,6 @@ class PopupMenu extends StatelessComponent {
return new FadeTransition( return new FadeTransition(
performance: performance, performance: performance,
opacity: new AnimatedValue<double>(0.0, end: 1.0, curve: new Interval(0.0, 1.0 / 3.0)), 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( child: new BuilderTransition(
performance: performance, performance: performance,
variables: [width, height], variables: [width, height],
...@@ -108,7 +105,6 @@ class PopupMenu extends StatelessComponent { ...@@ -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