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
87fb075f
Commit
87fb075f
authored
Sep 16, 2016
by
Dragoș Tiselice
Committed by
GitHub
Sep 16, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renamed DropDown to Dropdown. (#5897)
Fixes #3208.
parent
8ac14f86
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
77 additions
and
77 deletions
+77
-77
buttons_demo.dart
examples/flutter_gallery/lib/demo/buttons_demo.dart
+4
-4
shrine_order.dart
examples/flutter_gallery/lib/demo/shrine/shrine_order.dart
+3
-3
example_code.dart
examples/flutter_gallery/lib/gallery/example_code.dart
+2
-2
data_table.dart
packages/flutter/lib/src/material/data_table.dart
+3
-3
drop_down.dart
packages/flutter/lib/src/material/drop_down.dart
+56
-56
flat_button.dart
packages/flutter/lib/src/material/flat_button.dart
+1
-1
paginated_data_table.dart
packages/flutter/lib/src/material/paginated_data_table.dart
+4
-4
raised_button.dart
packages/flutter/lib/src/material/raised_button.dart
+1
-1
drop_down_test.dart
packages/flutter/test/material/drop_down_test.dart
+3
-3
No files found.
examples/flutter_gallery/lib/demo/buttons_demo.dart
View file @
87fb075f
...
@@ -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
Drop
D
ownButton
<
String
>(
trailing:
new
Drop
d
ownButton
<
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
Drop
D
ownMenuItem
<
String
>(
return
new
Drop
d
ownMenuItem
<
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
Drop
D
ownButton
<
String
>(
trailing:
new
Drop
d
ownButton
<
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
Drop
D
ownMenuItem
<
String
>(
return
new
Drop
d
ownMenuItem
<
String
>(
value:
value
,
value:
value
,
child:
new
Text
(
value
));
child:
new
Text
(
value
));
})
})
...
...
examples/flutter_gallery/lib/demo/shrine/shrine_order.dart
View file @
87fb075f
...
@@ -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
Drop
D
ownButtonHideUnderline
(
child:
new
Drop
d
ownButtonHideUnderline
(
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
Drop
D
ownButton
<
int
>(
child:
new
Drop
d
ownButton
<
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
Drop
D
ownMenuItem
<
int
>(
return
new
Drop
d
ownMenuItem
<
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
),
...
...
examples/flutter_gallery/lib/gallery/example_code.dart
View file @
87fb075f
...
@@ -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
Drop
D
ownButton
<
String
>(
new
Drop
d
ownButton
<
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
Drop
D
ownMenuItem
<
String
>(
return
new
Drop
d
ownMenuItem
<
String
>(
value:
value
,
value:
value
,
child:
new
Text
(
value
));
child:
new
Text
(
value
));
})
})
...
...
packages/flutter/lib/src/material/data_table.dart
View file @
87fb075f
...
@@ -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 [Drop
D
ownButton] widget; this becomes the [widget]
/// a [Text] or [Drop
d
ownButton] 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 [Drop
D
ownButton] widget.
/// Typically a [Text] widget or a [Drop
d
ownButton] 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
Drop
D
ownButtonHideUnderline
(
child:
label
)
child:
new
Drop
d
ownButtonHideUnderline
(
child:
label
)
)
)
)
)
);
);
...
...
packages/flutter/lib/src/material/drop_down.dart
View file @
87fb075f
...
@@ -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
_kDrop
D
ownMenuDuration
=
const
Duration
(
milliseconds:
300
);
const
Duration
_kDrop
d
ownMenuDuration
=
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
_Drop
D
ownMenuPainter
extends
CustomPainter
{
class
_Drop
d
ownMenuPainter
extends
CustomPainter
{
_Drop
D
ownMenuPainter
({
_Drop
d
ownMenuPainter
({
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
(
_Drop
D
ownMenuPainter
oldPainter
)
{
bool
shouldRepaint
(
_Drop
d
ownMenuPainter
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
_Drop
D
ownScrollConfigurationDelegate
extends
ScrollConfigurationDelegate
{
class
_Drop
d
ownScrollConfigurationDelegate
extends
ScrollConfigurationDelegate
{
const
_Drop
D
ownScrollConfigurationDelegate
(
this
.
_platform
);
const
_Drop
d
ownScrollConfigurationDelegate
(
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
_Drop
D
ownMenu
<
T
>
extends
StatefulWidget
{
class
_Drop
d
ownMenu
<
T
>
extends
StatefulWidget
{
_Drop
D
ownMenu
({
_Drop
d
ownMenu
({
Key
key
,
Key
key
,
_Drop
D
ownRoute
<
T
>
route
_Drop
d
ownRoute
<
T
>
route
})
:
route
=
route
,
super
(
key:
key
);
})
:
route
=
route
,
super
(
key:
key
);
final
_Drop
D
ownRoute
<
T
>
route
;
final
_Drop
d
ownRoute
<
T
>
route
;
@override
@override
_Drop
DownMenuState
<
T
>
createState
()
=>
new
_DropD
ownMenuState
<
T
>();
_Drop
downMenuState
<
T
>
createState
()
=>
new
_Dropd
ownMenuState
<
T
>();
}
}
class
_Drop
DownMenuState
<
T
>
extends
State
<
_DropD
ownMenu
<
T
>>
{
class
_Drop
downMenuState
<
T
>
extends
State
<
_Dropd
ownMenu
<
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
_Drop
D
ownRoute
<
T
>
route
=
config
.
route
;
final
_Drop
d
ownRoute
<
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
_Drop
D
ownRouteResult
<
T
>(
route
.
items
[
itemIndex
].
value
)
new
_Drop
d
ownRouteResult
<
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
_Drop
D
ownMenuPainter
(
painter:
new
_Drop
d
ownMenuPainter
(
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
_Drop
D
ownScrollConfigurationDelegate
(
Theme
.
of
(
context
).
platform
),
delegate:
new
_Drop
d
ownScrollConfigurationDelegate
(
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
_Drop
D
ownMenuRouteLayout
<
T
>
extends
SingleChildLayoutDelegate
{
class
_Drop
d
ownMenuRouteLayout
<
T
>
extends
SingleChildLayoutDelegate
{
_Drop
D
ownMenuRouteLayout
({
this
.
route
});
_Drop
d
ownMenuRouteLayout
({
this
.
route
});
final
_Drop
D
ownRoute
<
T
>
route
;
final
_Drop
d
ownRoute
<
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
(
_Drop
D
ownMenuRouteLayout
<
T
>
oldDelegate
)
=>
oldDelegate
.
route
!=
route
;
bool
shouldRelayout
(
_Drop
d
ownMenuRouteLayout
<
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
_Drop
D
ownRouteResult
<
T
>
{
class
_Drop
d
ownRouteResult
<
T
>
{
const
_Drop
D
ownRouteResult
(
this
.
result
);
const
_Drop
d
ownRouteResult
(
this
.
result
);
final
T
result
;
final
T
result
;
@override
@override
bool
operator
==(
dynamic
other
)
{
bool
operator
==(
dynamic
other
)
{
if
(
other
is
!
_Drop
D
ownRouteResult
<
T
>)
if
(
other
is
!
_Drop
d
ownRouteResult
<
T
>)
return
false
;
return
false
;
final
_Drop
D
ownRouteResult
<
T
>
typedOther
=
other
;
final
_Drop
d
ownRouteResult
<
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
_Drop
DownRoute
<
T
>
extends
PopupRoute
<
_DropD
ownRouteResult
<
T
>>
{
class
_Drop
downRoute
<
T
>
extends
PopupRoute
<
_Dropd
ownRouteResult
<
T
>>
{
_Drop
D
ownRoute
({
_Drop
d
ownRoute
({
Completer
<
_Drop
D
ownRouteResult
<
T
>>
completer
,
Completer
<
_Drop
d
ownRouteResult
<
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:
'_Drop
D
ownMenu'
);
final
GlobalKey
<
ScrollableState
>
scrollableKey
=
new
GlobalKey
<
ScrollableState
>(
debugLabel:
'_Drop
d
ownMenu'
);
final
List
<
Drop
D
ownMenuItem
<
T
>>
items
;
final
List
<
Drop
d
ownMenuItem
<
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
=>
_kDrop
D
ownMenuDuration
;
Duration
get
transitionDuration
=>
_kDrop
d
ownMenuDuration
;
@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
_Drop
D
ownMenuRouteLayout
<
T
>(
route:
this
),
delegate:
new
_Drop
d
ownMenuRouteLayout
<
T
>(
route:
this
),
child:
new
_Drop
D
ownMenu
<
T
>(
route:
this
)
child:
new
_Drop
d
ownMenu
<
T
>(
route:
this
)
);
);
}
}
}
}
/// An item in a menu created by a [Drop
D
ownButton].
/// An item in a menu created by a [Drop
d
ownButton].
///
///
/// 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
Drop
D
ownMenuItem
<
T
>
extends
StatelessWidget
{
class
Drop
d
ownMenuItem
<
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.
Drop
D
ownMenuItem
({
Drop
d
ownMenuItem
({
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 [Drop
D
ownButton.onChanged].
/// Eventually returned in a call to [Drop
d
ownButton.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 [Drop
D
ownButton]
/// An inherited widget that causes any descendant [Drop
d
ownButton]
/// 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
/// [Drop
D
ownButton] widgets placed within material data tables, as
/// [Drop
d
ownButton] widgets placed within material data tables, as
/// required by the material design specification.
/// required by the material design specification.
class
Drop
D
ownButtonHideUnderline
extends
InheritedWidget
{
class
Drop
d
ownButtonHideUnderline
extends
InheritedWidget
{
/// Creates a [Drop
D
ownButtonHideUnderline]. A non-null [child] must
/// Creates a [Drop
d
ownButtonHideUnderline]. A non-null [child] must
/// be given.
/// be given.
Drop
D
ownButtonHideUnderline
({
Drop
d
ownButtonHideUnderline
({
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 [Drop
D
ownButton] widgets should
/// Returns whether the underline of [Drop
d
ownButton] widgets should
/// be hidden.
/// be hidden.
static
bool
at
(
BuildContext
context
)
{
static
bool
at
(
BuildContext
context
)
{
return
context
.
inheritFromWidgetOfExactType
(
Drop
D
ownButtonHideUnderline
)
!=
null
;
return
context
.
inheritFromWidgetOfExactType
(
Drop
d
ownButtonHideUnderline
)
!=
null
;
}
}
@override
@override
bool
updateShouldNotify
(
Drop
D
ownButtonHideUnderline
old
)
=>
false
;
bool
updateShouldNotify
(
Drop
d
ownButtonHideUnderline
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
Drop
D
ownButton
<
T
>
extends
StatefulWidget
{
class
Drop
d
ownButton
<
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).
Drop
D
ownButton
({
Drop
d
ownButton
({
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
((
Drop
D
ownMenuItem
<
T
>
item
)
=>
item
.
value
==
value
).
length
==
1
);
assert
(
items
.
where
((
Drop
d
ownMenuItem
<
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
<
Drop
D
ownMenuItem
<
T
>>
items
;
final
List
<
Drop
d
ownMenuItem
<
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
_Drop
DownButtonState
<
T
>
createState
()
=>
new
_DropD
ownButtonState
<
T
>();
_Drop
downButtonState
<
T
>
createState
()
=>
new
_Dropd
ownButtonState
<
T
>();
}
}
class
_Drop
DownButtonState
<
T
>
extends
State
<
DropD
ownButton
<
T
>>
{
class
_Drop
downButtonState
<
T
>
extends
State
<
Dropd
ownButton
<
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
(
Drop
D
ownButton
<
T
>
oldConfig
)
{
void
didUpdateConfig
(
Drop
d
ownButton
<
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
;
_Drop
D
ownRoute
<
T
>
_currentRoute
;
_Drop
d
ownRoute
<
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
<
_Drop
DownRouteResult
<
T
>>
completer
=
new
Completer
<
_DropD
ownRouteResult
<
T
>>();
final
Completer
<
_Drop
downRouteResult
<
T
>>
completer
=
new
Completer
<
_Dropd
ownRouteResult
<
T
>>();
_currentRoute
=
new
_Drop
D
ownRoute
<
T
>(
_currentRoute
=
new
_Drop
d
ownRoute
<
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
((
_Drop
D
ownRouteResult
<
T
>
newValue
)
{
completer
.
future
.
then
((
_Drop
d
ownRouteResult
<
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
(!
Drop
D
ownButtonHideUnderline
.
at
(
context
))
{
if
(!
Drop
d
ownButtonHideUnderline
.
at
(
context
))
{
result
=
new
Stack
(
result
=
new
Stack
(
children:
<
Widget
>[
children:
<
Widget
>[
result
,
result
,
...
...
packages/flutter/lib/src/material/flat_button.dart
View file @
87fb075f
...
@@ -32,7 +32,7 @@ import 'theme.dart';
...
@@ -32,7 +32,7 @@ import 'theme.dart';
/// See also:
/// See also:
///
///
/// * [RaisedButton]
/// * [RaisedButton]
/// * [Drop
D
ownButton]
/// * [Drop
d
ownButton]
/// * <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.
...
...
packages/flutter/lib/src/material/paginated_data_table.dart
View file @
87fb075f
...
@@ -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
/*<Drop
D
ownMenuItem<int>>*/
((
int
value
)
{
.
map
/*<Drop
d
ownMenuItem<int>>*/
((
int
value
)
{
return
new
Drop
D
ownMenuItem
<
int
>(
return
new
Drop
d
ownMenuItem
<
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
Drop
D
ownButtonHideUnderline
(
new
Drop
d
ownButtonHideUnderline
(
child:
new
Drop
D
ownButton
<
int
>(
child:
new
Drop
d
ownButton
<
int
>(
items:
availableRowsPerPage
,
items:
availableRowsPerPage
,
value:
config
.
rowsPerPage
,
value:
config
.
rowsPerPage
,
onChanged:
config
.
onRowsPerPageChanged
,
onChanged:
config
.
onRowsPerPageChanged
,
...
...
packages/flutter/lib/src/material/raised_button.dart
View file @
87fb075f
...
@@ -29,7 +29,7 @@ import 'theme.dart';
...
@@ -29,7 +29,7 @@ import 'theme.dart';
/// See also:
/// See also:
///
///
/// * [FlatButton]
/// * [FlatButton]
/// * [Drop
D
ownButton]
/// * [Drop
d
ownButton]
/// * [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
{
...
...
packages/flutter/test/material/drop_down_test.dart
View file @
87fb075f
...
@@ -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
<
Drop
DownMenuItem
<
int
>>
items
=
<
DropD
ownMenuItem
<
int
>>[];
List
<
Drop
downMenuItem
<
int
>>
items
=
<
Dropd
ownMenuItem
<
int
>>[];
for
(
int
i
=
0
;
i
<
20
;
++
i
)
for
(
int
i
=
0
;
i
<
20
;
++
i
)
items
.
add
(
new
Drop
D
ownMenuItem
<
int
>(
value:
i
,
child:
new
Text
(
'
$i
'
)));
items
.
add
(
new
Drop
d
ownMenuItem
<
int
>(
value:
i
,
child:
new
Text
(
'
$i
'
)));
void
handleChanged
(
int
newValue
)
{
void
handleChanged
(
int
newValue
)
{
value
=
newValue
;
value
=
newValue
;
}
}
Drop
DownButton
<
int
>
button
=
new
DropD
ownButton
<
int
>(
Drop
downButton
<
int
>
button
=
new
Dropd
ownButton
<
int
>(
value:
value
,
value:
value
,
onChanged:
handleChanged
,
onChanged:
handleChanged
,
items:
items
items:
items
...
...
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