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
1d39db69
Commit
1d39db69
authored
Dec 16, 2015
by
Ian Hickson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #950 from Hixie/dropdown-asserts
Aggressively try to catch misuse of DropDownButton
parents
b378d967
a87351ad
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
4 deletions
+13
-4
dropdown.dart
packages/flutter/lib/src/material/dropdown.dart
+4
-1
stack.dart
packages/flutter/lib/src/rendering/stack.dart
+6
-2
basic.dart
packages/flutter/lib/src/widgets/basic.dart
+3
-1
No files found.
packages/flutter/lib/src/material/dropdown.dart
View file @
1d39db69
...
...
@@ -227,7 +227,9 @@ class DropDownButton<T> extends StatefulComponent {
this
.
value
,
this
.
onChanged
,
this
.
elevation
:
8
})
:
super
(
key:
key
);
})
:
super
(
key:
key
)
{
assert
(
items
.
where
((
DropDownMenuItem
<
T
>
item
)
=>
item
.
value
==
value
).
length
==
1
);
}
final
List
<
DropDownMenuItem
<
T
>>
items
;
final
T
value
;
...
...
@@ -243,6 +245,7 @@ class _DropDownButtonState<T> extends State<DropDownButton<T>> {
void
initState
()
{
super
.
initState
();
_updateSelectedIndex
();
assert
(
_selectedIndex
!=
null
);
}
void
didUpdateConfig
(
DropDownButton
<
T
>
oldConfig
)
{
...
...
packages/flutter/lib/src/rendering/stack.dart
View file @
1d39db69
...
...
@@ -433,7 +433,8 @@ class RenderStack extends RenderStackBase {
/// Implements the same layout algorithm as RenderStack but only paints the child
/// specified by index.
/// Note: although only one child is displayed, the cost of the layout algorithm is
///
/// Although only one child is displayed, the cost of the layout algorithm is
/// still O(N), like an ordinary stack.
class
RenderIndexedStack
extends
RenderStackBase
{
RenderIndexedStack
({
...
...
@@ -443,11 +444,14 @@ class RenderIndexedStack extends RenderStackBase {
})
:
_index
=
index
,
super
(
children:
children
,
alignment:
alignment
);
)
{
assert
(
index
!=
null
);
}
int
get
index
=>
_index
;
int
_index
;
void
set
index
(
int
value
)
{
assert
(
value
!=
null
);
if
(
_index
!=
value
)
{
_index
=
value
;
markNeedsLayout
();
...
...
packages/flutter/lib/src/widgets/basic.dart
View file @
1d39db69
...
...
@@ -962,7 +962,9 @@ class IndexedStack extends MultiChildRenderObjectWidget {
Key
key
,
this
.
alignment
:
const
FractionalOffset
(
0.0
,
0.0
),
this
.
index
:
0
})
:
super
(
key:
key
,
children:
children
);
})
:
super
(
key:
key
,
children:
children
)
{
assert
(
index
!=
null
);
}
/// The index of the child to show.
final
int
index
;
...
...
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