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
Jonny Borges
2022-01-31 12:06:08 +0000
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
b8b33e475bfa0d8fc14e3ab6455b6ce11918cabe
b8b33e47
1 parent
25b7ee1f
fix all binding types
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
94 additions
and
81 deletions
lib/get.dart
lib/get_navigation/src/extension_navigation.dart
lib/get_navigation/src/root/root_controller.dart
lib/get_navigation/src/routes/default_route.dart
lib/get_navigation/src/routes/get_information_parser.dart
lib/get_navigation/src/routes/get_navigation_interface.dart
lib/get_navigation/src/routes/get_route.dart
lib/get_navigation/src/routes/get_router_delegate.dart
lib/get_navigation/src/routes/get_transition_mixin.dart
lib/get_navigation/src/routes/index.dart
lib/get_navigation/src/routes/router_outlet.dart
lib/get_state_manager/src/rx_flutter/rx_notifier.dart
lib/get_state_manager/src/simple/get_controllers.dart
lib/get_state_manager/src/simple/get_state.dart
lib/get_utils/src/extensions/export.dart
pubspec.yaml
test/benchmarks/benckmark_test.dart
test/navigation/get_main_test.dart
lib/get.dart
View file @
b8b33e4
...
...
@@ -7,7 +7,7 @@ export 'get_common/get_reset.dart';
export
'get_connect/connect.dart'
;
export
'get_core/get_core.dart'
;
export
'get_instance/get_instance.dart'
;
export
'get_navigation/get_navigation.dart'
hide
FirstWhereOrNullExt
;
export
'get_navigation/get_navigation.dart'
;
export
'get_rx/get_rx.dart'
;
export
'get_state_manager/get_state_manager.dart'
;
export
'get_utils/get_utils.dart'
;
...
...
lib/get_navigation/src/extension_navigation.dart
View file @
b8b33e4
...
...
@@ -511,7 +511,7 @@ extension GetNavigationExt on GetInterface {
String
?
routeName
,
bool
fullscreenDialog
=
false
,
dynamic
arguments
,
List
<
BindingsInterface
>
?
bindings
,
List
<
BindingsInterface
>
bindings
=
const
[]
,
bool
preventDuplicates
=
true
,
bool
?
popGesture
,
bool
showCupertinoParallax
=
true
,
...
...
@@ -889,7 +889,7 @@ extension GetNavigationExt on GetInterface {
int
?
id
,
String
?
routeName
,
dynamic
arguments
,
List
<
BindingsInterface
>
?
bindings
,
List
<
BindingsInterface
>
bindings
=
const
[]
,
bool
fullscreenDialog
=
false
,
bool
preventDuplicates
=
true
,
Duration
?
duration
,
...
...
@@ -968,7 +968,7 @@ extension GetNavigationExt on GetInterface {
int
?
id
,
String
?
routeName
,
dynamic
arguments
,
List
<
BindingsInterface
>
?
bindings
,
List
<
BindingsInterface
>
bindings
=
const
[]
,
bool
fullscreenDialog
=
false
,
Transition
?
transition
,
Curve
?
curve
,
...
...
lib/get_navigation/src/root/root_controller.dart
View file @
b8b33e4
...
...
@@ -4,7 +4,7 @@ import '../../../get.dart';
class
GetMaterialController
extends
FullLifeCycleController
{
static
GetMaterialController
get
to
=>
Get
.
find
();
bool
testMode
=
false
;
Key
?
unikey
;
ThemeData
?
theme
;
...
...
lib/get_navigation/src/routes/default_route.dart
View file @
b8b33e4
...
...
@@ -51,7 +51,7 @@ class GetPageRoute<T> extends PageRoute<T>
this
.
customTransition
,
this
.
barrierDismissible
=
false
,
this
.
barrierColor
,
this
.
bindings
,
this
.
bindings
=
const
[]
,
this
.
binds
,
this
.
routeName
,
this
.
page
,
...
...
@@ -73,7 +73,7 @@ class GetPageRoute<T> extends PageRoute<T>
final
String
?
routeName
;
//final String reference;
final
CustomTransition
?
customTransition
;
final
List
<
BindingsInterface
>
?
bindings
;
final
List
<
BindingsInterface
>
bindings
;
final
Map
<
String
,
String
>?
parameter
;
final
List
<
Bind
>?
binds
;
...
...
@@ -113,41 +113,33 @@ class GetPageRoute<T> extends PageRoute<T>
if
(
_child
!=
null
)
return
_child
!;
final
middlewareRunner
=
MiddlewareRunner
(
middlewares
);
final
localbinds
=
[
if
(
binds
!=
null
)
...
binds
!,
];
final
localbindings
=
[
if
(
bindings
!=
null
)
...
bindings
!,
];
final
localbinds
=
[
if
(
binds
!=
null
)
...
binds
!];
final
bindingsToBind
=
middlewareRunner
.
runOnBindingsStart
(
bindings
!=
null
?
localbindings
:
localbinds
);
/// Retrocompatibility workaround, remove this when Bindings api
/// have been removed
if
(
bindingsToBind
!=
null
&&
bindingsToBind
is
!
List
<
Bind
>
&&
bindingsToBind
is
List
<
BindingsInterface
>)
{
for
(
final
binding
in
bindingsToBind
)
{
binding
.
dependencies
();
}
}
.
runOnBindingsStart
(
bindings
.
isNotEmpty
?
bindings
:
localbinds
);
final
pageToBuild
=
middlewareRunner
.
runOnPageBuildStart
(
page
)!;
if
(
bindingsToBind
!=
null
&&
bindingsToBind
.
isNotEmpty
&&
bindingsToBind
is
List
<
Bind
>)
{
_child
=
Binds
(
child:
middlewareRunner
.
runOnPageBuilt
(
pageToBuild
()),
binds:
bindingsToBind
,
);
}
else
{
_child
=
middlewareRunner
.
runOnPageBuilt
(
pageToBuild
());
if
(
bindingsToBind
!=
null
&&
bindingsToBind
.
isNotEmpty
)
{
if
(
bindingsToBind
is
List
<
BindingsInterface
>)
{
for
(
final
item
in
bindingsToBind
)
{
final
dep
=
item
.
dependencies
();
if
(
dep
is
List
<
Bind
>)
{
_child
=
Binds
(
child:
middlewareRunner
.
runOnPageBuilt
(
pageToBuild
()),
binds:
dep
,
);
}
}
}
else
if
(
bindingsToBind
is
List
<
Bind
>)
{
_child
=
Binds
(
child:
middlewareRunner
.
runOnPageBuilt
(
pageToBuild
()),
binds:
bindingsToBind
,
);
}
}
return
_child
!
;
return
_child
??=
middlewareRunner
.
runOnPageBuilt
(
pageToBuild
())
;
}
@override
...
...
lib/get_navigation/src/routes/get_information_parser.dart
View file @
b8b33e4
...
...
@@ -2,7 +2,6 @@ import 'package:flutter/foundation.dart';
import
'package:flutter/widgets.dart'
;
import
'../../../get.dart'
;
import
'parse_route.dart'
;
class
GetInformationParser
extends
RouteInformationParser
<
RouteDecoder
>
{
final
String
initialRoute
;
...
...
lib/get_navigation/src/routes/get_navigation_interface.dart
View file @
b8b33e4
...
...
@@ -15,7 +15,7 @@ mixin IGetNavigation {
String
?
routeName
,
bool
fullscreenDialog
=
false
,
dynamic
arguments
,
List
<
BindingsInterface
>
?
bindings
,
List
<
BindingsInterface
>
bindings
=
const
[]
,
bool
preventDuplicates
=
true
,
bool
?
popGesture
,
bool
showCupertinoParallax
=
true
,
...
...
@@ -32,7 +32,7 @@ mixin IGetNavigation {
String
?
routeName
,
bool
fullscreenDialog
=
false
,
dynamic
arguments
,
List
<
BindingsInterface
>
?
bindings
,
List
<
BindingsInterface
>
bindings
=
const
[]
,
bool
preventDuplicates
=
true
,
bool
?
popGesture
,
bool
showCupertinoParallax
=
true
,
...
...
@@ -47,7 +47,7 @@ mixin IGetNavigation {
int
?
id
,
String
?
routeName
,
dynamic
arguments
,
List
<
BindingsInterface
>
?
bindings
,
List
<
BindingsInterface
>
bindings
=
const
[]
,
bool
fullscreenDialog
=
false
,
Transition
?
transition
,
Curve
?
curve
,
...
...
lib/get_navigation/src/routes/get_route.dart
View file @
b8b33e4
...
...
@@ -20,7 +20,7 @@ class GetPage<T> extends Page<T> {
final
bool
opaque
;
final
double
Function
(
BuildContext
context
)?
gestureWidth
;
//final BindingsInterface? binding;
final
List
<
BindingsInterface
>
?
bindings
;
final
List
<
BindingsInterface
>
bindings
;
final
List
<
Bind
>
binds
;
final
CustomTransition
?
customTransition
;
final
Duration
?
transitionDuration
;
...
...
@@ -75,17 +75,19 @@ class GetPage<T> extends Page<T> {
this
.
preventDuplicateHandlingMode
=
PreventDuplicateHandlingMode
.
ReorderRoutes
,
this
.
completer
,
LocalKey
?
key
,
})
:
path
=
_nameToRegex
(
name
),
assert
(
name
.
startsWith
(
'/'
),
'It is necessary to start route name [
$name
] with a slash: /
$name
'
),
super
(
key:
ValueKey
(
name
),
key:
key
??
ValueKey
(
name
),
name:
name
,
// arguments: Get.arguments,
);
// settings = RouteSettings(name: name, arguments: Get.arguments);
GetPage
<
T
>
copy
({
LocalKey
?
key
,
String
?
name
,
GetPageBuilder
?
page
,
bool
?
popGesture
,
...
...
@@ -114,6 +116,7 @@ class GetPage<T> extends Page<T> {
Completer
<
T
?>?
completer
,
})
{
return
GetPage
(
key:
key
??
this
.
key
,
participatesInRootNavigator:
participatesInRootNavigator
??
this
.
participatesInRootNavigator
,
preventDuplicates:
preventDuplicates
??
this
.
preventDuplicates
,
...
...
lib/get_navigation/src/routes/get_router_delegate.dart
View file @
b8b33e4
...
...
@@ -7,6 +7,7 @@ import '../../../get_instance/src/bindings_interface.dart';
import
'../../../get_state_manager/src/simple/list_notifier.dart'
;
import
'../../../get_utils/src/platform/platform.dart'
;
import
'../../../route_manager.dart'
;
import
'parse_route.dart'
;
/// Enables the user to customize the intended pop behavior
///
...
...
@@ -350,7 +351,7 @@ class GetDelegate extends RouterDelegate<RouteDecoder>
String
?
routeName
,
bool
fullscreenDialog
=
false
,
dynamic
arguments
,
List
<
BindingsInterface
>
?
bindings
,
List
<
BindingsInterface
>
bindings
=
const
[]
,
bool
preventDuplicates
=
true
,
bool
?
popGesture
,
bool
showCupertinoParallax
=
true
,
...
...
@@ -401,7 +402,7 @@ class GetDelegate extends RouterDelegate<RouteDecoder>
String
?
routeName
,
bool
fullscreenDialog
=
false
,
dynamic
arguments
,
List
<
BindingsInterface
>
?
bindings
,
List
<
BindingsInterface
>
bindings
=
const
[]
,
bool
preventDuplicates
=
true
,
bool
?
popGesture
,
bool
showCupertinoParallax
=
true
,
...
...
@@ -435,7 +436,7 @@ class GetDelegate extends RouterDelegate<RouteDecoder>
int
?
id
,
String
?
routeName
,
dynamic
arguments
,
List
<
BindingsInterface
>
?
bindings
,
List
<
BindingsInterface
>
bindings
=
const
[]
,
bool
fullscreenDialog
=
false
,
Transition
?
transition
,
Curve
?
curve
,
...
...
@@ -701,6 +702,7 @@ class GetDelegate extends RouterDelegate<RouteDecoder>
completer:
_activePages
.
isEmpty
?
null
:
Completer
(),
arguments:
arguments
,
parameters:
parameters
,
key:
ValueKey
(
arguments
.
name
),
);
return
decoder
;
...
...
lib/get_navigation/src/routes/get_transition_mixin.dart
View file @
b8b33e4
...
...
@@ -7,7 +7,6 @@ import 'package:flutter/gestures.dart';
import
'package:flutter/material.dart'
;
import
'../../../get.dart'
;
import
'default_transitions.dart'
;
const
double
_kBackGestureWidth
=
20.0
;
const
int
_kMaxDroppedSwipePageForwardAnimationTime
=
...
...
lib/get_navigation/src/routes/index.dart
View file @
b8b33e4
...
...
@@ -11,7 +11,7 @@ export 'get_transition_mixin.dart';
export
'modules.dart'
;
export
'observers/route_observer.dart'
;
export
'page_settings.dart'
;
export
'parse_route.dart'
;
export
'parse_route.dart'
hide
FirstWhereOrNullExt
;
export
'route_middleware.dart'
;
export
'route_report.dart'
;
export
'router_outlet.dart'
;
...
...
lib/get_navigation/src/routes/router_outlet.dart
View file @
b8b33e4
...
...
@@ -79,7 +79,8 @@ class _RouterOutletState<TDelegate extends RouterDelegate<T>, T extends Object>
}
}
// class _RouterOutletState<TDelegate extends RouterDelegate<T>, T extends Object>
// class _RouterOutletState<TDelegate extends RouterDelegate<T>,
//T extends Object>
// extends State<RouterOutlet<TDelegate, T>> {
// TDelegate get delegate => context.delegate as TDelegate;
// @override
...
...
lib/get_state_manager/src/rx_flutter/rx_notifier.dart
View file @
b8b33e4
...
...
@@ -64,6 +64,22 @@ mixin StateMixin<T> on ListNotifier {
refresh
();
}
@protected
void
change
(
T
newState
,
{
GetStatus
<
T
>?
status
})
{
var
_canUpdate
=
false
;
if
(
status
!=
null
)
{
_status
=
status
;
_canUpdate
=
true
;
}
if
(
newState
!=
_value
)
{
_value
=
newState
;
_canUpdate
=
true
;
}
if
(
_canUpdate
)
{
refresh
();
}
}
void
futurize
(
Future
<
T
>
Function
()
body
(),
{
String
?
errorMessage
,
bool
useEmpty
=
true
})
{
final
compute
=
body
();
...
...
@@ -89,8 +105,9 @@ class GetListenable<T> extends ListNotifierSingle implements RxInterface<T> {
StreamController
<
T
>
get
subject
{
if
(
_controller
==
null
)
{
_controller
=
StreamController
<
T
>.
broadcast
();
addListener
(
_streamListener
);
_controller
=
StreamController
<
T
>.
broadcast
(
onCancel:
addListener
(
_streamListener
));
_controller
?.
add
(
_value
);
///TODO: report to controller dispose
}
...
...
lib/get_state_manager/src/simple/get_controllers.dart
View file @
b8b33e4
...
...
@@ -80,7 +80,8 @@ abstract class RxController with GetLifeCycleMixin {}
/// A recommended way to use Getx with Future fetching
abstract
class
StateController
<
T
>
extends
GetxController
with
StateMixin
<
T
>
{}
/// A controller with super lifecycles (including native lifecycles) and StateMixins
/// A controller with super lifecycles (including native lifecycles)
/// and StateMixins
abstract
class
SuperController
<
T
>
extends
FullLifeCycleController
with
FullLifeCycleMixin
,
StateMixin
<
T
>
{}
...
...
lib/get_state_manager/src/simple/get_state.dart
View file @
b8b33e4
...
...
@@ -114,7 +114,7 @@ abstract class Bind<T> extends StatelessWidget {
final
Widget
?
child
;
static
Bind
put
<
S
extends
GetxController
>(
S
dependency
,
static
Bind
put
<
S
>(
S
dependency
,
{
String
?
tag
,
bool
permanent
=
false
,
InstanceBuilderCallback
<
S
>?
builder
})
{
...
...
@@ -137,10 +137,8 @@ abstract class Bind<T> extends StatelessWidget {
);
}
static
Bind
create
<
S
extends
GetxController
>(
InstanceBuilderCallback
<
S
>
builder
,
{
String
?
tag
,
bool
permanent
=
true
})
{
static
Bind
create
<
S
>(
InstanceBuilderCallback
<
S
>
builder
,
{
String
?
tag
,
bool
permanent
=
true
})
{
Get
.
create
<
S
>(
builder
,
tag:
tag
,
permanent:
permanent
);
return
_FactoryBind
<
S
>(
tag:
tag
,
...
...
@@ -581,4 +579,4 @@ class BindError<T> extends Error {
/// instance of Bindings to manage the
/// dependencies() (via Get.put()) for the Route you are opening.
// ignore: one_member_abstracts
abstract
class
Binding
extends
BindingsInterface
<
Iterable
<
Bind
>>
{}
abstract
class
Binding
extends
BindingsInterface
<
List
<
Bind
>>
{}
...
...
lib/get_utils/src/extensions/export.dart
View file @
b8b33e4
...
...
@@ -3,7 +3,7 @@ export 'double_extensions.dart';
export
'duration_extensions.dart'
;
export
'dynamic_extensions.dart'
;
export
'event_loop_extensions.dart'
;
export
'internacionalization.dart'
;
export
'internacionalization.dart'
hide
FirstWhereExt
;
export
'iterable_extensions.dart'
;
export
'num_extensions.dart'
;
export
'string_extensions.dart'
;
...
...
pubspec.yaml
View file @
b8b33e4
name
:
get
description
:
Open screens/snackbars/dialogs without context, manage states and inject dependencies easily with GetX.
version
:
5.0.0-beta.1
5
version
:
5.0.0-beta.1
8
homepage
:
https://github.com/jonataslaw/getx
environment
:
...
...
test/benchmarks/benckmark_test.dart
View file @
b8b33e4
...
...
@@ -85,7 +85,8 @@ Future<int> stream() {
// if (times == v) {
// timer.stop();
// print(
// """$v listeners notified | [GET_STREAM] time: ${timer.elapsedMicroseconds}ms""");
// """$v listeners notified |
// [GET_STREAM] time: ${timer.elapsedMicroseconds}ms""");
// c.complete(timer.elapsedMicroseconds);
// }
// });
...
...
test/navigation/get_main_test.dart
View file @
b8b33e4
...
...
@@ -342,28 +342,28 @@ void main() {
expect
(
find
.
byType
(
SecondScreen
),
findsNothing
);
});
// testWidgets(
// "Get.offNamedUntil leaves previous routes that match provided predicate",
// (tester) async {
// await tester.pumpWidget(WrapperNamed(
// initialRoute: '/first',
// namedRoutes: [
// GetPage(page: () => FirstScreen(), name: '/first'),
// GetPage(page: () => SecondScreen(), name: '/second'),
// GetPage(page: () => ThirdScreen(), name: '/third'),
// ],
// ));
// Get.toNamed('/second');
// await tester.pumpAndSettle();
// Get.offNamedUntil('/third', (route) => route.name == '/first');
// await tester.pumpAndSettle();
// Get.back();
// await tester.pumpAndSettle();
// expect(find.byType(FirstScreen), findsOneWidget);
// });
testWidgets
(
"Get.offNamedUntil leaves previous routes that match provided predicate"
,
(
tester
)
async
{
await
tester
.
pumpWidget
(
WrapperNamed
(
initialRoute:
'/first'
,
namedRoutes:
[
GetPage
(
page:
()
=>
FirstScreen
(),
name:
'/first'
),
GetPage
(
page:
()
=>
SecondScreen
(),
name:
'/second'
),
GetPage
(
page:
()
=>
ThirdScreen
(),
name:
'/third'
),
],
));
Get
.
toNamed
(
'/second'
);
await
tester
.
pumpAndSettle
();
Get
.
offNamedUntil
(
'/third'
,
(
route
)
=>
route
.
name
==
'/first'
);
await
tester
.
pumpAndSettle
();
Get
.
back
();
await
tester
.
pumpAndSettle
();
expect
(
find
.
byType
(
FirstScreen
),
findsOneWidget
);
});
testWidgets
(
"Get.back navigates back"
,
(
tester
)
async
{
await
tester
.
pumpWidget
(
...
...
Please
register
or
login
to post a comment