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
8b6bd844
Commit
8b6bd844
authored
Sep 30, 2015
by
Ian Hickson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1376 from Hixie/toggleable
Make the checkbox in the stocks popup menu work.
parents
a3ecdc30
066768f0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
20 deletions
+30
-20
stock_menu.dart
examples/stocks/lib/stock_menu.dart
+22
-11
checkbox.dart
packages/flutter/lib/src/fn3/checkbox.dart
+0
-1
switch.dart
packages/flutter/lib/src/fn3/switch.dart
+0
-1
toggleable.dart
packages/flutter/lib/src/rendering/toggleable.dart
+8
-7
No files found.
examples/stocks/lib/stock_menu.dart
View file @
8b6bd844
...
...
@@ -4,7 +4,7 @@
part of
stocks
;
enum
_MenuItems
{
a
dd
,
remove
,
autorefresh
}
enum
_MenuItems
{
a
utorefresh
,
autorefreshCheckbox
,
add
,
remove
}
Future
showStockMenu
(
NavigatorState
navigator
,
{
bool
autorefresh
,
ValueChanged
onAutorefreshChanged
})
async
{
switch
(
await
showMenu
(
...
...
@@ -15,30 +15,41 @@ Future showStockMenu(NavigatorState navigator, { bool autorefresh, ValueChanged
),
builder:
(
NavigatorState
navigator
)
{
return
<
PopupMenuItem
>[
new
PopupMenuItem
(
value:
_MenuItems
.
add
,
child:
new
Text
(
'Add stock'
)
),
new
PopupMenuItem
(
value:
_MenuItems
.
remove
,
child:
new
Text
(
'Remove stock'
)
),
new
PopupMenuItem
(
value:
_MenuItems
.
autorefresh
,
child:
new
Row
([
new
Flexible
(
child:
new
Text
(
'Autorefresh'
)),
new
Checkbox
(
value:
autorefresh
,
onChanged:
onAutorefreshChanged
onChanged:
(
bool
value
)
{
navigator
.
setState
(()
{
autorefresh
=
value
;
});
navigator
.
pop
(
_MenuItems
.
autorefreshCheckbox
);
}
)
]
)
),
new
PopupMenuItem
(
value:
_MenuItems
.
add
,
child:
new
Text
(
'Add stock'
)
),
new
PopupMenuItem
(
value:
_MenuItems
.
remove
,
child:
new
Text
(
'Remove stock'
)
),
];
}
))
{
case
_MenuItems
.
autorefresh
:
onAutorefreshChanged
(!
autorefresh
);
navigator
.
setState
(()
{
autorefresh
=
!
autorefresh
;
});
continue
autorefreshNotify
;
autorefreshNotify:
case
_MenuItems
.
autorefreshCheckbox
:
onAutorefreshChanged
(
autorefresh
);
break
;
case
_MenuItems
.
add
:
case
_MenuItems
.
remove
:
...
...
packages/flutter/lib/src/fn3/checkbox.dart
View file @
8b6bd844
...
...
@@ -17,7 +17,6 @@ const sky.Color _kLightUncheckedColor = const sky.Color(0x8A000000);
const
sky
.
Color
_kDarkUncheckedColor
=
const
sky
.
Color
(
0xB2FFFFFF
);
const
double
_kEdgeSize
=
20.0
;
const
double
_kEdgeRadius
=
1.0
;
const
Duration
_kCheckDuration
=
const
Duration
(
milliseconds:
200
);
/// A material design checkbox
///
...
...
packages/flutter/lib/src/fn3/switch.dart
View file @
8b6bd844
...
...
@@ -23,7 +23,6 @@ const double _kTrackHeight = 14.0;
const
double
_kTrackRadius
=
_kTrackHeight
/
2.0
;
const
double
_kTrackWidth
=
_kSwitchWidth
-
(
_kThumbRadius
-
_kTrackRadius
)
*
2.0
;
const
Duration
_kCheckDuration
=
const
Duration
(
milliseconds:
200
);
const
Size
_kSwitchSize
=
const
Size
(
_kSwitchWidth
+
2.0
,
_kSwitchHeight
+
2.0
);
const
double
_kReactionRadius
=
_kSwitchWidth
/
2.0
;
...
...
packages/flutter/lib/src/rendering/toggleable.dart
View file @
8b6bd844
...
...
@@ -53,29 +53,30 @@ abstract class RenderToggleable extends RenderConstrainedBox {
}
void
_handleTap
()
{
_onChanged
(!
_value
);
if
(
_onChanged
!=
null
)
_onChanged
(!
_value
);
}
bool
_value
;
bool
get
value
=>
_value
;
bool
_value
;
void
set
value
(
bool
value
)
{
if
(
value
==
_value
)
return
;
if
(
value
==
_value
)
return
;
_value
=
value
;
performance
.
play
(
value
?
Direction
.
forward
:
Direction
.
reverse
);
}
ValueChanged
_onChanged
;
ValueChanged
get
onChanged
=>
_onChanged
;
ValueChanged
_onChanged
;
void
set
onChanged
(
ValueChanged
onChanged
)
{
_onChanged
=
onChanged
;
}
AnimatedValue
<
double
>
get
position
=>
_position
;
final
AnimatedValue
<
double
>
_position
=
new
AnimatedValue
<
double
>(
0.0
,
end:
1.0
,
curve:
easeIn
,
reverseCurve:
easeOut
);
AnimatedValue
<
double
>
get
position
=>
_position
;
AnimationPerformance
_performance
;
AnimationPerformance
get
performance
=>
_performance
;
AnimationPerformance
_performance
;
}
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