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-09-01 14:55:47 -0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c4f613764e153ab170410dfbdbd728b82a706e5a
c4f61376
1 parent
efccb492
update to 3.8.0
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
52 additions
and
38 deletions
CHANGELOG.md
example/pubspec.lock
lib/src/navigation/extension_navigation.dart
lib/src/navigation/snackbar/snack.dart
lib/src/navigation/snackbar/snack_route.dart
pubspec.yaml
CHANGELOG.md
View file @
c4f6137
## [3.8.0]
-
Added: Snackbar Status: Open, Opening, Closing and Closed
example:
```
dart
Get
.
snackbar
(
'title'
,
'message'
,
snackbarStatus:
(
status
)
{
if
(
status
==
SnackbarStatus
.
CLOSED
)
{
// made anything
}
});
```
## [3.7.0]
-
Added: RxSet. Sets can now also be reactive.
-
Added isDesktop/isMobile (@roipeker)
...
...
example/pubspec.lock
View file @
c4f6137
...
...
@@ -73,7 +73,7 @@ packages:
path: ".."
relative: true
source: path
version: "3.
7
.0"
version: "3.
8
.0"
http_parser:
dependency: transitive
description:
...
...
lib/src/navigation/extension_navigation.dart
View file @
c4f6137
...
...
@@ -253,7 +253,7 @@ extension GetNavigation on GetInterface {
arguments:
arguments
);
}
/// Returns true if a Snackbar, Dialog or BottomSheet is currently
showing
/// Returns true if a Snackbar, Dialog or BottomSheet is currently
OPEN
bool
get
isOverlaysOpen
=>
(
isSnackbarOpen
||
isDialogOpen
||
isBottomSheetOpen
);
...
...
@@ -664,12 +664,13 @@ extension GetNavigation on GetInterface {
Curve
forwardAnimationCurve
=
Curves
.
easeOutCirc
,
Curve
reverseAnimationCurve
=
Curves
.
easeOutCirc
,
Duration
animationDuration
=
const
Duration
(
seconds:
1
),
Snack
StatusCallback
onStatusChanged
,
Snack
barStatusCallback
snackbarStatus
,
double
barBlur
=
0.0
,
double
overlayBlur
=
0.0
,
Color
overlayColor
=
Colors
.
transparent
,
Form
userInputForm
})
{
Color
overlayColor
,
Form
userInputForm
})
async
{
GetBar
getBar
=
GetBar
(
snackbarStatus:
snackbarStatus
,
title:
title
,
message:
message
,
titleText:
titleText
,
...
...
@@ -749,9 +750,11 @@ extension GetNavigation on GetInterface {
Duration
animationDuration
,
double
barBlur
,
double
overlayBlur
,
SnackbarStatusCallback
snackbarStatus
,
Color
overlayColor
,
Form
userInputForm
})
{
Form
userInputForm
})
async
{
GetBar
getBar
=
GetBar
(
snackbarStatus:
snackbarStatus
,
titleText:
(
title
==
null
)
?
null
:
titleText
??
...
...
lib/src/navigation/snackbar/snack.dart
View file @
c4f6137
...
...
@@ -3,9 +3,9 @@ import 'dart:ui';
import
'package:flutter/material.dart'
;
import
'package:flutter/scheduler.dart'
;
import
'package:get/get.dart'
;
import
'snack_route.dart'
as
route
;
import
'snack_route.dart'
;
typedef
void
Snack
StatusCallback
(
Snack
Status
status
);
typedef
void
Snack
barStatusCallback
(
Snackbar
Status
status
);
typedef
void
OnTap
(
GetBar
snack
);
// ignore: must_be_immutable
...
...
@@ -42,7 +42,7 @@ class GetBar<T extends Object> extends StatefulWidget {
Curve
forwardAnimationCurve
=
Curves
.
easeOutCirc
,
Curve
reverseAnimationCurve
=
Curves
.
easeOutCirc
,
Duration
animationDuration
=
const
Duration
(
seconds:
1
),
Snack
StatusCallback
onStatusChanged
,
Snack
barStatusCallback
snackbarStatus
,
double
barBlur
=
0.0
,
double
overlayBlur
=
0.0
,
Color
overlayColor
=
Colors
.
transparent
,
...
...
@@ -83,11 +83,11 @@ class GetBar<T extends Object> extends StatefulWidget {
this
.
overlayColor
=
overlayColor
,
this
.
userInputForm
=
userInputForm
,
super
(
key:
key
)
{
this
.
onStatusChanged
=
onStatusChanged
??
(
status
)
{};
this
.
snackbarStatus
=
snackbarStatus
??
(
status
)
{};
}
/// A callback for you to listen to the different Snack status
Snack
StatusCallback
onStatusChanged
;
Snack
barStatusCallback
snackbarStatus
;
/// The title displayed to the user
final
String
title
;
...
...
@@ -209,11 +209,11 @@ class GetBar<T extends Object> extends StatefulWidget {
/// A [TextFormField] in case you want a simple user input. Every other widget is ignored if this is not null.
final
Form
userInputForm
;
route
.
SnackRoute
<
T
>
_snackRoute
;
SnackRoute
<
T
>
_snackRoute
;
/// Show the snack. Kicks in [Snack
Status.IS_APPEARING] state followed by [SnackStatus.SHOWING
]
/// Show the snack. Kicks in [Snack
barStatus.OPENING] state followed by [SnackbarStatus.OPEN
]
Future
<
T
>
show
()
async
{
_snackRoute
=
route
.
showSnack
<
T
>(
_snackRoute
=
showSnack
<
T
>(
snack:
this
,
)
as
SnackRoute
<
T
>;
return
await
Get
.
key
.
currentState
.
push
(
_snackRoute
);
...
...
@@ -232,7 +232,7 @@ class GetBar<T extends Object> extends StatefulWidget {
return
_snackRoute
.
completed
;
}
else
if
(
_snackRoute
.
isActive
)
{
// removeRoute is called every time you dismiss a Snack that is not the top route.
// It will not animate back and listeners will not detect Snack
Status.IS_HIDING or SnackStatus.DISMIS
SED
// It will not animate back and listeners will not detect Snack
barStatus.CLOSING or SnackbarStatus.CLO
SED
// To avoid this, always make sure that Snack is the top route when it is being dismissed
_snackRoute
.
navigator
.
removeRoute
(
_snackRoute
);
}
...
...
@@ -242,12 +242,12 @@ class GetBar<T extends Object> extends StatefulWidget {
/// Checks if the snack is visible
bool
isShowing
()
{
return
_snackRoute
?.
currentStatus
==
Snack
Status
.
SHOWING
;
return
_snackRoute
?.
currentStatus
==
Snack
barStatus
.
OPEN
;
}
/// Checks if the snack is dismissed
bool
isDismissed
()
{
return
_snackRoute
?.
currentStatus
==
Snack
Status
.
DISMIS
SED
;
return
_snackRoute
?.
currentStatus
==
Snack
barStatus
.
CLO
SED
;
}
@override
...
...
@@ -258,7 +258,7 @@ class GetBar<T extends Object> extends StatefulWidget {
class
_GetBarState
<
K
extends
Object
>
extends
State
<
GetBar
>
with
TickerProviderStateMixin
{
SnackStatus
currentStatus
;
Snack
bar
Status
currentStatus
;
AnimationController
_fadeController
;
Animation
<
double
>
_fadeAnimation
;
...
...
@@ -732,9 +732,9 @@ enum SnackStyle { FLOATING, GROUNDED }
/// If vertical, dismiss down will be allowed if [SnackPosition.BOTTOM]
enum
SnackDismissDirection
{
HORIZONTAL
,
VERTICAL
}
/// Indicates the animation status
/// [SnackStatus.SHOWING] Snack has stopped and the user can see it
/// [SnackStatus.DISMISSED] Snack has finished its mission and returned any pending values
/// [SnackStatus.IS_APPEARING] Snack is moving towards [SnackStatus.SHOWING]
/// [SnackStatus.IS_HIDING] Snack is moving towards [] [SnackStatus.DISMISSED]
enum
SnackStatus
{
SHOWING
,
DISMISSED
,
IS_APPEARING
,
IS_HIDING
}
/// Indicates Status of snackbar
/// [SnackbarStatus.OPEN] Snack is fully open, [SnackbarStatus.CLOSED] Snackbar has closed,
/// [SnackbarStatus.OPENING] Starts with the opening animation and ends with the full
/// snackbar display, [SnackbarStatus.CLOSING] Starts with the closing animation and ends
/// with the full snackbar dispose
enum
SnackbarStatus
{
OPEN
,
CLOSED
,
OPENING
,
CLOSING
}
...
...
lib/src/navigation/snackbar/snack_route.dart
View file @
c4f6137
...
...
@@ -19,7 +19,7 @@ class SnackRoute<T> extends OverlayRoute<T> {
});
_configureAlignment
(
this
.
snack
.
snackPosition
);
_
onStatusChanged
=
snack
.
onStatusChanged
;
_
snackbarStatus
=
snack
.
snackbarStatus
;
}
_configureAlignment
(
SnackPosition
snackPosition
)
{
...
...
@@ -45,7 +45,7 @@ class SnackRoute<T> extends OverlayRoute<T> {
Future
<
T
>
get
completed
=>
_transitionCompleter
.
future
;
final
Completer
<
T
>
_transitionCompleter
=
Completer
<
T
>();
Snack
StatusCallback
_onStatusChanged
;
Snack
barStatusCallback
_snackbarStatus
;
Alignment
_initialAlignment
;
Alignment
_endAlignment
;
bool
_wasDismissedBySwipe
=
false
;
...
...
@@ -115,8 +115,8 @@ class SnackRoute<T> extends OverlayRoute<T> {
direction:
_getDismissDirection
(),
resizeDuration:
null
,
confirmDismiss:
(
_
)
{
if
(
currentStatus
==
SnackStatus
.
IS_APPEARING
||
currentStatus
==
SnackStatus
.
IS_HIDING
)
{
if
(
currentStatus
==
SnackbarStatus
.
OPENING
||
currentStatus
==
SnackbarStatus
.
CLOSING
)
{
return
Future
.
value
(
false
);
}
return
Future
.
value
(
true
);
...
...
@@ -231,24 +231,24 @@ class SnackRoute<T> extends OverlayRoute<T> {
}
T
_result
;
SnackStatus
currentStatus
;
Snack
bar
Status
currentStatus
;
//copy of `routes.dart`
void
_handleStatusChanged
(
AnimationStatus
status
)
{
switch
(
status
)
{
case
AnimationStatus
.
completed
:
currentStatus
=
SnackStatus
.
SHOWING
;
_onStatusChanged
(
currentStatus
);
currentStatus
=
SnackbarStatus
.
OPEN
;
_snackbarStatus
(
currentStatus
);
if
(
overlayEntries
.
isNotEmpty
)
overlayEntries
.
first
.
opaque
=
opaque
;
break
;
case
AnimationStatus
.
forward
:
currentStatus
=
SnackStatus
.
IS_APPEARING
;
_onStatusChanged
(
currentStatus
);
currentStatus
=
SnackbarStatus
.
OPENING
;
_snackbarStatus
(
currentStatus
);
break
;
case
AnimationStatus
.
reverse
:
currentStatus
=
SnackStatus
.
IS_HIDING
;
_onStatusChanged
(
currentStatus
);
currentStatus
=
SnackbarStatus
.
CLOSING
;
_snackbarStatus
(
currentStatus
);
if
(
overlayEntries
.
isNotEmpty
)
overlayEntries
.
first
.
opaque
=
false
;
break
;
case
AnimationStatus
.
dismissed
:
...
...
@@ -257,8 +257,8 @@ class SnackRoute<T> extends OverlayRoute<T> {
// the transition and hits the dismissed status. For example, the iOS
// back gesture drives this animation to the dismissed status before
// popping the navigator.
currentStatus
=
SnackStatus
.
DISMISSED
;
_onStatusChanged
(
currentStatus
);
currentStatus
=
SnackbarStatus
.
CLOSED
;
_snackbarStatus
(
currentStatus
);
if
(!
isCurrent
)
{
navigator
.
finalizeRoute
(
this
);
...
...
pubspec.yaml
View file @
c4f6137
name
:
get
description
:
Open screens/snackbars/dialogs/bottomSheets without context, manage states and inject dependencies easily with GetX.
version
:
3.
7
.0
version
:
3.
8
.0
homepage
:
https://github.com/jonataslaw/get
environment
:
...
...
Please
register
or
login
to post a comment