Merge pull request #763 from abarth/popup_splash
Popup menu splash doesn't go to edge
This commit is contained in:
@@ -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
|
||||
)
|
||||
)
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
// 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
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user