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
2021-07-20 07:12:14 -0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
34af865bf9dae4583a43ed7b014493b09e9b4c61
34af865b
1 parent
78e8fac2
fix stream error, add better error catch to GetX widget, fix error agent on web error
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
93 additions
and
12 deletions
example_nav2/lib/app/modules/home/views/home_view.dart
lib/get_connect/connect.dart
lib/get_connect/http/src/http.dart
lib/get_instance/src/get_instance.dart
lib/get_navigation/src/extension_navigation.dart
lib/get_rx/src/rx_stream/get_stream.dart
lib/get_state_manager/src/rx_flutter/rx_getx_widget.dart
lib/get_state_manager/src/rx_flutter/rx_obx_widget.dart
lib/get_utils/src/extensions/context_extensions.dart
example_nav2/lib/app/modules/home/views/home_view.dart
View file @
34af865
...
...
@@ -21,10 +21,6 @@ class HomeView extends GetView<HomeController> {
return
Scaffold
(
body:
GetRouterOutlet
(
initialRoute:
Routes
.
DASHBOARD
,
// name: Routes.HOME,
//It's preferable to use emptyPage instead of emptyWidget
// emptyPage: (delegate) =>
// Get.routeTree.matchRoute(Routes.DASHBOARD).route!,
),
bottomNavigationBar:
BottomNavigationBar
(
currentIndex:
currentIndex
,
...
...
lib/get_connect/connect.dart
View file @
34af865
...
...
@@ -33,6 +33,7 @@ abstract class GetConnectInterface with GetLifeCycleBase {
Map
<
String
,
dynamic
>?
query
,
Decoder
<
T
>?
decoder
,
});
Future
<
Response
<
T
>>
post
<
T
>(
String
url
,
dynamic
body
,
{
...
...
@@ -95,6 +96,7 @@ class GetConnect extends GetConnectInterface {
this
.
timeout
=
const
Duration
(
seconds:
5
),
this
.
followRedirects
=
true
,
this
.
maxRedirects
=
5
,
this
.
sendUserAgent
=
false
,
this
.
maxAuthRetries
=
1
,
this
.
allowAutoSignedCert
=
false
,
this
.
withCredentials
=
false
,
...
...
@@ -104,6 +106,7 @@ class GetConnect extends GetConnectInterface {
bool
allowAutoSignedCert
;
String
userAgent
;
bool
sendUserAgent
;
String
?
baseUrl
;
String
defaultContentType
=
'application/json; charset=utf-8'
;
bool
followRedirects
;
...
...
@@ -122,6 +125,7 @@ class GetConnect extends GetConnectInterface {
@override
GetHttpClient
get
httpClient
=>
_httpClient
??=
GetHttpClient
(
userAgent:
userAgent
,
sendUserAgent:
sendUserAgent
,
timeout:
timeout
,
followRedirects:
followRedirects
,
maxRedirects:
maxRedirects
,
...
...
lib/get_connect/http/src/http.dart
View file @
34af865
...
...
@@ -27,6 +27,8 @@ class GetHttpClient {
int
maxRedirects
;
int
maxAuthRetries
;
bool
sendUserAgent
;
Decoder
?
defaultDecoder
;
Duration
timeout
;
...
...
@@ -42,6 +44,7 @@ class GetHttpClient {
this
.
timeout
=
const
Duration
(
seconds:
8
),
this
.
followRedirects
=
true
,
this
.
maxRedirects
=
5
,
this
.
sendUserAgent
=
false
,
this
.
maxAuthRetries
=
1
,
bool
allowAutoSignedCert
=
false
,
this
.
baseUrl
,
...
...
@@ -98,7 +101,9 @@ class GetHttpClient {
Stream
<
List
<
int
>>?
bodyStream
;
final
headers
=
<
String
,
String
>{};
headers
[
'user-agent'
]
=
userAgent
;
if
(
sendUserAgent
)
{
headers
[
'user-agent'
]
=
userAgent
;
}
if
(
body
is
FormData
)
{
bodyBytes
=
await
body
.
toBytes
();
...
...
lib/get_instance/src/get_instance.dart
View file @
34af865
...
...
@@ -240,7 +240,6 @@ class GetInstance {
}
for
(
final
element
in
keysToRemove
)
{
print
(
'reload
$element
'
);
reload
(
key:
element
);
//_routesKey.remove(element);
}
...
...
lib/get_navigation/src/extension_navigation.dart
View file @
34af865
...
...
@@ -205,6 +205,52 @@ extension ExtensionSnackbar on GetInterface {
}
}
extension
OverlayExt
on
GetInterface
{
Future
<
T
>
showOverlay
<
T
>({
required
Future
<
T
>
Function
()
asyncFunction
,
Color
opacityColor
=
Colors
.
black
,
Widget
?
loadingWidget
,
double
opacity
=
.
5
,
})
async
{
final
navigatorState
=
Navigator
.
of
(
Get
.
overlayContext
!,
rootNavigator:
false
);
final
overlayState
=
navigatorState
.
overlay
!;
final
overlayEntryOpacity
=
OverlayEntry
(
builder:
(
context
)
{
return
Opacity
(
opacity:
opacity
,
child:
Container
(
color:
opacityColor
,
));
});
final
overlayEntryLoader
=
OverlayEntry
(
builder:
(
context
)
{
return
loadingWidget
??
Center
(
child:
Container
(
height:
90
,
width:
90
,
child:
Text
(
'Loading...'
),
));
});
overlayState
.
insert
(
overlayEntryOpacity
);
overlayState
.
insert
(
overlayEntryLoader
);
T
data
;
try
{
data
=
await
asyncFunction
();
}
on
Exception
catch
(
_
)
{
overlayEntryLoader
.
remove
();
overlayEntryOpacity
.
remove
();
rethrow
;
}
overlayEntryLoader
.
remove
();
overlayEntryOpacity
.
remove
();
return
data
;
}
}
extension
ExtensionDialog
on
GetInterface
{
/// Show a dialog.
/// You can pass a [transitionDuration] and/or [transitionCurve],
...
...
lib/get_rx/src/rx_stream/get_stream.dart
View file @
34af865
...
...
@@ -62,7 +62,7 @@ class GetStream<T> {
item
.
_onError
?.
call
(
error
);
}
if
(
item
.
cancelOnError
!
)
{
if
(
item
.
cancelOnError
??
false
)
{
//item.cancel?.call();
itemsToRemove
.
add
(
item
);
item
.
pause
();
...
...
lib/get_state_manager/src/rx_flutter/rx_getx_widget.dart
View file @
34af865
import
'dart:async'
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/widgets.dart'
;
import
'../../../get_core/get_core.dart'
;
...
...
@@ -41,6 +42,18 @@ class GetX<T extends DisposableInterface> extends StatefulWidget {
});
@override
void
debugFillProperties
(
DiagnosticPropertiesBuilder
properties
)
{
super
.
debugFillProperties
(
properties
);
properties
..
add
(
DiagnosticsProperty
<
T
>(
'controller'
,
init
),
)
..
add
(
DiagnosticsProperty
<
String
>(
'tag'
,
tag
))
..
add
(
ObjectFlagProperty
<
GetXControllerBuilder
<
T
>>.
has
(
'builder'
,
builder
));
}
@override
GetXState
<
T
>
createState
()
=>
GetXState
<
T
>();
}
...
...
@@ -107,6 +120,12 @@ class GetXState<T extends DisposableInterface> extends State<GetX<T>> {
}
@override
void
debugFillProperties
(
DiagnosticPropertiesBuilder
properties
)
{
super
.
debugFillProperties
(
properties
);
properties
.
add
(
DiagnosticsProperty
<
T
>(
'controller'
,
controller
));
}
@override
Widget
build
(
BuildContext
context
)
=>
RxInterface
.
notifyChildren
(
_observer
,
()
=>
widget
.
builder
(
controller
!),
...
...
lib/get_state_manager/src/rx_flutter/rx_obx_widget.dart
View file @
34af865
import
'dart:async'
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/widgets.dart'
;
import
'../../../get_rx/src/rx_types/rx_types.dart'
;
...
...
@@ -13,6 +14,12 @@ abstract class ObxWidget extends StatefulWidget {
const
ObxWidget
({
Key
?
key
})
:
super
(
key:
key
);
@override
void
debugFillProperties
(
DiagnosticPropertiesBuilder
properties
)
{
super
.
debugFillProperties
(
properties
);
properties
..
add
(
ObjectFlagProperty
<
Function
>.
has
(
'builder'
,
build
));
}
@override
_ObxState
createState
()
=>
_ObxState
();
@protected
...
...
lib/get_utils/src/extensions/context_extensions.dart
View file @
34af865
...
...
@@ -119,7 +119,7 @@ extension ContextExtensionss on BuildContext {
/// and less than 1200 return [tablet] value.
/// if the device width is less than 300 return [watch] value.
/// in other cases return [mobile] value.
T
?
responsiveValue
<
T
>({
T
responsiveValue
<
T
>({
T
?
mobile
,
T
?
tablet
,
T
?
desktop
,
...
...
@@ -129,9 +129,14 @@ extension ContextExtensionss on BuildContext {
if
(
GetPlatform
.
isDesktop
)
{
deviceWidth
=
mediaQuerySize
.
width
;
}
if
(
deviceWidth
>=
1200
&&
desktop
!=
null
)
return
desktop
;
if
(
deviceWidth
>=
600
&&
tablet
!=
null
)
return
tablet
;
if
(
deviceWidth
<
300
&&
watch
!=
null
)
return
watch
;
return
mobile
;
if
(
deviceWidth
>=
1200
&&
desktop
!=
null
)
{
return
desktop
;
}
else
if
(
deviceWidth
>=
600
&&
tablet
!=
null
)
{
return
tablet
;
}
else
if
(
deviceWidth
<
300
&&
watch
!=
null
)
{
return
watch
;
}
else
{
return
mobile
!;
}
}
}
...
...
Please
register
or
login
to post a comment