Skip to content

Commit

Permalink
Refactor and removed deprecated methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Aniketkhote committed May 14, 2024
1 parent 414785e commit 6da6d50
Show file tree
Hide file tree
Showing 44 changed files with 134 additions and 166 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
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
5 changes: 2 additions & 3 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
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
14 changes: 5 additions & 9 deletions lib/get_navigation/src/routes/get_transition_mixin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ const int _kMaxPageBackAnimationTime = 300; // Milliseconds.

class GetBackGestureDetector<T> extends StatefulWidget {
const GetBackGestureDetector({
Key? key,
super.key,
required this.limitedSwipe,
required this.gestureWidth,
required this.initialOffset,
required this.popGestureEnable,
required this.onStartPopGesture,
required this.child,
}) : super(key: key);
});

final bool limitedSwipe;
final double gestureWidth;
Expand Down Expand Up @@ -370,8 +370,7 @@ Cannot read the previousTitle for a route that has not yet been installed''',
// In the middle of a back gesture drag, let the transition be linear to
// match finger motions.
final route = rawRoute as GetPageRoute<T>;
final linearTransition =
CupertinoRouteTransitionMixin.isPopGestureInProgress(route);
final linearTransition = route.popGestureInProgress;
final finalCurve = route.curve ?? Get.defaultTransitionCurve;
final hasCurve = route.curve != null;
if (route.fullscreenDialog && route.transition == null) {
Expand Down Expand Up @@ -777,9 +776,6 @@ Cannot read the previousTitle for a route that has not yet been installed''',
// would be really confusing (or would skip internal routes),
// so disallow it.
if (route.willHandlePopInternally) return false;
// If attempts to dismiss this route might be vetoed such as in a page
// with forms, then do not allow the user to dismiss the route with a swipe.
if (route.hasScopedWillPopCallback) return false;
// support [PopScope]
if (route.popDisposition == RoutePopDisposition.doNotPop) return false;
// Fullscreen dialogs aren't dismissible by back swipe.
Expand Down Expand Up @@ -826,8 +822,8 @@ class _DirectionalityDragGestureRecognizer
required this.isLTR,
required this.popGestureEnable,
required this.hasbackGestureController,
Object? debugOwner,
}) : super(debugOwner: debugOwner);
super.debugOwner,
});

@override
void handleEvent(PointerEvent event) {
Expand Down
2 changes: 1 addition & 1 deletion lib/get_navigation/src/routes/modules.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class Dependencies {
}

abstract class Module extends StatefulWidget {
const Module({Key? key}) : super(key: key);
const Module({super.key});

Widget view(BuildContext context);

Expand Down
2 changes: 1 addition & 1 deletion lib/get_navigation/src/routes/route_report.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import '../router_report.dart';
import 'default_route.dart';

class RouteReport extends StatefulWidget {
const RouteReport({Key? key, required this.builder}) : super(key: key);
const RouteReport({super.key, required this.builder});
final WidgetBuilder builder;

@override
Expand Down
Loading

0 comments on commit 6da6d50

Please sign in to comment.