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
Nipodemos
2020-08-03 11:32:31 -0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
97351a1d242fd70918d7e75663d5587a79dcf0f1
97351a1d
1 parent
367811bc
fix typo of predicate and page arguments
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
35 additions
and
205 deletions
example/.dart_tool/package_config.json
example/.packages
example/pubspec.lock
lib/src/navigation/extension_navigation.dart
pubspec.lock
example/.dart_tool/package_config.json
deleted
100644 → 0
View file @
367811b
{
"configVersion"
:
2
,
"packages"
:
[
{
"name"
:
"async"
,
"rootUri"
:
"file:///opt/flutter/.pub-cache/hosted/pub.dartlang.org/async-2.4.2"
,
"packageUri"
:
"lib/"
,
"languageVersion"
:
"2.2"
},
{
"name"
:
"boolean_selector"
,
"rootUri"
:
"file:///opt/flutter/.pub-cache/hosted/pub.dartlang.org/boolean_selector-2.0.0"
,
"packageUri"
:
"lib/"
,
"languageVersion"
:
"2.4"
},
{
"name"
:
"characters"
,
"rootUri"
:
"file:///opt/flutter/.pub-cache/hosted/pub.dartlang.org/characters-1.0.0"
,
"packageUri"
:
"lib/"
,
"languageVersion"
:
"2.6"
},
{
"name"
:
"charcode"
,
"rootUri"
:
"file:///opt/flutter/.pub-cache/hosted/pub.dartlang.org/charcode-1.1.3"
,
"packageUri"
:
"lib/"
,
"languageVersion"
:
"2.0"
},
{
"name"
:
"clock"
,
"rootUri"
:
"file:///opt/flutter/.pub-cache/hosted/pub.dartlang.org/clock-1.0.1"
,
"packageUri"
:
"lib/"
,
"languageVersion"
:
"2.0"
},
{
"name"
:
"collection"
,
"rootUri"
:
"file:///opt/flutter/.pub-cache/hosted/pub.dartlang.org/collection-1.14.13"
,
"packageUri"
:
"lib/"
,
"languageVersion"
:
"2.3"
},
{
"name"
:
"dio"
,
"rootUri"
:
"file:///opt/flutter/.pub-cache/hosted/pub.dartlang.org/dio-3.0.9"
,
"packageUri"
:
"lib/"
,
"languageVersion"
:
"2.4"
},
{
"name"
:
"fake_async"
,
"rootUri"
:
"file:///opt/flutter/.pub-cache/hosted/pub.dartlang.org/fake_async-1.1.0"
,
"packageUri"
:
"lib/"
,
"languageVersion"
:
"2.2"
},
{
"name"
:
"flutter"
,
"rootUri"
:
"file:///opt/flutter/packages/flutter"
,
"packageUri"
:
"lib/"
,
"languageVersion"
:
"2.9"
},
{
"name"
:
"flutter_test"
,
"rootUri"
:
"file:///opt/flutter/packages/flutter_test"
,
"packageUri"
:
"lib/"
,
"languageVersion"
:
"2.2"
},
{
"name"
:
"get"
,
"rootUri"
:
"file:///opt/flutter/.pub-cache/hosted/pub.dartlang.org/get-3.2.2"
,
"packageUri"
:
"lib/"
,
"languageVersion"
:
"2.6"
},
{
"name"
:
"http_parser"
,
"rootUri"
:
"file:///opt/flutter/.pub-cache/hosted/pub.dartlang.org/http_parser-3.1.4"
,
"packageUri"
:
"lib/"
,
"languageVersion"
:
"2.3"
},
{
"name"
:
"matcher"
,
"rootUri"
:
"file:///opt/flutter/.pub-cache/hosted/pub.dartlang.org/matcher-0.12.8"
,
"packageUri"
:
"lib/"
,
"languageVersion"
:
"2.4"
},
{
"name"
:
"meta"
,
"rootUri"
:
"file:///opt/flutter/.pub-cache/hosted/pub.dartlang.org/meta-1.1.8"
,
"packageUri"
:
"lib/"
,
"languageVersion"
:
"1.12"
},
{
"name"
:
"path"
,
"rootUri"
:
"file:///opt/flutter/.pub-cache/hosted/pub.dartlang.org/path-1.7.0"
,
"packageUri"
:
"lib/"
,
"languageVersion"
:
"2.0"
},
{
"name"
:
"sky_engine"
,
"rootUri"
:
"file:///opt/flutter/bin/cache/pkg/sky_engine"
,
"packageUri"
:
"lib/"
,
"languageVersion"
:
"1.11"
},
{
"name"
:
"source_span"
,
"rootUri"
:
"file:///opt/flutter/.pub-cache/hosted/pub.dartlang.org/source_span-1.7.0"
,
"packageUri"
:
"lib/"
,
"languageVersion"
:
"2.6"
},
{
"name"
:
"stack_trace"
,
"rootUri"
:
"file:///opt/flutter/.pub-cache/hosted/pub.dartlang.org/stack_trace-1.9.5"
,
"packageUri"
:
"lib/"
,
"languageVersion"
:
"2.0"
},
{
"name"
:
"stream_channel"
,
"rootUri"
:
"file:///opt/flutter/.pub-cache/hosted/pub.dartlang.org/stream_channel-2.0.0"
,
"packageUri"
:
"lib/"
,
"languageVersion"
:
"2.0"
},
{
"name"
:
"string_scanner"
,
"rootUri"
:
"file:///opt/flutter/.pub-cache/hosted/pub.dartlang.org/string_scanner-1.0.5"
,
"packageUri"
:
"lib/"
,
"languageVersion"
:
"2.0"
},
{
"name"
:
"term_glyph"
,
"rootUri"
:
"file:///opt/flutter/.pub-cache/hosted/pub.dartlang.org/term_glyph-1.1.0"
,
"packageUri"
:
"lib/"
,
"languageVersion"
:
"1.8"
},
{
"name"
:
"test_api"
,
"rootUri"
:
"file:///opt/flutter/.pub-cache/hosted/pub.dartlang.org/test_api-0.2.17"
,
"packageUri"
:
"lib/"
,
"languageVersion"
:
"2.7"
},
{
"name"
:
"typed_data"
,
"rootUri"
:
"file:///opt/flutter/.pub-cache/hosted/pub.dartlang.org/typed_data-1.2.0"
,
"packageUri"
:
"lib/"
,
"languageVersion"
:
"2.4"
},
{
"name"
:
"vector_math"
,
"rootUri"
:
"file:///opt/flutter/.pub-cache/hosted/pub.dartlang.org/vector_math-2.0.8"
,
"packageUri"
:
"lib/"
,
"languageVersion"
:
"2.0"
},
{
"name"
:
"get_state"
,
"rootUri"
:
"../"
,
"packageUri"
:
"lib/"
,
"languageVersion"
:
"2.7"
}
],
"generated"
:
"2020-07-14T09:09:42.984811Z"
,
"generator"
:
"pub"
,
"generatorVersion"
:
"2.9.0-21.2.beta"
}
example/.packages
deleted
100644 → 0
View file @
367811b
# Generated by pub on 2020-07-14 06:09:42.955823.
async:file:///opt/flutter/.pub-cache/hosted/pub.dartlang.org/async-2.4.2/lib/
boolean_selector:file:///opt/flutter/.pub-cache/hosted/pub.dartlang.org/boolean_selector-2.0.0/lib/
characters:file:///opt/flutter/.pub-cache/hosted/pub.dartlang.org/characters-1.0.0/lib/
charcode:file:///opt/flutter/.pub-cache/hosted/pub.dartlang.org/charcode-1.1.3/lib/
clock:file:///opt/flutter/.pub-cache/hosted/pub.dartlang.org/clock-1.0.1/lib/
collection:file:///opt/flutter/.pub-cache/hosted/pub.dartlang.org/collection-1.14.13/lib/
dio:file:///opt/flutter/.pub-cache/hosted/pub.dartlang.org/dio-3.0.9/lib/
fake_async:file:///opt/flutter/.pub-cache/hosted/pub.dartlang.org/fake_async-1.1.0/lib/
flutter:file:///opt/flutter/packages/flutter/lib/
flutter_test:file:///opt/flutter/packages/flutter_test/lib/
get:file:///opt/flutter/.pub-cache/hosted/pub.dartlang.org/get-3.2.2/lib/
http_parser:file:///opt/flutter/.pub-cache/hosted/pub.dartlang.org/http_parser-3.1.4/lib/
matcher:file:///opt/flutter/.pub-cache/hosted/pub.dartlang.org/matcher-0.12.8/lib/
meta:file:///opt/flutter/.pub-cache/hosted/pub.dartlang.org/meta-1.1.8/lib/
path:file:///opt/flutter/.pub-cache/hosted/pub.dartlang.org/path-1.7.0/lib/
sky_engine:file:///opt/flutter/bin/cache/pkg/sky_engine/lib/
source_span:file:///opt/flutter/.pub-cache/hosted/pub.dartlang.org/source_span-1.7.0/lib/
stack_trace:file:///opt/flutter/.pub-cache/hosted/pub.dartlang.org/stack_trace-1.9.5/lib/
stream_channel:file:///opt/flutter/.pub-cache/hosted/pub.dartlang.org/stream_channel-2.0.0/lib/
string_scanner:file:///opt/flutter/.pub-cache/hosted/pub.dartlang.org/string_scanner-1.0.5/lib/
term_glyph:file:///opt/flutter/.pub-cache/hosted/pub.dartlang.org/term_glyph-1.1.0/lib/
test_api:file:///opt/flutter/.pub-cache/hosted/pub.dartlang.org/test_api-0.2.17/lib/
typed_data:file:///opt/flutter/.pub-cache/hosted/pub.dartlang.org/typed_data-1.2.0/lib/
vector_math:file:///opt/flutter/.pub-cache/hosted/pub.dartlang.org/vector_math-2.0.8/lib/
get_state:lib/
example/pubspec.lock
View file @
97351a1
...
...
@@ -7,7 +7,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.
2
"
version: "2.4.
1
"
boolean_selector:
dependency: transitive
description:
...
...
@@ -120,7 +120,7 @@ packages:
name: stack_trace
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.
5
"
version: "1.9.
3
"
stream_channel:
dependency: transitive
description:
...
...
lib/src/navigation/extension_navigation.dart
View file @
97351a1
...
...
@@ -126,27 +126,31 @@ extension GetNavigation on GetInterface {
/// as explained in documentation
///
/// [predicate] can be used like this:
/// `Get.until(Get.currentRoute == '/home')`so when you get to home page,
/// `Get.until(
(route) =>
Get.currentRoute == '/home')`so when you get to home page,
///
/// or also like this:
/// `Get.until(!Get.isDialogOpen())`, to make sure the dialog is closed
/// `Get.until(
(route) =>
!Get.isDialogOpen())`, to make sure the dialog is closed
void
until
(
RoutePredicate
predicate
,
{
int
id
})
{
// if (key.currentState.mounted) // add this if appear problems on future with route navigate
// when widget don't mounted
return
global
(
id
).
currentState
.
popUntil
(
predicate
);
}
/// Push the given [page], and then pop several
[pages]
in the stack until
/// Push the given [page], and then pop several
pages
in the stack until
/// [predicate] returns true
///
/// [id] is for when you are using nested navigation,
/// as explained in documentation
///
/// Obs: unlike other get methods, this one you need to send a function
/// that returns the widget to the page argument, like this:
/// Get.offUntil( () => HomePage() )
///
/// [predicate] can be used like this:
/// `Get.until(Get.currentRoute == '/home')`so when you get to home page,
/// `Get.until(
(route) =>
Get.currentRoute == '/home')`so when you get to home page,
///
/// or also like this:
/// `Get.until(!Get.isDialogOpen())`, to make sure the dialog is closed
/// `Get.until(
(route) =>
!Get.isDialogOpen())`, to make sure the dialog is closed
Future
<
T
>
offUntil
<
T
>(
Route
<
T
>
page
,
RoutePredicate
predicate
,
{
int
id
})
{
// if (key.currentState.mounted) // add this if appear problems on future with route navigate
// when widget don't mounted
...
...
@@ -162,9 +166,9 @@ extension GetNavigation on GetInterface {
/// as explained in documentation
///
/// [predicate] can be used like this:
/// `Get.until(Get.currentRoute == '/home')`so when you get to home page,
/// `Get.until(
(route) =>
Get.currentRoute == '/home')`so when you get to home page,
/// or also like
/// `Get.until(!Get.isDialogOpen())`, to make sure the dialog is closed
/// `Get.until(
(route) =>
!Get.isDialogOpen())`, to make sure the dialog is closed
///
/// Note: Always put a slash on the route ('/page1'), to avoid unnexpected errors
Future
<
T
>
offNamedUntil
<
T
>(
...
...
@@ -201,13 +205,19 @@ extension GetNavigation on GetInterface {
return
global
(
id
).
currentState
.
removeRoute
(
route
);
}
/// Push a named [page] and remove all other pages from stack
/// Push a named [page] and pop several pages in the stack
/// until [predicate] returns true. [predicate] is optional
///
/// It has the advantage of not needing context, so you can
/// call from your business logic.
///
/// You can send any type of value to the other route in the [arguments].
///
/// [predicate] can be used like this:
/// `Get.until((route) => Get.currentRoute == '/home')`so when you get to home page,
/// or also like
/// `Get.until((route) => !Get.isDialogOpen())`, to make sure the dialog is closed
///
/// [id] is for when you are using nested navigation,
/// as explained in documentation
///
...
...
@@ -260,6 +270,9 @@ extension GetNavigation on GetInterface {
}
/// Close as many routes as defined by [times]
///
/// [id] is for when you are using nested navigation,
/// as explained in documentation
void
close
(
int
times
,
[
int
id
])
{
if
((
times
==
null
)
||
(
times
<
1
))
{
times
=
1
;
...
...
@@ -320,7 +333,8 @@ extension GetNavigation on GetInterface {
transitionDuration:
duration
??
defaultDurationTransition
));
}
/// Pop all pages in the stack and pushes a new [page] to it
/// Push a [page] and pop several pages in the stack
/// until [predicate] returns true. [predicate] is optional
///
/// It has the advantage of not needing context,
/// so you can call from your business logic
...
...
@@ -333,9 +347,9 @@ extension GetNavigation on GetInterface {
/// as a [fullscreenDialog],
///
/// [predicate] can be used like this:
/// `Get.until(Get.currentRoute == '/home')`so when you get to home page,
/// `Get.until(
(route) =>
Get.currentRoute == '/home')`so when you get to home page,
/// or also like
/// `Get.until(!Get.isDialogOpen())`, to make sure the dialog is closed
/// `Get.until(
(route) =>
!Get.isDialogOpen())`, to make sure the dialog is closed
///
/// [id] is for when you are using nested navigation,
/// as explained in documentation
...
...
pubspec.lock
View file @
97351a1
...
...
@@ -7,7 +7,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.
2
"
version: "2.4.
1
"
boolean_selector:
dependency: transitive
description:
...
...
@@ -21,7 +21,7 @@ packages:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.
1.0-nullsafety
"
version: "1.
0.0
"
charcode:
dependency: transitive
description:
...
...
@@ -42,7 +42,7 @@ packages:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.1
5.0-nullsafety
"
version: "1.1
4.13
"
fake_async:
dependency: transitive
description:
...
...
@@ -73,7 +73,7 @@ packages:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.
3.0-nullsafety
"
version: "1.
1.8
"
path:
dependency: transitive
description:
...
...
@@ -99,7 +99,7 @@ packages:
name: stack_trace
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.
5
"
version: "1.9.
3
"
stream_channel:
dependency: transitive
description:
...
...
@@ -134,13 +134,13 @@ packages:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.
3.0-nullsafety
"
version: "1.
2.0
"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.
1.0-nullsafety
"
version: "2.
0.8
"
sdks:
dart: ">=2.9.0-1
8.0 <2.9
.0"
dart: ">=2.9.0-1
4.0.dev <3.0
.0"
...
...
Please
register
or
login
to post a comment