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-08-01 14:32:04 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
fc3cef490edfcb9b27acc19ec5aefafff153b58c
fc3cef49
1 parent
fc3c6d6d
fix transitions
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
64 additions
and
32 deletions
example/lib/pages/home/presentation/controllers/home_controller.dart
example_nav2/ios/Flutter/Generated.xcconfig
example_nav2/ios/Flutter/flutter_export_environment.sh
example_nav2/ios/Runner/Info.plist
example_nav2/lib/app/routes/app_pages.dart
lib/get_navigation/src/routes/get_router_delegate.dart
lib/get_state_manager/src/rx_flutter/rx_notifier.dart
example/lib/pages/home/presentation/controllers/home_controller.dart
View file @
fc3cef4
...
...
@@ -12,7 +12,7 @@ class HomeController extends StateController<CasesModel> {
void
onInit
()
{
super
.
onInit
();
//Loading, Success, Error handle with 1 line of code
futurize
(
()
=>
homeRepository
.
getCases
);
futurize
(
homeRepository
.
getCases
);
}
Country
getCountryById
(
String
id
)
{
...
...
example_nav2/ios/Flutter/Generated.xcconfig
View file @
fc3cef4
...
...
@@ -2,12 +2,13 @@
FLUTTER_ROOT=/Users/jonatasborges/flutter
FLUTTER_APPLICATION_PATH=/Users/jonatasborges/consertar/getx/example_nav2
COCOAPODS_PARALLEL_CODE_SIGN=true
FLUTTER_TARGET=lib/main.dart
FLUTTER_TARGET=
/Users/jonatasborges/consertar/getx/example_nav2/
lib/main.dart
FLUTTER_BUILD_DIR=build
FLUTTER_BUILD_NAME=1.0.0
FLUTTER_BUILD_NUMBER=1
EXCLUDED_ARCHS[sdk=iphonesimulator*]=i386
DART_DEFINES=RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ==
DART_OBFUSCATION=false
TRACK_WIDGET_CREATION=
fals
e
TRACK_WIDGET_CREATION=
tru
e
TREE_SHAKE_ICONS=false
PACKAGE_CONFIG=.dart_tool/package_config.json
PACKAGE_CONFIG=
/Users/jonatasborges/consertar/getx/example_nav2/
.dart_tool/package_config.json
...
...
example_nav2/ios/Flutter/flutter_export_environment.sh
View file @
fc3cef4
...
...
@@ -3,11 +3,12 @@
export
"FLUTTER_ROOT=/Users/jonatasborges/flutter"
export
"FLUTTER_APPLICATION_PATH=/Users/jonatasborges/consertar/getx/example_nav2"
export
"COCOAPODS_PARALLEL_CODE_SIGN=true"
export
"FLUTTER_TARGET=lib/main.dart"
export
"FLUTTER_TARGET=
/Users/jonatasborges/consertar/getx/example_nav2/
lib/main.dart"
export
"FLUTTER_BUILD_DIR=build"
export
"FLUTTER_BUILD_NAME=1.0.0"
export
"FLUTTER_BUILD_NUMBER=1"
export
"DART_DEFINES=RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ=="
export
"DART_OBFUSCATION=false"
export
"TRACK_WIDGET_CREATION=
fals
e"
export
"TRACK_WIDGET_CREATION=
tru
e"
export
"TREE_SHAKE_ICONS=false"
export
"PACKAGE_CONFIG=.dart_tool/package_config.json"
export
"PACKAGE_CONFIG=
/Users/jonatasborges/consertar/getx/example_nav2/
.dart_tool/package_config.json"
...
...
example_nav2/ios/Runner/Info.plist
View file @
fc3cef4
...
...
@@ -41,5 +41,7 @@
</array>
<key>
UIViewControllerBasedStatusBarAppearance
</key>
<false/>
<key>
CADisableMinimumFrameDurationOnPhone
</key>
<true/>
</dict>
</plist>
...
...
example_nav2/lib/app/routes/app_pages.dart
View file @
fc3cef4
...
...
@@ -73,12 +73,15 @@ class AppPages {
name:
_Paths
.
products
,
page:
()
=>
const
ProductsView
(),
title:
'Products'
,
transition:
Transition
.
zoom
,
transition:
Transition
.
cupertino
,
showCupertinoParallax:
true
,
participatesInRootNavigator:
false
,
bindings:
[
ProductsBinding
()],
children:
[
GetPage
(
name:
_Paths
.
productDetails
,
transition:
Transition
.
cupertino
,
showCupertinoParallax:
true
,
page:
()
=>
ProductDetailsView
(),
bindings:
[
ProductDetailsBinding
()],
middlewares:
[
...
...
lib/get_navigation/src/routes/get_router_delegate.dart
View file @
fc3cef4
...
...
@@ -560,12 +560,6 @@ class GetDelegate extends RouterDelegate<RouteDecoder>
_activePages
.
remove
(
RouteDecoder
.
fromRoute
(
name
));
}
@override
void
back
<
T
>([
T
?
result
])
{
_checkIfCanBack
();
_popWithResult
<
T
>(
result
);
notifyListeners
();
}
bool
get
canBack
{
return
_activePages
.
length
>
1
;
...
...
@@ -799,21 +793,30 @@ class GetDelegate extends RouterDelegate<RouteDecoder>
return
false
;
}
@override
void
back
<
T
>([
T
?
result
])
{
_checkIfCanBack
();
_popWithResult
<
T
>(
result
);
notifyListeners
();
}
bool
_onPopVisualRoute
(
Route
<
dynamic
>
route
,
dynamic
result
)
{
final
didPop
=
route
.
didPop
(
result
);
if
(!
didPop
)
{
return
false
;
}
final
settings
=
route
.
settings
;
if
(
settings
is
GetPage
)
{
final
config
=
_activePages
.
cast
<
RouteDecoder
?>().
firstWhere
(
(
element
)
=>
element
?.
route
==
settings
,
orElse:
()
=>
null
,
);
if
(
config
!=
null
)
{
_removeHistoryEntry
(
config
,
result
);
}
}
_popWithResult
(
result
);
// final settings = route.settings;
// if (settings is GetPage) {
// final config = _activePages.cast<RouteDecoder?>().firstWhere(
// (element) => element?.route == settings,
// orElse: () => null,
// );
// if (config != null) {
// _removeHistoryEntry(config, result);
// }
// }
notifyListeners
();
//return !route.navigator!.userGestureInProgress;
return
true
;
...
...
lib/get_state_manager/src/rx_flutter/rx_notifier.dart
View file @
fc3cef4
...
...
@@ -2,6 +2,7 @@ import 'dart:async';
import
'package:flutter/foundation.dart'
;
import
'package:flutter/material.dart'
;
import
'package:get/utils.dart'
;
import
'../../../get_rx/src/rx_types/rx_types.dart'
;
import
'../../../instance_manager.dart'
;
...
...
@@ -70,9 +71,9 @@ mixin StateMixin<T> on ListNotifier {
}
}
void
futurize
(
Future
<
T
>
Function
()
Function
()
body
,
{
String
?
errorMessage
,
bool
useEmpty
=
true
})
{
final
compute
=
body
();
void
futurize
(
Future
<
T
>
Function
()
body
,
{
T
?
initialData
,
String
?
errorMessage
,
bool
useEmpty
=
true
})
{
final
compute
=
body
;
compute
().
then
((
newValue
)
{
if
((
newValue
==
null
||
newValue
.
_isEmpty
())
&&
useEmpty
)
{
status
=
GetStatus
<
T
>.
loading
();
...
...
@@ -88,6 +89,10 @@ mixin StateMixin<T> on ListNotifier {
}
}
typedef
FuturizeCallback
<
T
>
=
Future
<
T
>
Function
(
VoidCallback
fn
);
typedef
VoidCallback
=
void
Function
();
class
GetListenable
<
T
>
extends
ListNotifierSingle
implements
RxInterface
<
T
>
{
GetListenable
(
T
val
)
:
_value
=
val
;
...
...
@@ -239,28 +244,45 @@ extension StateExt<T> on StateMixin<T> {
typedef
NotifierBuilder
<
T
>
=
Widget
Function
(
T
state
);
abstract
class
GetStatus
<
T
>
{
abstract
class
GetStatus
<
T
>
with
Equality
{
const
GetStatus
();
factory
GetStatus
.
loading
()
=>
LoadingStatus
();
factory
GetStatus
.
error
(
String
message
)
=>
ErrorStatus
(
message
);
factory
GetStatus
.
empty
()
=>
EmptyStatus
();
factory
GetStatus
.
success
(
T
data
)
=>
SuccessStatus
(
data
);
factory
GetStatus
.
custom
()
=>
CustomStatus
();
}
class
CustomStatus
<
T
>
extends
GetStatus
<
T
>
{
@override
List
get
props
=>
[];
}
class
LoadingStatus
<
T
>
extends
GetStatus
<
T
>
{}
class
LoadingStatus
<
T
>
extends
GetStatus
<
T
>
{
@override
List
get
props
=>
[];
}
class
SuccessStatus
<
T
>
extends
GetStatus
<
T
>
{
final
T
data
;
const
SuccessStatus
(
this
.
data
);
SuccessStatus
(
this
.
data
);
@override
List
get
props
=>
[
data
];
}
class
ErrorStatus
<
T
,
S
>
extends
GetStatus
<
T
>
{
final
S
?
error
;
ErrorStatus
([
this
.
error
]);
const
ErrorStatus
([
this
.
error
]);
@override
List
get
props
=>
[
error
];
}
class
EmptyStatus
<
T
>
extends
GetStatus
<
T
>
{}
class
EmptyStatus
<
T
>
extends
GetStatus
<
T
>
{
@override
List
get
props
=>
[];
}
extension
StatusDataExt
<
T
>
on
GetStatus
<
T
>
{
bool
get
isLoading
=>
this
is
LoadingStatus
;
...
...
Please
register
or
login
to post a comment