diff --git a/examples/flutter_gallery/lib/gallery/example_code.dart b/examples/flutter_gallery/lib/gallery/example_code.dart index 6dcb8378d9..35c14c2ab6 100644 --- a/examples/flutter_gallery/lib/gallery/example_code.dart +++ b/examples/flutter_gallery/lib/gallery/example_code.dart @@ -55,7 +55,7 @@ new FlatButton( // Member variable holding value. String dropdownValue; -// Drop down button with string values. +// Dropdown button with string values. new DropdownButton( value: dropdownValue, onChanged: (String newValue) { diff --git a/packages/flutter/lib/material.dart b/packages/flutter/lib/material.dart index a4a82c12e4..2308585dd8 100644 --- a/packages/flutter/lib/material.dart +++ b/packages/flutter/lib/material.dart @@ -34,7 +34,7 @@ export 'src/material/divider.dart'; export 'src/material/drawer.dart'; export 'src/material/drawer_header.dart'; export 'src/material/drawer_item.dart'; -export 'src/material/drop_down.dart'; +export 'src/material/dropdown.dart'; export 'src/material/expand_icon.dart'; export 'src/material/expansion_panel.dart'; export 'src/material/flat_button.dart'; diff --git a/packages/flutter/lib/src/material/data_table.dart b/packages/flutter/lib/src/material/data_table.dart index 8bc5b2eecc..a5196c99ae 100644 --- a/packages/flutter/lib/src/material/data_table.dart +++ b/packages/flutter/lib/src/material/data_table.dart @@ -11,7 +11,7 @@ import 'package:flutter/widgets.dart'; import 'checkbox.dart'; import 'colors.dart'; import 'debug.dart'; -import 'drop_down.dart'; +import 'dropdown.dart'; import 'icon.dart'; import 'icon_theme.dart'; import 'icon_theme_data.dart'; diff --git a/packages/flutter/lib/src/material/drop_down.dart b/packages/flutter/lib/src/material/dropdown.dart similarity index 96% rename from packages/flutter/lib/src/material/drop_down.dart rename to packages/flutter/lib/src/material/dropdown.dart index e3fefa2390..db98c8a2fd 100644 --- a/packages/flutter/lib/src/material/drop_down.dart +++ b/packages/flutter/lib/src/material/dropdown.dart @@ -79,23 +79,17 @@ class _DropdownMenuPainter extends CustomPainter { // Do not use the platform-specific default scroll configuration. // Dropdown menus should never overscroll or display an overscroll indicator. -class _DropdownScrollConfigurationDelegate extends ScrollConfigurationDelegate { - const _DropdownScrollConfigurationDelegate(this._platform); +class _DropdownScrollBehavior extends ScrollBehavior2 { + const _DropdownScrollBehavior(); @override - TargetPlatform get platform => _platform; - final TargetPlatform _platform; + TargetPlatform getPlatform(BuildContext context) => Theme.of(context).platform; @override - ExtentScrollBehavior createScrollBehavior() => new OverscrollWhenScrollableBehavior(platform: platform); + Widget buildViewportChrome(BuildContext context, Widget child, AxisDirection axisDirection) => child; @override - Widget wrapScrollWidget(BuildContext context, Widget scrollWidget) { - return new ClampOverscrolls(edge: ScrollableEdge.both, child: scrollWidget); - } - - @override - bool updateShouldNotify(ScrollConfigurationDelegate old) => platform != old.platform; + ScrollPhysics getScrollPhysics(BuildContext context) => const ClampingScrollPhysics(); } class _DropdownMenu extends StatefulWidget { @@ -182,8 +176,8 @@ class _DropdownMenuState extends State<_DropdownMenu> { child: new Material( type: MaterialType.transparency, textStyle: route.style, - child: new ScrollConfiguration( - delegate: new _DropdownScrollConfigurationDelegate(Theme.of(context).platform), + child: new ScrollConfiguration2( + behavior: const _DropdownScrollBehavior(), child: new Scrollbar( child: new ListView( controller: config.route.scrollController, @@ -406,7 +400,7 @@ class DropdownButtonHideUnderline extends InheritedWidget { /// /// See also: /// -/// * [DropdownButtonHideUnderline], which prevents its descendant drop down buttons +/// * [DropdownButtonHideUnderline], which prevents its descendant dropdown buttons /// from displaying their underlines. /// * [RaisedButton], [FlatButton], ordinary buttons that trigger a single action. /// * diff --git a/packages/flutter/lib/src/material/paginated_data_table.dart b/packages/flutter/lib/src/material/paginated_data_table.dart index 02e83e99d6..ff592abff8 100644 --- a/packages/flutter/lib/src/material/paginated_data_table.dart +++ b/packages/flutter/lib/src/material/paginated_data_table.dart @@ -13,7 +13,7 @@ import 'button_bar.dart'; import 'card.dart'; import 'data_table.dart'; import 'data_table_source.dart'; -import 'drop_down.dart'; +import 'dropdown.dart'; import 'icon.dart'; import 'icon_button.dart'; import 'icon_theme.dart'; diff --git a/packages/flutter/test/material/drop_down_test.dart b/packages/flutter/test/material/dropdown_test.dart similarity index 95% rename from packages/flutter/test/material/drop_down_test.dart rename to packages/flutter/test/material/dropdown_test.dart index 7dfb8b182b..892876f1d0 100644 --- a/packages/flutter/test/material/drop_down_test.dart +++ b/packages/flutter/test/material/dropdown_test.dart @@ -59,7 +59,7 @@ bool sameGeometry(RenderBox box1, RenderBox box2) { void main() { - testWidgets('Drop down button control test', (WidgetTester tester) async { + testWidgets('Dropdown button control test', (WidgetTester tester) async { String value = 'one'; void didChangeValue(String newValue) { value = newValue; @@ -98,7 +98,7 @@ void main() { expect(value, equals('two')); }); - testWidgets('Drop down button with no app', (WidgetTester tester) async { + testWidgets('Dropdown button with no app', (WidgetTester tester) async { String value = 'one'; void didChangeValue(String newValue) { value = newValue; @@ -151,7 +151,7 @@ void main() { expect(value, equals('two')); }); - testWidgets('Drop down screen edges', (WidgetTester tester) async { + testWidgets('Dropdown screen edges', (WidgetTester tester) async { int value = 4; List> items = >[]; for (int i = 0; i < 20; ++i) @@ -203,7 +203,7 @@ void main() { await tester.pump(const Duration(seconds: 1)); // finish the menu animation }); - testWidgets('Drop down button aligns selected menu item', (WidgetTester tester) async { + testWidgets('Dropdown button aligns selected menu item', (WidgetTester tester) async { Key buttonKey = new UniqueKey(); String value = 'two'; @@ -237,7 +237,7 @@ void main() { checkSelectedItemTextGeometry(tester, 'two'); }); - testWidgets('Drop down button with isDense:true aligns selected menu item', (WidgetTester tester) async { + testWidgets('Dropdown button with isDense:true aligns selected menu item', (WidgetTester tester) async { Key buttonKey = new UniqueKey(); String value = 'two'; @@ -290,7 +290,7 @@ void main() { RenderBox buttonBox = tester.renderObject(find.byKey(buttonKey)); assert(buttonBox.attached); - // A DropDown button with a null value should be the same size as a + // A Dropdown button with a null value should be the same size as a // one with a non-null value. expect(buttonBox.localToGlobal(Point.origin), equals(buttonBoxNullValue.localToGlobal(Point.origin))); expect(buttonBox.size, equals(buttonBoxNullValue.size)); @@ -342,7 +342,7 @@ void main() { RenderBox buttonBox = tester.renderObject(find.byKey(buttonKey)); assert(buttonBox.attached); - // A DropDown button with a null value and a hint should be the same size as a + // A Dropdown button with a null value and a hint should be the same size as a // one with a non-null value. expect(buttonBox.localToGlobal(Point.origin), equals(buttonBoxHintValue.localToGlobal(Point.origin))); expect(buttonBox.size, equals(buttonBoxHintValue.size));