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
a7b96564
Commit
a7b96564
authored
Aug 06, 2015
by
Matt Perry
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change several onStatusChanged callbacks to onDismissed.
We only use them for the transition to dismissed.
parent
2051703c
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
30 additions
and
36 deletions
+30
-36
feed.dart
packages/flutter/example/fitness/lib/feed.dart
+3
-3
stock_home.dart
packages/flutter/example/stocks/lib/stock_home.dart
+7
-7
stock_menu.dart
packages/flutter/example/stocks/lib/stock_menu.dart
+3
-3
drawer.dart
packages/flutter/lib/widgets/drawer.dart
+7
-12
popup_menu.dart
packages/flutter/lib/widgets/popup_menu.dart
+5
-6
snack_bar.dart
packages/flutter/lib/widgets/snack_bar.dart
+5
-5
No files found.
packages/flutter/example/fitness/lib/feed.dart
View file @
a7b96564
...
...
@@ -96,7 +96,7 @@ class FeedFragment extends StatefulComponent {
return
new
Drawer
(
showing:
_drawerShowing
,
level:
3
,
on
StatusChanged:
_handleDrawerStatusChange
,
on
Dismissed:
_handleDrawerDismissed
,
navigator:
navigator
,
children:
[
new
DrawerHeader
(
children:
[
new
Text
(
'Fitness'
)]),
...
...
@@ -132,9 +132,9 @@ class FeedFragment extends StatefulComponent {
});
}
void
_handleDrawer
StatusChange
(
AnimationStatus
status
)
{
void
_handleDrawer
Dismissed
(
)
{
setState
(()
{
_drawerStatus
=
status
;
_drawerStatus
=
AnimationStatus
.
dismissed
;
});
}
...
...
packages/flutter/example/stocks/lib/stock_home.dart
View file @
a7b96564
...
...
@@ -68,9 +68,9 @@ class StockHome extends StatefulComponent {
});
}
void
_handleDrawer
StatusChange
(
AnimationStatus
status
)
{
void
_handleDrawer
Dismissed
(
)
{
setState
(()
{
_drawerStatus
=
status
;
_drawerStatus
=
AnimationStatus
.
dismissed
;
});
}
...
...
@@ -90,9 +90,9 @@ class StockHome extends StatefulComponent {
});
}
void
_handleMenu
StatusChanged
(
AnimationStatus
status
)
{
void
_handleMenu
Dismissed
(
)
{
setState
(()
{
_menuStatus
=
status
;
_menuStatus
=
AnimationStatus
.
dismissed
;
});
}
...
...
@@ -119,7 +119,7 @@ class StockHome extends StatefulComponent {
return
new
Drawer
(
level:
3
,
showing:
_drawerShowing
,
on
StatusChanged:
_handleDrawerStatusChange
,
on
Dismissed:
_handleDrawerDismissed
,
navigator:
navigator
,
children:
[
new
DrawerHeader
(
children:
[
new
Text
(
'Stocks'
)]),
...
...
@@ -254,7 +254,7 @@ class StockHome extends StatefulComponent {
showing:
_isSnackBarShowing
,
content:
new
Text
(
"Stock purchased!"
),
actions:
[
new
SnackBarAction
(
label:
"UNDO"
,
onPressed:
_handleUndo
)],
on
StatusChanged:
(
status
)
{
setState
(()
{
_snackBarStatus
=
status
;
});
}
on
Dismissed:
()
{
setState
(()
{
_snackBarStatus
=
AnimationStatus
.
dismissed
;
});
}
);
}
...
...
@@ -279,7 +279,7 @@ class StockHome extends StatefulComponent {
overlays
.
add
(
new
ModalOverlay
(
children:
[
new
StockMenu
(
showing:
_menuShowing
,
on
StatusChanged:
_handleMenuStatusChang
ed
,
on
Dismissed:
_handleMenuDismiss
ed
,
navigator:
navigator
,
autorefresh:
_autorefresh
,
onAutorefreshChanged:
_handleAutorefreshChanged
...
...
packages/flutter/example/stocks/lib/stock_menu.dart
View file @
a7b96564
...
...
@@ -8,14 +8,14 @@ class StockMenu extends Component {
StockMenu
({
Key
key
,
this
.
showing
,
this
.
on
StatusChang
ed
,
this
.
on
Dismiss
ed
,
this
.
navigator
,
this
.
autorefresh
:
false
,
this
.
onAutorefreshChanged
})
:
super
(
key:
key
);
final
bool
showing
;
final
PopupMenu
StatusChangedCallback
onStatusChang
ed
;
final
PopupMenu
DismissedCallback
onDismiss
ed
;
final
Navigator
navigator
;
final
bool
autorefresh
;
final
ValueChanged
onAutorefreshChanged
;
...
...
@@ -38,7 +38,7 @@ class StockMenu extends Component {
],
level:
4
,
showing:
showing
,
on
StatusChanged:
onStatusChang
ed
,
on
Dismissed:
onDismiss
ed
,
navigator:
navigator
),
right:
sky
.
view
.
paddingRight
,
...
...
packages/flutter/lib/widgets/drawer.dart
View file @
a7b96564
...
...
@@ -40,7 +40,7 @@ const Duration _kThemeChangeDuration = const Duration(milliseconds: 200);
const
Point
_kOpenPosition
=
Point
.
origin
;
const
Point
_kClosedPosition
=
const
Point
(-
_kWidth
,
0.0
);
typedef
void
Drawer
StatusChangedCallback
(
AnimationStatus
status
);
typedef
void
Drawer
DismissedCallback
(
);
class
Drawer
extends
StatefulComponent
{
Drawer
({
...
...
@@ -48,14 +48,14 @@ class Drawer extends StatefulComponent {
this
.
children
,
this
.
showing
:
false
,
this
.
level
:
0
,
this
.
on
StatusChang
ed
,
this
.
on
Dismiss
ed
,
this
.
navigator
})
:
super
(
key:
key
);
List
<
Widget
>
children
;
bool
showing
;
int
level
;
Drawer
StatusChangedCallback
onStatusChang
ed
;
Drawer
DismissedCallback
onDismiss
ed
;
Navigator
navigator
;
AnimationPerformance
_performance
;
...
...
@@ -80,7 +80,7 @@ class Drawer extends StatefulComponent {
level
=
source
.
level
;
navigator
=
source
.
navigator
;
showing
=
source
.
showing
;
on
StatusChanged
=
source
.
onStatusChang
ed
;
on
Dismissed
=
source
.
onDismiss
ed
;
}
Widget
build
()
{
...
...
@@ -120,18 +120,13 @@ class Drawer extends StatefulComponent {
}
void
_onDismissed
()
{
_onStatusChanged
(
AnimationStatus
.
dismissed
);
}
void
_onStatusChanged
(
AnimationStatus
status
)
{
scheduleMicrotask
(()
{
if
(
status
==
AnimationStatus
.
dismissed
&&
navigator
!=
null
&&
if
(
navigator
!=
null
&&
navigator
.
currentRoute
is
RouteState
&&
(
navigator
.
currentRoute
as
RouteState
).
owner
==
this
)
// TODO(ianh): remove cast once analyzer is cleverer
navigator
.
pop
();
if
(
on
StatusChang
ed
!=
null
)
on
StatusChanged
(
status
);
if
(
on
Dismiss
ed
!=
null
)
on
Dismissed
(
);
});
}
...
...
packages/flutter/lib/widgets/popup_menu.dart
View file @
a7b96564
...
...
@@ -27,21 +27,21 @@ const double _kMenuMaxWidth = 5.0 * _kMenuWidthStep;
const
double
_kMenuHorizontalPadding
=
16.0
;
const
double
_kMenuVerticalPadding
=
8.0
;
typedef
void
PopupMenu
StatusChangedCallback
(
AnimationStatus
status
);
typedef
void
PopupMenu
DismissedCallback
(
);
class
PopupMenu
extends
StatefulComponent
{
PopupMenu
({
Key
key
,
this
.
showing
,
this
.
on
StatusChang
ed
,
this
.
on
Dismiss
ed
,
this
.
items
,
this
.
level
,
this
.
navigator
})
:
super
(
key:
key
);
bool
showing
;
PopupMenu
StatusChangedCallback
onStatusChang
ed
;
PopupMenu
DismissedCallback
onDismiss
ed
;
List
<
PopupMenuItem
>
items
;
int
level
;
Navigator
navigator
;
...
...
@@ -63,7 +63,6 @@ class PopupMenu extends StatefulComponent {
if
(!
showing
&&
source
.
showing
)
_open
();
showing
=
source
.
showing
;
onStatusChanged
=
source
.
onStatusChanged
;
if
(
level
!=
source
.
level
)
{
level
=
source
.
level
;
_updateBoxPainter
();
...
...
@@ -96,8 +95,8 @@ class PopupMenu extends StatefulComponent {
navigator
.
currentRoute
is
RouteState
&&
(
navigator
.
currentRoute
as
RouteState
).
owner
==
this
)
// TODO(ianh): remove cast once analyzer is cleverer
navigator
.
pop
();
if
(
on
StatusChang
ed
!=
null
)
on
StatusChanged
(
AnimationStatus
.
dismissed
);
if
(
on
Dismiss
ed
!=
null
)
on
Dismissed
(
);
}
BoxPainter
_painter
;
...
...
packages/flutter/lib/widgets/snack_bar.dart
View file @
a7b96564
...
...
@@ -16,7 +16,7 @@ import 'package:sky/widgets/transitions.dart';
export
'package:sky/animation/animation_performance.dart'
show
AnimationStatus
;
typedef
void
SnackBar
StatusChangedCallback
(
AnimationStatus
status
);
typedef
void
SnackBar
DismissedCallback
(
);
const
Duration
_kSlideInDuration
=
const
Duration
(
milliseconds:
200
);
...
...
@@ -46,7 +46,7 @@ class SnackBar extends Component {
this
.
content
,
this
.
actions
,
this
.
showing
,
this
.
on
StatusChang
ed
this
.
on
Dismiss
ed
})
:
super
(
key:
key
)
{
assert
(
content
!=
null
);
}
...
...
@@ -54,11 +54,11 @@ class SnackBar extends Component {
Widget
content
;
List
<
SnackBarAction
>
actions
;
bool
showing
;
SnackBar
StatusChangedCallback
onStatusChang
ed
;
SnackBar
DismissedCallback
onDismiss
ed
;
void
_onDismissed
()
{
if
(
on
StatusChang
ed
!=
null
)
scheduleMicrotask
(()
{
on
StatusChanged
(
AnimationStatus
.
dismissed
);
});
if
(
on
Dismiss
ed
!=
null
)
scheduleMicrotask
(()
{
on
Dismissed
(
);
});
}
Widget
build
()
{
...
...
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