Commit e7c05e57 authored by Adam Barth's avatar Adam Barth

Popup menu splash doesn't go to edge

Now the splash goes to the edge. Also, fold popup_menu_item.dart into
popup_menu.dart for simplicity.

Fixes #266
parent 503218cd
......@@ -37,7 +37,6 @@ export 'src/material/material_button.dart';
export 'src/material/material_list.dart';
export 'src/material/page.dart';
export 'src/material/popup_menu.dart';
export 'src/material/popup_menu_item.dart';
export 'src/material/progress_indicator.dart';
export 'src/material/radio.dart';
export 'src/material/raised_button.dart';
......
......@@ -9,15 +9,42 @@ import 'package:flutter/widgets.dart';
import 'ink_well.dart';
import 'material.dart';
import 'popup_menu_item.dart';
import 'theme.dart';
const Duration _kMenuDuration = const Duration(milliseconds: 300);
const double _kBaselineOffsetFromBottom = 20.0;
const double _kMenuCloseIntervalEnd = 2.0 / 3.0;
const double _kMenuWidthStep = 56.0;
const double _kMenuMinWidth = 2.0 * _kMenuWidthStep;
const double _kMenuMaxWidth = 5.0 * _kMenuWidthStep;
const double _kMenuHorizontalPadding = 16.0;
const double _kMenuItemHeight = 48.0;
const double _kMenuMaxWidth = 5.0 * _kMenuWidthStep;
const double _kMenuMinWidth = 2.0 * _kMenuWidthStep;
const double _kMenuVerticalPadding = 8.0;
const double _kMenuWidthStep = 56.0;
class PopupMenuItem<T> extends StatelessComponent {
PopupMenuItem({
Key key,
this.value,
this.child
}) : super(key: key);
final Widget child;
final T value;
Widget build(BuildContext context) {
return new Container(
height: _kMenuItemHeight,
padding: const EdgeDims.symmetric(horizontal: _kMenuHorizontalPadding),
child: new DefaultTextStyle(
style: Theme.of(context).text.subhead,
child: new Baseline(
baseline: _kMenuItemHeight - _kBaselineOffsetFromBottom,
child: child
)
)
);
}
}
class _PopupMenu<T> extends StatelessComponent {
_PopupMenu({
......@@ -71,7 +98,6 @@ class _PopupMenu<T> extends StatelessComponent {
child: new Block(
children,
padding: const EdgeDims.symmetric(
horizontal: _kMenuHorizontalPadding,
vertical: _kMenuVerticalPadding
)
)
......
// Copyright 2015 The Chromium Authors. 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/widgets.dart';
import 'theme.dart';
const double _kMenuItemHeight = 48.0;
const double _kBaselineOffsetFromBottom = 20.0;
class PopupMenuItem<T> extends StatelessComponent {
PopupMenuItem({
Key key,
this.value,
this.child
}) : super(key: key);
final Widget child;
final T value;
Widget build(BuildContext context) {
return new Container(
height: _kMenuItemHeight,
child: new DefaultTextStyle(
style: Theme.of(context).text.subhead,
child: new Baseline(
baseline: _kMenuItemHeight - _kBaselineOffsetFromBottom,
child: child
)
)
);
}
}
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