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
Rafa Ruiz
2023-02-02 18:14:03 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
9ac31e001af83e0fb779d8957967f4bd8ab08e39
9ac31e00
1 parent
92f0d5e5
OnHover feature for Snackbars
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
1 deletions
lib/get_navigation/src/extension_navigation.dart
lib/get_navigation/src/snackbar/snackbar.dart
lib/get_navigation/src/snackbar/snackbar_controller.dart
lib/get_navigation/src/extension_navigation.dart
View file @
9ac31e0
...
...
@@ -392,6 +392,7 @@ extension ExtensionSnackbar on GetInterface {
Gradient
?
backgroundGradient
,
TextButton
?
mainButton
,
OnTap
?
onTap
,
OnHover
?
onHover
,
bool
?
isDismissible
,
bool
?
showProgressIndicator
,
DismissDirection
?
dismissDirection
,
...
...
@@ -445,6 +446,7 @@ extension ExtensionSnackbar on GetInterface {
backgroundGradient:
backgroundGradient
,
mainButton:
mainButton
,
onTap:
onTap
,
onHover:
onHover
,
isDismissible:
isDismissible
??
true
,
dismissDirection:
dismissDirection
,
showProgressIndicator:
showProgressIndicator
??
false
,
...
...
lib/get_navigation/src/snackbar/snackbar.dart
View file @
9ac31e0
...
...
@@ -7,6 +7,7 @@ import '../../../get_core/get_core.dart';
import
'../../get_navigation.dart'
;
typedef
OnTap
=
void
Function
(
GetSnackBar
snack
);
typedef
OnHover
=
void
Function
(
GetSnackBar
snack
,
SnackHoverState
snackHoverState
);
typedef
SnackbarStatusCallback
=
void
Function
(
SnackbarStatus
?
status
);
...
...
@@ -150,6 +151,9 @@ class GetSnackBar extends StatefulWidget {
/// An alternative to [mainButton]
final
OnTap
?
onTap
;
/// A callback that registers the user's hover anywhere over the Snackbar.
final
OnHover
?
onHover
;
/// How long until Snack will hide itself (be dismissed).
/// To make it indefinite, leave it null.
final
Duration
?
duration
;
...
...
@@ -259,6 +263,7 @@ class GetSnackBar extends StatefulWidget {
this
.
backgroundGradient
,
this
.
mainButton
,
this
.
onTap
,
this
.
onHover
,
this
.
duration
,
this
.
isDismissible
=
true
,
this
.
dismissDirection
,
...
...
@@ -657,3 +662,6 @@ enum SnackPosition { top, bottom }
/// Indicates if snack will be attached to the edge of the screen or not
enum
SnackStyle
{
floating
,
grounded
}
/// Indicates if the mouse entered or exited
enum
SnackHoverState
{
entered
,
exited
}
\ No newline at end of file
...
...
lib/get_navigation/src/snackbar/snackbar_controller.dart
View file @
9ac31e0
...
...
@@ -238,11 +238,15 @@ class SnackbarController {
Widget
_getBodyWidget
()
{
return
Builder
(
builder:
(
_
)
{
return
GestureDetector
(
return
MouseRegion
(
onEnter:
(
_
)
=>
snackbar
.
onHover
?.
call
(
snackbar
,
SnackHoverState
.
entered
),
onExit:
(
_
)
=>
snackbar
.
onHover
?.
call
(
snackbar
,
SnackHoverState
.
exited
),
child:
GestureDetector
(
child:
snackbar
,
onTap:
snackbar
.
onTap
!=
null
?
()
=>
snackbar
.
onTap
?.
call
(
snackbar
)
:
null
,
),
);
});
}
...
...
Please
register
or
login
to post a comment