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-27 22:30:12 -0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
570a0902267204c35d38c00a639f53713ba26c62
570a0902
1 parent
5150f5d2
fix types on extensions
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
12 additions
and
50 deletions
packages/get_navigation/lib/src/snackbar/snack.dart
packages/get_navigation/lib/src/snackbar/snack_route.dart
packages/get_utils/lib/src/extensions/duration_extensions.dart
packages/get_utils/lib/src/extensions/internacionalization.dart
packages/get_utils/lib/src/extensions/num_extensions.dart
packages/get_utils/pubspec.yaml
packages/get_navigation/lib/src/snackbar/snack.dart
View file @
570a090
...
...
@@ -206,40 +206,6 @@ class GetBar<T extends Object> extends StatefulWidget {
return
await
Get
.
key
.
currentState
.
push
(
_snackRoute
);
}
/// Dismisses the snack causing is to return a future containing [result].
/// When this future finishes, it is guaranteed that Snack was dismissed.
Future
<
T
>
dismiss
([
T
result
])
async
{
// If route was never initialized, do nothing
if
(
_snackRoute
==
null
)
{
return
null
;
}
if
(
_snackRoute
.
isCurrent
)
{
_snackRoute
.
navigator
.
pop
(
result
);
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
// SnackbarStatus.CLOSING or SnackbarStatus.CLOSED
// To avoid this, always make sure that Snack is the top
// route when it is being dismissed
_snackRoute
.
navigator
.
removeRoute
(
_snackRoute
);
}
return
null
;
}
/// Checks if the snack is visible
bool
isShowing
()
{
return
_snackRoute
?.
currentStatus
==
SnackbarStatus
.
OPEN
;
}
/// Checks if the snack is dismissed
bool
isDismissed
()
{
return
_snackRoute
?.
currentStatus
==
SnackbarStatus
.
CLOSED
;
}
@override
State
createState
()
{
return
_GetBarState
<
T
>();
...
...
@@ -273,8 +239,9 @@ class _GetBarState<K extends Object> extends State<GetBar>
((
widget
.
userInputForm
!=
null
||
((
widget
.
message
!=
null
&&
widget
.
message
.
isNotEmpty
)
||
widget
.
messageText
!=
null
))),
// ignore: lines_longer_than_80_chars
"A message is mandatory if you are not using userInputForm. Set either a message or messageText"
);
"""
A message is mandatory if you are not using userInputForm.
Set either a message or messageText"""
);
_isTitlePresent
=
(
widget
.
title
!=
null
||
widget
.
titleText
!=
null
);
_messageTopMargin
=
_isTitlePresent
?
6.0
:
widget
.
padding
.
top
;
...
...
packages/get_navigation/lib/src/snackbar/snack_route.dart
View file @
570a090
import
'dart:async'
;
import
'dart:ui'
;
import
'package:flutter/widgets.dart'
;
import
'../../get_navigation.dart'
;
import
'snack.dart'
;
class
SnackRoute
<
T
>
extends
OverlayRoute
<
T
>
{
...
...
@@ -65,7 +64,7 @@ class SnackRoute<T> extends OverlayRoute<T> {
OverlayEntry
(
builder:
(
context
)
{
return
GestureDetector
(
onTap:
snack
.
isDismissible
?
()
=>
snack
.
dismiss
()
:
null
,
onTap:
snack
.
isDismissible
?
Get
.
back
:
null
,
child:
AnimatedBuilder
(
animation:
_filterBlurAnimation
,
builder:
(
context
,
child
)
{
...
...
packages/get_utils/lib/src/extensions/duration_extensions.dart
View file @
570a090
import
'dart:
ui
'
;
import
'dart:
async
'
;
/// Duration utilities.
extension
GetDurationUtils
on
Duration
{
...
...
@@ -15,5 +15,5 @@ extension GetDurationUtils on Duration {
/// await 0.7.seconds.delay(() {
/// }
///```
Future
delay
([
VoidCallback
callback
])
async
=>
Future
.
delayed
(
this
,
callback
);
Future
delay
([
FutureOr
callback
()
])
async
=>
Future
.
delayed
(
this
,
callback
);
}
...
...
packages/get_utils/lib/src/extensions/internacionalization.dart
View file @
570a090
...
...
@@ -66,13 +66,9 @@ extension LocalesIntl on GetInterface {
Locale
get
fallbackLocale
=>
_intlHost
.
fallbackLocale
;
set
locale
(
Locale
newLocale
)
{
_intlHost
.
locale
=
newLocale
;
}
set
locale
(
Locale
newLocale
)
=>
_intlHost
.
locale
=
newLocale
;
set
fallbackLocale
(
Locale
newLocale
)
{
_intlHost
.
fallbackLocale
=
newLocale
;
}
set
fallbackLocale
(
Locale
newLocale
)
=>
_intlHost
.
fallbackLocale
=
newLocale
;
Map
<
String
,
Map
<
String
,
String
>>
get
translations
=>
_intlHost
.
translations
;
...
...
packages/get_utils/lib/src/extensions/num_extensions.dart
View file @
570a090
import
'dart:ui'
;
import
'dart:async'
;
import
'../get_utils/get_utils.dart'
;
extension
GetNumUtils
on
num
{
...
...
@@ -24,7 +23,7 @@ extension GetNumUtils on num {
/// print('currently running callback 1.2sec');
/// }
///```
Future
delay
([
VoidCallback
callback
])
async
=>
Future
.
delayed
(
Future
delay
([
FutureOr
callback
()
])
async
=>
Future
.
delayed
(
Duration
(
milliseconds:
(
this
*
1000
).
round
()),
callback
,
);
...
...
packages/get_utils/pubspec.yaml
View file @
570a090
...
...
@@ -12,6 +12,7 @@ dependencies:
sdk
:
flutter
get_core
:
path
:
../get_core
meta
:
"
>=1.1.0
<2.0.0"
dev_dependencies
:
flutter_test
:
...
...
Please
register
or
login
to post a comment