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-11-29 12:17:01 -0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c2578d365fdeb463ad01313bdfb94281a253e073
c2578d36
1 parent
851616c4
update to 3.20.1
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
106 additions
and
23 deletions
CHANGELOG.md
example/lib/pages/home/presentation/views/country_view.dart
example/lib/pages/home/presentation/views/home_view.dart
example/lib/routes/app_pages.dart
lib/get_navigation/src/root/parse_route.dart
lib/get_navigation/src/routes/default_route.dart
lib/get_rx/src/rx_types/rx_core/rx_impl.dart
pubspec.yaml
test/navigation/dispose_dependencies_test.dart
test/navigation/middleware_test.dart
CHANGELOG.md
View file @
c2578d3
## [3.20.1]
*
Fix wrong reference with unnamed routes and added more tests
## [3.20.0] - Big update
*
Added GetConnect.
-
GetConnect is an easy way to communicate from your back to your front. With it you can:
...
...
example/lib/pages/home/presentation/views/country_view.dart
View file @
c2578d3
...
...
@@ -34,7 +34,8 @@ class CountryView extends GetView<HomeController> {
final
country
=
controller
.
state
.
countries
[
index
];
return
ListTile
(
onTap:
()
{
Get
.
toNamed
(
'/details'
,
arguments:
country
);
Get
.
toNamed
(
'/home/country/details'
,
arguments:
country
);
},
trailing:
CircleAvatar
(
backgroundImage:
NetworkImage
(
...
...
example/lib/pages/home/presentation/views/home_view.dart
View file @
c2578d3
...
...
@@ -68,7 +68,7 @@ class HomeView extends GetView<HomeController> {
),
shape:
StadiumBorder
(),
onPressed:
()
{
Get
.
toNamed
(
'/country'
);
Get
.
toNamed
(
'/
home/
country'
);
},
child:
Text
(
"Fetch by country"
,
...
...
example/lib/routes/app_pages.dart
View file @
c2578d3
...
...
@@ -13,17 +13,20 @@ class AppPages {
static
final
routes
=
[
GetPage
(
name:
Routes
.
HOME
,
page:
()
=>
HomeView
(),
binding:
HomeBinding
(),
),
GetPage
(
name:
Routes
.
COUNTRY
,
page:
()
=>
CountryView
(),
),
GetPage
(
name:
Routes
.
DETAILS
,
page:
()
=>
DetailsView
(),
),
name:
Routes
.
HOME
,
page:
()
=>
HomeView
(),
binding:
HomeBinding
(),
children:
[
GetPage
(
name:
Routes
.
COUNTRY
,
page:
()
=>
CountryView
(),
children:
[
GetPage
(
name:
Routes
.
DETAILS
,
page:
()
=>
DetailsView
(),
),
],
),
]),
];
}
...
...
lib/get_navigation/src/root/parse_route.dart
View file @
c2578d3
import
'package:flutter/widgets.dart'
;
import
'
package:get/get
.dart'
;
import
'
../../get_navigation
.dart'
;
import
'../routes/get_route.dart'
;
class
ParseRouteTree
{
...
...
lib/get_navigation/src/routes/default_route.dart
View file @
c2578d3
...
...
@@ -116,8 +116,8 @@ class GetPageRoute<T> extends PageRoute<T> {
Animation
<
double
>
animation
,
Animation
<
double
>
secondaryAnimation
,
)
{
// Get.reference = settings.name ?? routeName;
// Get.reference = settings.name ?? routeName;
Get
.
reference
=
reference
;
final
middlewareRunner
=
MiddlewareRunner
(
middlewares
);
final
bindingsToBind
=
middlewareRunner
.
runOnBindingsStart
(
bindings
);
...
...
@@ -396,7 +396,6 @@ class GetPageRoute<T> extends PageRoute<T> {
final
middlewareRunner
=
MiddlewareRunner
(
middlewares
);
middlewareRunner
.
runOnPageDispose
();
}
}
...
...
lib/get_rx/src/rx_types/rx_core/rx_impl.dart
View file @
c2578d3
...
...
@@ -234,10 +234,14 @@ class RxString extends _RxImpl<String> {
class
Rx
<
T
>
extends
_RxImpl
<
T
>
{
Rx
([
T
initial
])
:
super
(
initial
);
// TODO: Look for a way to throw the Exception with proper details when the
// value [T] doesn't implement toJson().
@override
dynamic
toJson
()
=>
(
value
as
dynamic
)?.
toJson
();
dynamic
toJson
()
{
try
{
return
(
value
as
dynamic
)?.
toJson
();
}
on
Exception
catch
(
_
)
{
throw
'
$T
has not method [toJson]'
;
}
}
}
extension
StringExtension
on
String
{
...
...
pubspec.yaml
View file @
c2578d3
name
:
get
description
:
Open screens/snackbars/dialogs/bottomSheets without context, manage states and inject dependencies easily with GetX.
version
:
3.20.
0
version
:
3.20.
1
homepage
:
https://github.com/jonataslaw/getx
environment
:
...
...
test/navigation/dispose_dependencies_test.dart
0 → 100644
View file @
c2578d3
import
'package:flutter/widgets.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:get/get.dart'
;
import
'utils/wrapper.dart'
;
void
main
(
)
{
testWidgets
(
"Test dispose dependencies with unnamed routes"
,
(
tester
)
async
{
await
tester
.
pumpWidget
(
Wrapper
(
child:
Container
()),
);
expect
(
Get
.
isRegistered
<
Controller2
>(),
false
);
expect
(
Get
.
isRegistered
<
Controller
>(),
false
);
Get
.
to
(
First
());
await
tester
.
pumpAndSettle
();
expect
(
find
.
byType
(
First
),
findsOneWidget
);
expect
(
Get
.
isRegistered
<
Controller
>(),
true
);
Get
.
to
(
Second
());
await
tester
.
pumpAndSettle
();
expect
(
find
.
byType
(
Second
),
findsOneWidget
);
expect
(
Get
.
isRegistered
<
Controller
>(),
true
);
expect
(
Get
.
isRegistered
<
Controller2
>(),
true
);
Get
.
back
();
await
tester
.
pumpAndSettle
();
expect
(
find
.
byType
(
First
),
findsOneWidget
);
expect
(
Get
.
isRegistered
<
Controller
>(),
true
);
expect
(
Get
.
isRegistered
<
Controller2
>(),
false
);
Get
.
back
();
await
tester
.
pumpAndSettle
();
expect
(
Get
.
isRegistered
<
Controller
>(),
false
);
expect
(
Get
.
isRegistered
<
Controller2
>(),
false
);
});
}
class
Controller
extends
GetxController
{}
class
Controller2
extends
GetxController
{}
class
First
extends
StatelessWidget
{
@override
Widget
build
(
BuildContext
context
)
{
Get
.
put
(
Controller
());
return
Center
(
child:
Text
(
"first"
),
);
}
}
class
Second
extends
StatelessWidget
{
@override
Widget
build
(
BuildContext
context
)
{
Get
.
put
(
Controller2
());
return
Center
(
child:
Text
(
"second"
),
);
}
}
...
...
test/navigation/middleware_test.dart
View file @
c2578d3
...
...
@@ -9,7 +9,7 @@ class RedirectMiddleware extends GetMiddleware {
RouteSettings
redirect
(
String
route
)
=>
RouteSettings
(
name:
'/second'
);
}
main
()
{
void
main
(
)
{
testWidgets
(
"Middleware redirect smoke test"
,
(
tester
)
async
{
await
tester
.
pumpWidget
(
GetMaterialApp
(
...
...
Please
register
or
login
to post a comment