Skip to content

Commit e7c05e5

Browse files
committed
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 flutter#266
1 parent 503218c commit e7c05e5

File tree

3 files changed

+31
-40
lines changed

3 files changed

+31
-40
lines changed

packages/flutter/lib/material.dart

-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ export 'src/material/material_button.dart';
3737
export 'src/material/material_list.dart';
3838
export 'src/material/page.dart';
3939
export 'src/material/popup_menu.dart';
40-
export 'src/material/popup_menu_item.dart';
4140
export 'src/material/progress_indicator.dart';
4241
export 'src/material/radio.dart';
4342
export 'src/material/raised_button.dart';

packages/flutter/lib/src/material/popup_menu.dart

+31-5
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,42 @@ import 'package:flutter/widgets.dart';
99

1010
import 'ink_well.dart';
1111
import 'material.dart';
12-
import 'popup_menu_item.dart';
12+
import 'theme.dart';
1313

1414
const Duration _kMenuDuration = const Duration(milliseconds: 300);
15+
const double _kBaselineOffsetFromBottom = 20.0;
1516
const double _kMenuCloseIntervalEnd = 2.0 / 3.0;
16-
const double _kMenuWidthStep = 56.0;
17-
const double _kMenuMinWidth = 2.0 * _kMenuWidthStep;
18-
const double _kMenuMaxWidth = 5.0 * _kMenuWidthStep;
1917
const double _kMenuHorizontalPadding = 16.0;
18+
const double _kMenuItemHeight = 48.0;
19+
const double _kMenuMaxWidth = 5.0 * _kMenuWidthStep;
20+
const double _kMenuMinWidth = 2.0 * _kMenuWidthStep;
2021
const double _kMenuVerticalPadding = 8.0;
22+
const double _kMenuWidthStep = 56.0;
23+
24+
class PopupMenuItem<T> extends StatelessComponent {
25+
PopupMenuItem({
26+
Key key,
27+
this.value,
28+
this.child
29+
}) : super(key: key);
30+
31+
final Widget child;
32+
final T value;
33+
34+
Widget build(BuildContext context) {
35+
return new Container(
36+
height: _kMenuItemHeight,
37+
padding: const EdgeDims.symmetric(horizontal: _kMenuHorizontalPadding),
38+
child: new DefaultTextStyle(
39+
style: Theme.of(context).text.subhead,
40+
child: new Baseline(
41+
baseline: _kMenuItemHeight - _kBaselineOffsetFromBottom,
42+
child: child
43+
)
44+
)
45+
);
46+
}
47+
}
2148

2249
class _PopupMenu<T> extends StatelessComponent {
2350
_PopupMenu({
@@ -71,7 +98,6 @@ class _PopupMenu<T> extends StatelessComponent {
7198
child: new Block(
7299
children,
73100
padding: const EdgeDims.symmetric(
74-
horizontal: _kMenuHorizontalPadding,
75101
vertical: _kMenuVerticalPadding
76102
)
77103
)

packages/flutter/lib/src/material/popup_menu_item.dart

-34
This file was deleted.

0 commit comments

Comments
 (0)