Skip to content

Commit

Permalink
Merge pull request jonataslaw#3095 from Aniketkhote/master
Browse files Browse the repository at this point in the history
  • Loading branch information
jonataslaw authored May 16, 2024
2 parents 414785e + 2c44623 commit 4ac2e3b
Show file tree
Hide file tree
Showing 46 changed files with 150 additions and 178 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
# https://github.com/marketplace/actions/flutter-action
- uses: subosito/flutter-action@v2
with:
flutter-version: "3.19.3"
flutter-version: "3.22.0"
channel: "stable"
- run: flutter pub get
#- run: flutter analyze
Expand Down
4 changes: 2 additions & 2 deletions example_nav2/android/local.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
sdk.dir=/Users/jonatasborges/Library/Android/sdk
flutter.sdk=/Users/jonatasborges/flutter
sdk.dir=C:\\Users\\anike\\AppData\\Local\\Android\\sdk
flutter.sdk=C:\\flutter
13 changes: 8 additions & 5 deletions lib/get_connect/connect.dart
Original file line number Diff line number Diff line change
Expand Up @@ -316,17 +316,20 @@ class GetConnect extends GetConnectInterface {
return GraphQLResponse<T>(
graphQLErrors: listError
.map((e) => GraphQLError(
code: (e['extensions'] != null ? e['extensions']['code'] ?? '' : '').toString(),
code: (e['extensions'] != null
? e['extensions']['code'] ?? ''
: '')
.toString(),
message: (e['message'] ?? '').toString(),
))
.toList());
}
return GraphQLResponse<T>.fromResponse(res);
} on Exception catch (_) {
} on Exception catch (err) {
return GraphQLResponse<T>(graphQLErrors: [
GraphQLError(
code: null,
message: _.toString(),
message: err.toString(),
)
]);
}
Expand Down Expand Up @@ -357,11 +360,11 @@ class GetConnect extends GetConnectInterface {
.toList());
}
return GraphQLResponse<T>.fromResponse(res);
} on Exception catch (_) {
} on Exception catch (err) {
return GraphQLResponse<T>(graphQLErrors: [
GraphQLError(
code: null,
message: _.toString(),
message: err.toString(),
)
]);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/get_connect/http/src/response/response.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import '../status/http_status.dart';
class GraphQLResponse<T> extends Response<T> {
final List<GraphQLError>? graphQLErrors;

GraphQLResponse({T? body, this.graphQLErrors}) : super(body: body);
GraphQLResponse({super.body, this.graphQLErrors});

GraphQLResponse.fromResponse(Response res)
: graphQLErrors = null,
Expand Down
4 changes: 1 addition & 3 deletions lib/get_connect/sockets/sockets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,5 @@ import 'src/sockets_stub.dart'
if (dart.library.io) 'src/sockets_io.dart';

class GetSocket extends BaseWebSocket {
GetSocket(String url,
{Duration ping = const Duration(seconds: 5), bool allowSelfSigned = true})
: super(url, ping: ping, allowSelfSigned: allowSelfSigned);
GetSocket(super.url, {super.ping, super.allowSelfSigned});
}
12 changes: 6 additions & 6 deletions lib/get_navigation/src/bottomsheet/bottomsheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ class GetModalBottomSheetRoute<T> extends PopupRoute<T> {
this.isDismissible = true,
this.enableDrag = true,
required this.isScrollControlled,
RouteSettings? settings,
super.settings,
this.enterBottomSheetDuration = const Duration(milliseconds: 250),
this.exitBottomSheetDuration = const Duration(milliseconds: 200),
this.curve,
}) : super(settings: settings) {
}) {
RouterReportManager.instance.reportCurrentRoute(this);
}
final bool? isPersistent;
Expand Down Expand Up @@ -115,7 +115,7 @@ class GetModalBottomSheetRoute<T> extends PopupRoute<T> {

class _GetModalBottomSheet<T> extends StatefulWidget {
const _GetModalBottomSheet({
Key? key,
super.key,
this.route,
this.backgroundColor,
this.elevation,
Expand All @@ -124,7 +124,7 @@ class _GetModalBottomSheet<T> extends StatefulWidget {
this.isScrollControlled = false,
this.enableDrag = true,
this.isPersistent = false,
}) : super(key: key);
});
final bool isPersistent;
final GetModalBottomSheetRoute<T>? route;
final bool isScrollControlled;
Expand Down Expand Up @@ -214,7 +214,7 @@ class _GetModalBottomSheetState<T> extends State<_GetModalBottomSheet<T>> {

class _GetPerModalBottomSheet<T> extends StatefulWidget {
const _GetPerModalBottomSheet({
Key? key,
super.key,
this.route,
this.isPersistent,
this.backgroundColor,
Expand All @@ -223,7 +223,7 @@ class _GetPerModalBottomSheet<T> extends StatefulWidget {
this.clipBehavior,
this.isScrollControlled = false,
this.enableDrag = true,
}) : super(key: key);
});
final bool? isPersistent;
final GetModalBottomSheetRoute<T>? route;
final bool isScrollControlled;
Expand Down
7 changes: 3 additions & 4 deletions lib/get_navigation/src/dialog/dialog_route.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@ class GetDialogRoute<T> extends PopupRoute<T> {
Color barrierColor = const Color(0x80000000),
Duration transitionDuration = const Duration(milliseconds: 200),
RouteTransitionsBuilder? transitionBuilder,
RouteSettings? settings,
super.settings,
}) : widget = pageBuilder,
_barrierDismissible = barrierDismissible,
_barrierLabel = barrierLabel,
_barrierColor = barrierColor,
_transitionDuration = transitionDuration,
_transitionBuilder = transitionBuilder,
super(settings: settings) {
_transitionBuilder = transitionBuilder {
RouterReportManager.instance.reportCurrentRoute(this);
}

Expand Down Expand Up @@ -68,6 +67,6 @@ class GetDialogRoute<T> extends PopupRoute<T> {
),
child: child);
} // Some default transition
return _transitionBuilder!(context, animation, secondaryAnimation, child);
return _transitionBuilder(context, animation, secondaryAnimation, child);
}
}
10 changes: 5 additions & 5 deletions lib/get_navigation/src/extension_navigation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ extension ExtensionDialog on GetInterface {
List<Widget>? actions,

// onWillPop Scope
WillPopCallback? onWillPop,
PopInvokedCallback? onWillPop,

// the navigator used to push the dialog
GlobalKey<NavigatorState>? navigatorKey,
Expand Down Expand Up @@ -225,7 +225,7 @@ extension ExtensionDialog on GetInterface {
child: Text(
textConfirm ?? "Ok",
style: TextStyle(
color: confirmTextColor ?? theme.colorScheme.background),
color: confirmTextColor ?? theme.colorScheme.surface),
),
onPressed: () {
onConfirm?.call();
Expand Down Expand Up @@ -267,8 +267,8 @@ extension ExtensionDialog on GetInterface {

return dialog<T>(
onWillPop != null
? WillPopScope(
onWillPop: onWillPop,
? PopScope(
onPopInvoked: onWillPop,
child: baseAlertDialog,
)
: baseAlertDialog,
Expand Down Expand Up @@ -1283,7 +1283,7 @@ extension GetNavigationExt on GetInterface {

/// Check if dark mode theme is enable on platform on android Q+
bool get isPlatformDarkMode =>
(ui.window.platformBrightness == Brightness.dark);
(ui.PlatformDispatcher.instance.platformBrightness == Brightness.dark);

/// give access to Theme.of(context).iconTheme.color
Color? get iconColor => theme.iconTheme.color;
Expand Down
10 changes: 4 additions & 6 deletions lib/get_navigation/src/root/get_cupertino_app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class GetCupertinoApp extends StatelessWidget {
final ScrollBehavior? scrollBehavior;

const GetCupertinoApp({
Key? key,
super.key,
this.theme,
this.navigatorKey,
this.home,
Expand Down Expand Up @@ -124,11 +124,10 @@ class GetCupertinoApp extends StatelessWidget {
backButtonDispatcher = null,
routeInformationParser = null,
routerDelegate = null,
routerConfig = null,
super(key: key);
routerConfig = null;

const GetCupertinoApp.router({
Key? key,
super.key,
this.theme,
this.routeInformationProvider,
this.routeInformationParser,
Expand Down Expand Up @@ -183,8 +182,7 @@ class GetCupertinoApp extends StatelessWidget {
onGenerateInitialRoutes = null,
onUnknownRoute = null,
routes = null,
initialRoute = null,
super(key: key);
initialRoute = null;

@override
Widget build(BuildContext context) {
Expand Down
10 changes: 4 additions & 6 deletions lib/get_navigation/src/root/get_material_app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class GetMaterialApp extends StatelessWidget {
final bool useInheritedMediaQuery;

const GetMaterialApp({
Key? key,
super.key,
this.navigatorKey,
this.scaffoldMessengerKey,
this.home,
Expand Down Expand Up @@ -128,11 +128,10 @@ class GetMaterialApp extends StatelessWidget {
backButtonDispatcher = null,
routeInformationParser = null,
routerDelegate = null,
routerConfig = null,
super(key: key);
routerConfig = null;

const GetMaterialApp.router({
Key? key,
super.key,
this.routeInformationProvider,
this.scaffoldMessengerKey,
this.routeInformationParser,
Expand Down Expand Up @@ -190,8 +189,7 @@ class GetMaterialApp extends StatelessWidget {
onGenerateInitialRoutes = null,
onUnknownRoute = null,
routes = null,
initialRoute = null,
super(key: key);
initialRoute = null;

@override
Widget build(BuildContext context) {
Expand Down
4 changes: 2 additions & 2 deletions lib/get_navigation/src/root/get_root.dart
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,10 @@ class ConfigData {

class GetRoot extends StatefulWidget {
const GetRoot({
Key? key,
super.key,
required this.config,
required this.child,
}) : super(key: key);
});
final ConfigData config;
final Widget child;
@override
Expand Down
10 changes: 3 additions & 7 deletions lib/get_navigation/src/routes/default_route.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class GetPageRoute<T> extends PageRoute<T>
/// The [builder], [maintainState], and [fullscreenDialog] arguments must not
/// be null.
GetPageRoute({
RouteSettings? settings,
super.settings,
this.transitionDuration = const Duration(milliseconds: 300),
this.reverseTransitionDuration = const Duration(milliseconds: 300),
this.opaque = true,
Expand All @@ -61,13 +61,9 @@ class GetPageRoute<T> extends PageRoute<T>
this.showCupertinoParallax = true,
this.barrierLabel,
this.maintainState = true,
bool fullscreenDialog = false,
super.fullscreenDialog,
this.middlewares,
}) : bindings = (binding == null) ? bindings : [...bindings, binding],
super(
settings: settings,
fullscreenDialog: fullscreenDialog,
);
}) : bindings = (binding == null) ? bindings : [...bindings, binding];

@override
final Duration transitionDuration;
Expand Down
30 changes: 10 additions & 20 deletions lib/get_navigation/src/routes/get_navigator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,16 @@ import '../../../get.dart';

class GetNavigator extends Navigator {
GetNavigator.onGenerateRoute({
GlobalKey<NavigatorState>? key,
GlobalKey<NavigatorState>? super.key,
bool Function(Route<dynamic>, dynamic)? onPopPage,
required List<GetPage> pages,
required List<GetPage> super.pages,
List<NavigatorObserver>? observers,
bool reportsRouteUpdateToEngine = false,
super.reportsRouteUpdateToEngine,
TransitionDelegate? transitionDelegate,
String? initialRoute,
String? restorationScopeId,
super.initialRoute,
super.restorationScopeId,
}) : super(
//keys should be optional
key: key,
initialRoute: initialRoute,
onPopPage: onPopPage ??
(route, result) {
final didPop = route.didPop(result);
Expand All @@ -36,9 +34,6 @@ class GetNavigator extends Navigator {
}
return null;
},
reportsRouteUpdateToEngine: reportsRouteUpdateToEngine,
restorationScopeId: restorationScopeId,
pages: pages,
observers: [
// GetObserver(),
...?observers,
Expand All @@ -48,18 +43,16 @@ class GetNavigator extends Navigator {
);

GetNavigator({
Key? key,
super.key,
bool Function(Route<dynamic>, dynamic)? onPopPage,
required List<GetPage> pages,
required List<GetPage> super.pages,
List<NavigatorObserver>? observers,
bool reportsRouteUpdateToEngine = false,
super.reportsRouteUpdateToEngine,
TransitionDelegate? transitionDelegate,
String? initialRoute,
String? restorationScopeId,
super.initialRoute,
super.restorationScopeId,
}) : super(
//keys should be optional
key: key,
initialRoute: initialRoute,
onPopPage: onPopPage ??
(route, result) {
final didPop = route.didPop(result);
Expand All @@ -68,9 +61,6 @@ class GetNavigator extends Navigator {
}
return true;
},
reportsRouteUpdateToEngine: reportsRouteUpdateToEngine,
restorationScopeId: restorationScopeId,
pages: pages,
observers: [
// GetObserver(null, Get.routing),
HeroController(),
Expand Down
Loading

0 comments on commit 4ac2e3b

Please sign in to comment.