Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
fluttertpc_get
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Jonatas
2020-10-01 16:30:50 -0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
03b5aecbdd547942526f46b63ec461e78c8a88cd
03b5aecb
1 parent
1f240063
added showSnackbar as route
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
24 deletions
packages/get_navigation/lib/src/extension_navigation.dart
packages/get_navigation/lib/src/snackbar/snack.dart
packages/get_navigation/lib/src/snackbar/snack_route.dart
packages/get_navigation/lib/src/extension_navigation.dart
View file @
03b5aec
...
...
@@ -753,6 +753,10 @@ extension GetNavigation on GetInterface {
}
}
Future
<
T
>
showSnackbar
<
T
>(
GetBar
snackbar
)
{
return
key
.
currentState
.
push
(
SnackRoute
<
T
>(
snack:
snackbar
));
}
void
snackbar
(
String
title
,
String
message
,
{
...
...
packages/get_navigation/lib/src/snackbar/snack.dart
View file @
03b5aec
...
...
@@ -195,15 +195,10 @@ class GetBar<T extends Object> extends StatefulWidget {
/// Every other widget is ignored if this is not null.
final
Form
userInputForm
;
SnackRoute
<
T
>
_snackRoute
;
/// Show the snack. Kicks in [SnackbarStatus.OPENING] state
/// followed by [SnackbarStatus.OPEN]
Future
<
T
>
show
()
async
{
_snackRoute
=
showSnack
<
T
>(
snack:
this
,
)
as
SnackRoute
<
T
>;
return
await
Get
.
key
.
currentState
.
push
(
_snackRoute
);
Future
<
T
>
show
<
T
>()
async
{
return
Get
.
key
.
currentState
.
push
(
SnackRoute
<
T
>(
snack:
this
));
}
@override
...
...
packages/get_navigation/lib/src/snackbar/snack_route.dart
View file @
03b5aec
...
...
@@ -43,7 +43,6 @@ class SnackRoute<T> extends OverlayRoute<T> {
GetBar
snack
;
Builder
_builder
;
Future
<
T
>
get
completed
=>
_transitionCompleter
.
future
;
final
Completer
<
T
>
_transitionCompleter
=
Completer
<
T
>();
SnackbarStatusCallback
_snackbarStatus
;
...
...
@@ -164,14 +163,11 @@ class SnackRoute<T> extends OverlayRoute<T> {
/// The animation that drives the route's transition and the previous route's
/// forward transition.
Animation
<
Alignment
>
get
animation
=>
_animation
;
Animation
<
Alignment
>
_animation
;
/// The animation controller that the route uses to drive the transitions.
///
/// The animation itself is exposed by the [animation] property.
@protected
AnimationController
get
controller
=>
_controller
;
AnimationController
_controller
;
/// Called to create the animation controller that will drive the transitions
...
...
@@ -235,7 +231,6 @@ class SnackRoute<T> extends OverlayRoute<T> {
T
_result
;
SnackbarStatus
currentStatus
;
//copy of `routes.dart`
void
_handleStatusChanged
(
AnimationStatus
status
)
{
switch
(
status
)
{
case
AnimationStatus
.
completed
:
...
...
@@ -396,16 +391,4 @@ class SnackRoute<T> extends OverlayRoute<T> {
/// A short description of this route useful for debugging.
String
get
debugLabel
=>
'
$runtimeType
'
;
@override
String
toString
()
=>
'
$runtimeType
(animation:
$_controller
)'
;
}
SnackRoute
showSnack
<
T
>({
@required
GetBar
snack
})
{
assert
(
snack
!=
null
);
return
SnackRoute
<
T
>(
snack:
snack
,
settings:
RouteSettings
(
name:
"snackbar"
),
);
}
...
...
Please
register
or
login
to post a comment