Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
14743566
Commit
14743566
authored
Feb 14, 2017
by
Adam Barth
Committed by
GitHub
Feb 14, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate Dropdown to ScrollConfiguration2 (#8135)
Also use the word "dropdown" consistently over "drop down".
parent
7231fd3e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
19 additions
and
25 deletions
+19
-25
example_code.dart
examples/flutter_gallery/lib/gallery/example_code.dart
+1
-1
material.dart
packages/flutter/lib/material.dart
+1
-1
data_table.dart
packages/flutter/lib/src/material/data_table.dart
+1
-1
dropdown.dart
packages/flutter/lib/src/material/dropdown.dart
+8
-14
paginated_data_table.dart
packages/flutter/lib/src/material/paginated_data_table.dart
+1
-1
dropdown_test.dart
packages/flutter/test/material/dropdown_test.dart
+7
-7
No files found.
examples/flutter_gallery/lib/gallery/example_code.dart
View file @
14743566
...
...
@@ -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
<
String
>(
value:
dropdownValue
,
onChanged:
(
String
newValue
)
{
...
...
packages/flutter/lib/material.dart
View file @
14743566
...
...
@@ -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'
;
...
...
packages/flutter/lib/src/material/data_table.dart
View file @
14743566
...
...
@@ -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'
;
...
...
packages/flutter/lib/src/material/drop
_
down.dart
→
packages/flutter/lib/src/material/dropdown.dart
View file @
14743566
...
...
@@ -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
_DropdownScroll
ConfigurationDelegate
extends
ScrollConfigurationDelegate
{
const
_DropdownScroll
ConfigurationDelegate
(
this
.
_platform
);
class
_DropdownScroll
Behavior
extends
ScrollBehavior2
{
const
_DropdownScroll
Behavior
(
);
@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
<
T
>
extends
StatefulWidget
{
...
...
@@ -182,8 +176,8 @@ class _DropdownMenuState<T> extends State<_DropdownMenu<T>> {
child:
new
Material
(
type:
MaterialType
.
transparency
,
textStyle:
route
.
style
,
child:
new
ScrollConfiguration
(
delegate:
new
_DropdownScrollConfigurationDelegate
(
Theme
.
of
(
context
).
platform
),
child:
new
ScrollConfiguration
2
(
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.
/// * <https://material.google.com/components/buttons.html#buttons-dropdown-buttons>
...
...
packages/flutter/lib/src/material/paginated_data_table.dart
View file @
14743566
...
...
@@ -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'
;
...
...
packages/flutter/test/material/drop
_
down_test.dart
→
packages/flutter/test/material/dropdown_test.dart
View file @
14743566
...
...
@@ -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
<
DropdownMenuItem
<
int
>>
items
=
<
DropdownMenuItem
<
int
>>[];
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 Drop
D
own button with a null value should be the same size as a
// A Drop
d
own 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 Drop
D
own button with a null value and a hint should be the same size as a
// A Drop
d
own 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
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment