Commit 87fb075f authored by Dragoș Tiselice's avatar Dragoș Tiselice Committed by GitHub

Renamed DropDown to Dropdown. (#5897)

Fixes #3208.
parent 8ac14f86
...@@ -143,7 +143,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> { ...@@ -143,7 +143,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
children: <Widget>[ children: <Widget>[
new ListItem( new ListItem(
title: new Text('Scrollable dropdown:'), title: new Text('Scrollable dropdown:'),
trailing: new DropDownButton<String>( trailing: new DropdownButton<String>(
value: dropdown1Value, value: dropdown1Value,
onChanged: (String newValue) { onChanged: (String newValue) {
setState(() { setState(() {
...@@ -156,7 +156,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> { ...@@ -156,7 +156,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
'Bit', 'More', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten' 'Bit', 'More', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten'
] ]
.map((String value) { .map((String value) {
return new DropDownMenuItem<String>( return new DropdownMenuItem<String>(
value: value, value: value,
child: new Text(value)); child: new Text(value));
}) })
...@@ -168,7 +168,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> { ...@@ -168,7 +168,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
), ),
new ListItem( new ListItem(
title: new Text('Simple dropdown:'), title: new Text('Simple dropdown:'),
trailing: new DropDownButton<String>( trailing: new DropdownButton<String>(
value: dropdown2Value, value: dropdown2Value,
onChanged: (String newValue) { onChanged: (String newValue) {
setState(() { setState(() {
...@@ -178,7 +178,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> { ...@@ -178,7 +178,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
}, },
items: <String>['One', 'Two', 'Free', 'Four'] items: <String>['One', 'Two', 'Free', 'Four']
.map((String value) { .map((String value) {
return new DropDownMenuItem<String>( return new DropdownMenuItem<String>(
value: value, value: value,
child: new Text(value)); child: new Text(value));
}) })
......
...@@ -73,16 +73,16 @@ class OrderItem extends StatelessWidget { ...@@ -73,16 +73,16 @@ class OrderItem extends StatelessWidget {
new SizedBox(height: 16.0), new SizedBox(height: 16.0),
new Padding( new Padding(
padding: const EdgeInsets.only(top: 8.0, bottom: 8.0, right: 88.0), padding: const EdgeInsets.only(top: 8.0, bottom: 8.0, right: 88.0),
child: new DropDownButtonHideUnderline( child: new DropdownButtonHideUnderline(
child: new Container( child: new Container(
decoration: new BoxDecoration( decoration: new BoxDecoration(
border: new Border.all( border: new Border.all(
color: const Color(0xFFD9D9D9) color: const Color(0xFFD9D9D9)
) )
), ),
child: new DropDownButton<int>( child: new DropdownButton<int>(
items: <int>[0, 1, 2, 3, 4, 5].map((int value) { items: <int>[0, 1, 2, 3, 4, 5].map((int value) {
return new DropDownMenuItem<int>( return new DropdownMenuItem<int>(
value: value, value: value,
child: new Padding( child: new Padding(
padding: const EdgeInsets.only(left: 8.0), padding: const EdgeInsets.only(left: 8.0),
......
...@@ -56,7 +56,7 @@ new FlatButton( ...@@ -56,7 +56,7 @@ new FlatButton(
String dropdownValue; String dropdownValue;
// Drop down button with string values. // Drop down button with string values.
new DropDownButton<String>( new DropdownButton<String>(
value: dropdownValue, value: dropdownValue,
onChanged: (String newValue) { onChanged: (String newValue) {
// null indicates the user didn't select a // null indicates the user didn't select a
...@@ -68,7 +68,7 @@ new DropDownButton<String>( ...@@ -68,7 +68,7 @@ new DropDownButton<String>(
}, },
items: <String>['One', 'Two', 'Free', 'Four'] items: <String>['One', 'Two', 'Free', 'Four']
.map((String value) { .map((String value) {
return new DropDownMenuItem<String>( return new DropdownMenuItem<String>(
value: value, value: value,
child: new Text(value)); child: new Text(value));
}) })
......
...@@ -153,7 +153,7 @@ class DataCell { ...@@ -153,7 +153,7 @@ class DataCell {
/// Creates an object to hold the data for a cell in a [DataTable]. /// Creates an object to hold the data for a cell in a [DataTable].
/// ///
/// The first argument is the widget to show for the cell, typically /// The first argument is the widget to show for the cell, typically
/// a [Text] or [DropDownButton] widget; this becomes the [widget] /// a [Text] or [DropdownButton] widget; this becomes the [widget]
/// property and must not be null. /// property and must not be null.
/// ///
/// If the cell has no data, then a [Text] widget with placeholder /// If the cell has no data, then a [Text] widget with placeholder
...@@ -170,7 +170,7 @@ class DataCell { ...@@ -170,7 +170,7 @@ class DataCell {
/// The data for the row. /// The data for the row.
/// ///
/// Typically a [Text] widget or a [DropDownButton] widget. /// Typically a [Text] widget or a [DropdownButton] widget.
/// ///
/// If the cell has no data, then a [Text] widget with placeholder /// If the cell has no data, then a [Text] widget with placeholder
/// text should be provided instead, and [placeholder] should be set /// text should be provided instead, and [placeholder] should be set
...@@ -470,7 +470,7 @@ class DataTable extends StatelessWidget { ...@@ -470,7 +470,7 @@ class DataTable extends StatelessWidget {
data: new IconThemeData( data: new IconThemeData(
color: isLightTheme ? Colors.black54 : Colors.white70 color: isLightTheme ? Colors.black54 : Colors.white70
), ),
child: new DropDownButtonHideUnderline(child: label) child: new DropdownButtonHideUnderline(child: label)
) )
) )
); );
......
...@@ -19,13 +19,13 @@ import 'shadows.dart'; ...@@ -19,13 +19,13 @@ import 'shadows.dart';
import 'theme.dart'; import 'theme.dart';
import 'material.dart'; import 'material.dart';
const Duration _kDropDownMenuDuration = const Duration(milliseconds: 300); const Duration _kDropdownMenuDuration = const Duration(milliseconds: 300);
const double _kMenuItemHeight = 48.0; const double _kMenuItemHeight = 48.0;
const EdgeInsets _kMenuVerticalPadding = const EdgeInsets.symmetric(vertical: 8.0); const EdgeInsets _kMenuVerticalPadding = const EdgeInsets.symmetric(vertical: 8.0);
const EdgeInsets _kMenuHorizontalPadding = const EdgeInsets.symmetric(horizontal: 16.0); const EdgeInsets _kMenuHorizontalPadding = const EdgeInsets.symmetric(horizontal: 16.0);
class _DropDownMenuPainter extends CustomPainter { class _DropdownMenuPainter extends CustomPainter {
_DropDownMenuPainter({ _DropdownMenuPainter({
Color color, Color color,
int elevation, int elevation,
this.selectedIndex, this.selectedIndex,
...@@ -68,7 +68,7 @@ class _DropDownMenuPainter extends CustomPainter { ...@@ -68,7 +68,7 @@ class _DropDownMenuPainter extends CustomPainter {
} }
@override @override
bool shouldRepaint(_DropDownMenuPainter oldPainter) { bool shouldRepaint(_DropdownMenuPainter oldPainter) {
return oldPainter.color != color return oldPainter.color != color
|| oldPainter.elevation != elevation || oldPainter.elevation != elevation
|| oldPainter.selectedIndex != selectedIndex || oldPainter.selectedIndex != selectedIndex
...@@ -78,8 +78,8 @@ class _DropDownMenuPainter extends CustomPainter { ...@@ -78,8 +78,8 @@ class _DropDownMenuPainter extends CustomPainter {
// Do not use the platform-specific default scroll configuration. // Do not use the platform-specific default scroll configuration.
// Dropdown menus should never overscroll or display an overscroll indicator. // Dropdown menus should never overscroll or display an overscroll indicator.
class _DropDownScrollConfigurationDelegate extends ScrollConfigurationDelegate { class _DropdownScrollConfigurationDelegate extends ScrollConfigurationDelegate {
const _DropDownScrollConfigurationDelegate(this._platform); const _DropdownScrollConfigurationDelegate(this._platform);
@override @override
TargetPlatform get platform => _platform; TargetPlatform get platform => _platform;
...@@ -97,19 +97,19 @@ class _DropDownScrollConfigurationDelegate extends ScrollConfigurationDelegate { ...@@ -97,19 +97,19 @@ class _DropDownScrollConfigurationDelegate extends ScrollConfigurationDelegate {
bool updateShouldNotify(ScrollConfigurationDelegate old) => platform != old.platform; bool updateShouldNotify(ScrollConfigurationDelegate old) => platform != old.platform;
} }
class _DropDownMenu<T> extends StatefulWidget { class _DropdownMenu<T> extends StatefulWidget {
_DropDownMenu({ _DropdownMenu({
Key key, Key key,
_DropDownRoute<T> route _DropdownRoute<T> route
}) : route = route, super(key: key); }) : route = route, super(key: key);
final _DropDownRoute<T> route; final _DropdownRoute<T> route;
@override @override
_DropDownMenuState<T> createState() => new _DropDownMenuState<T>(); _DropdownMenuState<T> createState() => new _DropdownMenuState<T>();
} }
class _DropDownMenuState<T> extends State<_DropDownMenu<T>> { class _DropdownMenuState<T> extends State<_DropdownMenu<T>> {
CurvedAnimation _fadeOpacity; CurvedAnimation _fadeOpacity;
CurvedAnimation _resize; CurvedAnimation _resize;
...@@ -142,7 +142,7 @@ class _DropDownMenuState<T> extends State<_DropDownMenu<T>> { ...@@ -142,7 +142,7 @@ class _DropDownMenuState<T> extends State<_DropDownMenu<T>> {
// //
// When the menu is dismissed we just fade the entire thing out // When the menu is dismissed we just fade the entire thing out
// in the first 0.25s. // in the first 0.25s.
final _DropDownRoute<T> route = config.route; final _DropdownRoute<T> route = config.route;
final double unit = 0.5 / (route.items.length + 1.5); final double unit = 0.5 / (route.items.length + 1.5);
final List<Widget> children = <Widget>[]; final List<Widget> children = <Widget>[];
for (int itemIndex = 0; itemIndex < route.items.length; ++itemIndex) { for (int itemIndex = 0; itemIndex < route.items.length; ++itemIndex) {
...@@ -163,7 +163,7 @@ class _DropDownMenuState<T> extends State<_DropDownMenu<T>> { ...@@ -163,7 +163,7 @@ class _DropDownMenuState<T> extends State<_DropDownMenu<T>> {
), ),
onTap: () => Navigator.pop( onTap: () => Navigator.pop(
context, context,
new _DropDownRouteResult<T>(route.items[itemIndex].value) new _DropdownRouteResult<T>(route.items[itemIndex].value)
) )
) )
)); ));
...@@ -172,7 +172,7 @@ class _DropDownMenuState<T> extends State<_DropDownMenu<T>> { ...@@ -172,7 +172,7 @@ class _DropDownMenuState<T> extends State<_DropDownMenu<T>> {
return new FadeTransition( return new FadeTransition(
opacity: _fadeOpacity, opacity: _fadeOpacity,
child: new CustomPaint( child: new CustomPaint(
painter: new _DropDownMenuPainter( painter: new _DropdownMenuPainter(
color: Theme.of(context).canvasColor, color: Theme.of(context).canvasColor,
elevation: route.elevation, elevation: route.elevation,
selectedIndex: route.selectedIndex, selectedIndex: route.selectedIndex,
...@@ -182,7 +182,7 @@ class _DropDownMenuState<T> extends State<_DropDownMenu<T>> { ...@@ -182,7 +182,7 @@ class _DropDownMenuState<T> extends State<_DropDownMenu<T>> {
type: MaterialType.transparency, type: MaterialType.transparency,
textStyle: route.style, textStyle: route.style,
child: new ScrollConfiguration( child: new ScrollConfiguration(
delegate: new _DropDownScrollConfigurationDelegate(Theme.of(context).platform), delegate: new _DropdownScrollConfigurationDelegate(Theme.of(context).platform),
child: new Scrollbar( child: new Scrollbar(
child: new ScrollableList( child: new ScrollableList(
scrollableKey: config.route.scrollableKey, scrollableKey: config.route.scrollableKey,
...@@ -198,10 +198,10 @@ class _DropDownMenuState<T> extends State<_DropDownMenu<T>> { ...@@ -198,10 +198,10 @@ class _DropDownMenuState<T> extends State<_DropDownMenu<T>> {
} }
} }
class _DropDownMenuRouteLayout<T> extends SingleChildLayoutDelegate { class _DropdownMenuRouteLayout<T> extends SingleChildLayoutDelegate {
_DropDownMenuRouteLayout({ this.route }); _DropdownMenuRouteLayout({ this.route });
final _DropDownRoute<T> route; final _DropdownRoute<T> route;
Rect get buttonRect => route.buttonRect; Rect get buttonRect => route.buttonRect;
int get selectedIndex => route.selectedIndex; int get selectedIndex => route.selectedIndex;
...@@ -263,22 +263,22 @@ class _DropDownMenuRouteLayout<T> extends SingleChildLayoutDelegate { ...@@ -263,22 +263,22 @@ class _DropDownMenuRouteLayout<T> extends SingleChildLayoutDelegate {
} }
@override @override
bool shouldRelayout(_DropDownMenuRouteLayout<T> oldDelegate) => oldDelegate.route != route; bool shouldRelayout(_DropdownMenuRouteLayout<T> oldDelegate) => oldDelegate.route != route;
} }
// We box the return value so that the return value can be null. Otherwise, // We box the return value so that the return value can be null. Otherwise,
// canceling the route (which returns null) would get confused with actually // canceling the route (which returns null) would get confused with actually
// returning a real null value. // returning a real null value.
class _DropDownRouteResult<T> { class _DropdownRouteResult<T> {
const _DropDownRouteResult(this.result); const _DropdownRouteResult(this.result);
final T result; final T result;
@override @override
bool operator ==(dynamic other) { bool operator ==(dynamic other) {
if (other is! _DropDownRouteResult<T>) if (other is! _DropdownRouteResult<T>)
return false; return false;
final _DropDownRouteResult<T> typedOther = other; final _DropdownRouteResult<T> typedOther = other;
return result == typedOther.result; return result == typedOther.result;
} }
...@@ -286,9 +286,9 @@ class _DropDownRouteResult<T> { ...@@ -286,9 +286,9 @@ class _DropDownRouteResult<T> {
int get hashCode => result.hashCode; int get hashCode => result.hashCode;
} }
class _DropDownRoute<T> extends PopupRoute<_DropDownRouteResult<T>> { class _DropdownRoute<T> extends PopupRoute<_DropdownRouteResult<T>> {
_DropDownRoute({ _DropdownRoute({
Completer<_DropDownRouteResult<T>> completer, Completer<_DropdownRouteResult<T>> completer,
this.items, this.items,
this.buttonRect, this.buttonRect,
this.selectedIndex, this.selectedIndex,
...@@ -298,8 +298,8 @@ class _DropDownRoute<T> extends PopupRoute<_DropDownRouteResult<T>> { ...@@ -298,8 +298,8 @@ class _DropDownRoute<T> extends PopupRoute<_DropDownRouteResult<T>> {
assert(style != null); assert(style != null);
} }
final GlobalKey<ScrollableState> scrollableKey = new GlobalKey<ScrollableState>(debugLabel: '_DropDownMenu'); final GlobalKey<ScrollableState> scrollableKey = new GlobalKey<ScrollableState>(debugLabel: '_DropdownMenu');
final List<DropDownMenuItem<T>> items; final List<DropdownMenuItem<T>> items;
final Rect buttonRect; final Rect buttonRect;
final int selectedIndex; final int selectedIndex;
final int elevation; final int elevation;
...@@ -319,7 +319,7 @@ class _DropDownRoute<T> extends PopupRoute<_DropDownRouteResult<T>> { ...@@ -319,7 +319,7 @@ class _DropDownRoute<T> extends PopupRoute<_DropDownRouteResult<T>> {
} }
@override @override
Duration get transitionDuration => _kDropDownMenuDuration; Duration get transitionDuration => _kDropdownMenuDuration;
@override @override
bool get barrierDismissable => true; bool get barrierDismissable => true;
...@@ -330,21 +330,21 @@ class _DropDownRoute<T> extends PopupRoute<_DropDownRouteResult<T>> { ...@@ -330,21 +330,21 @@ class _DropDownRoute<T> extends PopupRoute<_DropDownRouteResult<T>> {
@override @override
Widget buildPage(BuildContext context, Animation<double> animation, Animation<double> forwardAnimation) { Widget buildPage(BuildContext context, Animation<double> animation, Animation<double> forwardAnimation) {
return new CustomSingleChildLayout( return new CustomSingleChildLayout(
delegate: new _DropDownMenuRouteLayout<T>(route: this), delegate: new _DropdownMenuRouteLayout<T>(route: this),
child: new _DropDownMenu<T>(route: this) child: new _DropdownMenu<T>(route: this)
); );
} }
} }
/// An item in a menu created by a [DropDownButton]. /// An item in a menu created by a [DropdownButton].
/// ///
/// The type `T` is the type of the value the entry represents. All the entries /// The type `T` is the type of the value the entry represents. All the entries
/// in a given menu must represent values with consistent types. /// in a given menu must represent values with consistent types.
class DropDownMenuItem<T> extends StatelessWidget { class DropdownMenuItem<T> extends StatelessWidget {
/// Creates an item for a drop down menu. /// Creates an item for a drop down menu.
/// ///
/// The [child] argument is required. /// The [child] argument is required.
DropDownMenuItem({ DropdownMenuItem({
Key key, Key key,
this.value, this.value,
this.child this.child
...@@ -359,7 +359,7 @@ class DropDownMenuItem<T> extends StatelessWidget { ...@@ -359,7 +359,7 @@ class DropDownMenuItem<T> extends StatelessWidget {
/// The value to return if the user selects this menu item. /// The value to return if the user selects this menu item.
/// ///
/// Eventually returned in a call to [DropDownButton.onChanged]. /// Eventually returned in a call to [DropdownButton.onChanged].
final T value; final T value;
@override @override
...@@ -372,30 +372,30 @@ class DropDownMenuItem<T> extends StatelessWidget { ...@@ -372,30 +372,30 @@ class DropDownMenuItem<T> extends StatelessWidget {
} }
} }
/// An inherited widget that causes any descendant [DropDownButton] /// An inherited widget that causes any descendant [DropdownButton]
/// widgets to not include their regular underline. /// widgets to not include their regular underline.
/// ///
/// This is used by [DataTable] to remove the underline from any /// This is used by [DataTable] to remove the underline from any
/// [DropDownButton] widgets placed within material data tables, as /// [DropdownButton] widgets placed within material data tables, as
/// required by the material design specification. /// required by the material design specification.
class DropDownButtonHideUnderline extends InheritedWidget { class DropdownButtonHideUnderline extends InheritedWidget {
/// Creates a [DropDownButtonHideUnderline]. A non-null [child] must /// Creates a [DropdownButtonHideUnderline]. A non-null [child] must
/// be given. /// be given.
DropDownButtonHideUnderline({ DropdownButtonHideUnderline({
Key key, Key key,
Widget child Widget child
}) : super(key: key, child: child) { }) : super(key: key, child: child) {
assert(child != null); assert(child != null);
} }
/// Returns whether the underline of [DropDownButton] widgets should /// Returns whether the underline of [DropdownButton] widgets should
/// be hidden. /// be hidden.
static bool at(BuildContext context) { static bool at(BuildContext context) {
return context.inheritFromWidgetOfExactType(DropDownButtonHideUnderline) != null; return context.inheritFromWidgetOfExactType(DropdownButtonHideUnderline) != null;
} }
@override @override
bool updateShouldNotify(DropDownButtonHideUnderline old) => false; bool updateShouldNotify(DropdownButtonHideUnderline old) => false;
} }
/// A material design button for selecting from a list of items. /// A material design button for selecting from a list of items.
...@@ -411,14 +411,14 @@ class DropDownButtonHideUnderline extends InheritedWidget { ...@@ -411,14 +411,14 @@ class DropDownButtonHideUnderline extends InheritedWidget {
/// * [RaisedButton] /// * [RaisedButton]
/// * [FlatButton] /// * [FlatButton]
/// * <https://www.google.com/design/spec/components/buttons.html#buttons-dropdown-buttons> /// * <https://www.google.com/design/spec/components/buttons.html#buttons-dropdown-buttons>
class DropDownButton<T> extends StatefulWidget { class DropdownButton<T> extends StatefulWidget {
/// Creates a drop down button. /// Creates a drop down button.
/// ///
/// The [items] must have distinct values and [value] must be among them. /// The [items] must have distinct values and [value] must be among them.
/// ///
/// The [elevation] and [iconSize] arguments must not be null (they both have /// The [elevation] and [iconSize] arguments must not be null (they both have
/// defaults, so do not need to be specified). /// defaults, so do not need to be specified).
DropDownButton({ DropdownButton({
Key key, Key key,
@required this.items, @required this.items,
@required this.value, @required this.value,
...@@ -428,11 +428,11 @@ class DropDownButton<T> extends StatefulWidget { ...@@ -428,11 +428,11 @@ class DropDownButton<T> extends StatefulWidget {
this.iconSize: 24.0 this.iconSize: 24.0
}) : super(key: key) { }) : super(key: key) {
assert(items != null); assert(items != null);
assert(items.where((DropDownMenuItem<T> item) => item.value == value).length == 1); assert(items.where((DropdownMenuItem<T> item) => item.value == value).length == 1);
} }
/// The list of possible items to select among. /// The list of possible items to select among.
final List<DropDownMenuItem<T>> items; final List<DropdownMenuItem<T>> items;
/// The currently selected item. /// The currently selected item.
final T value; final T value;
...@@ -458,10 +458,10 @@ class DropDownButton<T> extends StatefulWidget { ...@@ -458,10 +458,10 @@ class DropDownButton<T> extends StatefulWidget {
final double iconSize; final double iconSize;
@override @override
_DropDownButtonState<T> createState() => new _DropDownButtonState<T>(); _DropdownButtonState<T> createState() => new _DropdownButtonState<T>();
} }
class _DropDownButtonState<T> extends State<DropDownButton<T>> { class _DropdownButtonState<T> extends State<DropdownButton<T>> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
...@@ -470,7 +470,7 @@ class _DropDownButtonState<T> extends State<DropDownButton<T>> { ...@@ -470,7 +470,7 @@ class _DropDownButtonState<T> extends State<DropDownButton<T>> {
} }
@override @override
void didUpdateConfig(DropDownButton<T> oldConfig) { void didUpdateConfig(DropdownButton<T> oldConfig) {
if (config.items[_selectedIndex].value != config.value) if (config.items[_selectedIndex].value != config.value)
_updateSelectedIndex(); _updateSelectedIndex();
} }
...@@ -488,14 +488,14 @@ class _DropDownButtonState<T> extends State<DropDownButton<T>> { ...@@ -488,14 +488,14 @@ class _DropDownButtonState<T> extends State<DropDownButton<T>> {
TextStyle get _textStyle => config.style ?? Theme.of(context).textTheme.subhead; TextStyle get _textStyle => config.style ?? Theme.of(context).textTheme.subhead;
_DropDownRoute<T> _currentRoute; _DropdownRoute<T> _currentRoute;
void _handleTap() { void _handleTap() {
assert(_currentRoute == null); assert(_currentRoute == null);
final RenderBox itemBox = context.findRenderObject(); final RenderBox itemBox = context.findRenderObject();
final Rect itemRect = itemBox.localToGlobal(Point.origin) & itemBox.size; final Rect itemRect = itemBox.localToGlobal(Point.origin) & itemBox.size;
final Completer<_DropDownRouteResult<T>> completer = new Completer<_DropDownRouteResult<T>>(); final Completer<_DropdownRouteResult<T>> completer = new Completer<_DropdownRouteResult<T>>();
_currentRoute = new _DropDownRoute<T>( _currentRoute = new _DropdownRoute<T>(
completer: completer, completer: completer,
items: config.items, items: config.items,
buttonRect: _kMenuHorizontalPadding.inflateRect(itemRect), buttonRect: _kMenuHorizontalPadding.inflateRect(itemRect),
...@@ -504,7 +504,7 @@ class _DropDownButtonState<T> extends State<DropDownButton<T>> { ...@@ -504,7 +504,7 @@ class _DropDownButtonState<T> extends State<DropDownButton<T>> {
style: _textStyle style: _textStyle
); );
Navigator.push(context, _currentRoute); Navigator.push(context, _currentRoute);
completer.future.then((_DropDownRouteResult<T> newValue) { completer.future.then((_DropdownRouteResult<T> newValue) {
_currentRoute = null; _currentRoute = null;
if (!mounted || newValue == null) if (!mounted || newValue == null)
return; return;
...@@ -540,7 +540,7 @@ class _DropDownButtonState<T> extends State<DropDownButton<T>> { ...@@ -540,7 +540,7 @@ class _DropDownButtonState<T> extends State<DropDownButton<T>> {
) )
); );
if (!DropDownButtonHideUnderline.at(context)) { if (!DropdownButtonHideUnderline.at(context)) {
result = new Stack( result = new Stack(
children: <Widget>[ children: <Widget>[
result, result,
......
...@@ -32,7 +32,7 @@ import 'theme.dart'; ...@@ -32,7 +32,7 @@ import 'theme.dart';
/// See also: /// See also:
/// ///
/// * [RaisedButton] /// * [RaisedButton]
/// * [DropDownButton] /// * [DropdownButton]
/// * <https://www.google.com/design/spec/components/buttons.html> /// * <https://www.google.com/design/spec/components/buttons.html>
class FlatButton extends StatelessWidget { class FlatButton extends StatelessWidget {
/// Creates a flat button. /// Creates a flat button.
......
...@@ -307,8 +307,8 @@ class PaginatedDataTableState extends State<PaginatedDataTable> { ...@@ -307,8 +307,8 @@ class PaginatedDataTableState extends State<PaginatedDataTable> {
if (config.onRowsPerPageChanged != null) { if (config.onRowsPerPageChanged != null) {
List<Widget> availableRowsPerPage = config.availableRowsPerPage List<Widget> availableRowsPerPage = config.availableRowsPerPage
.where((int value) => value <= _rowCount) .where((int value) => value <= _rowCount)
.map/*<DropDownMenuItem<int>>*/((int value) { .map/*<DropdownMenuItem<int>>*/((int value) {
return new DropDownMenuItem<int>( return new DropdownMenuItem<int>(
value: value, value: value,
child: new Text('$value') child: new Text('$value')
); );
...@@ -316,8 +316,8 @@ class PaginatedDataTableState extends State<PaginatedDataTable> { ...@@ -316,8 +316,8 @@ class PaginatedDataTableState extends State<PaginatedDataTable> {
.toList(); .toList();
footerWidgets.addAll(<Widget>[ footerWidgets.addAll(<Widget>[
new Text('Rows per page:'), new Text('Rows per page:'),
new DropDownButtonHideUnderline( new DropdownButtonHideUnderline(
child: new DropDownButton<int>( child: new DropdownButton<int>(
items: availableRowsPerPage, items: availableRowsPerPage,
value: config.rowsPerPage, value: config.rowsPerPage,
onChanged: config.onRowsPerPageChanged, onChanged: config.onRowsPerPageChanged,
......
...@@ -29,7 +29,7 @@ import 'theme.dart'; ...@@ -29,7 +29,7 @@ import 'theme.dart';
/// See also: /// See also:
/// ///
/// * [FlatButton] /// * [FlatButton]
/// * [DropDownButton] /// * [DropdownButton]
/// * [FloatingActionButton] /// * [FloatingActionButton]
/// * <https://www.google.com/design/spec/components/buttons.html> /// * <https://www.google.com/design/spec/components/buttons.html>
class RaisedButton extends StatelessWidget { class RaisedButton extends StatelessWidget {
......
...@@ -8,15 +8,15 @@ import 'package:flutter/material.dart'; ...@@ -8,15 +8,15 @@ import 'package:flutter/material.dart';
void main() { void main() {
testWidgets('Drop down screen edges', (WidgetTester tester) async { testWidgets('Drop down screen edges', (WidgetTester tester) async {
int value = 4; int value = 4;
List<DropDownMenuItem<int>> items = <DropDownMenuItem<int>>[]; List<DropdownMenuItem<int>> items = <DropdownMenuItem<int>>[];
for (int i = 0; i < 20; ++i) for (int i = 0; i < 20; ++i)
items.add(new DropDownMenuItem<int>(value: i, child: new Text('$i'))); items.add(new DropdownMenuItem<int>(value: i, child: new Text('$i')));
void handleChanged(int newValue) { void handleChanged(int newValue) {
value = newValue; value = newValue;
} }
DropDownButton<int> button = new DropDownButton<int>( DropdownButton<int> button = new DropdownButton<int>(
value: value, value: value,
onChanged: handleChanged, onChanged: handleChanged,
items: items items: items
......
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