jonataslaw / getx

Open screens/snackbars/dialogs/bottomSheets without context, manage states and inject dependencies easily with Get.
MIT License
10.42k stars 1.63k forks source link

GetPage PreventDuplicateHandlingMode is reset to default when used in navigator2 (Getx5) #3261

Open linpengteng opened 4 days ago

linpengteng commented 4 days ago

Describe the bug GetPage PreventDuplicateHandlingMode is defined but has no effect when used in Naviger2, still uses the default PreventDuplicateHandlingMode.reorderRoutes

Reproduction code When using Get.toNamed, one of the APIs (_configureRouterDecoder) uses copyWith of GetPage, causing PreventDuplicateHandlingMode to be lost

  // no PreventDuplicateHandlingMode
  GetPage<T> copyWith({
    LocalKey? key,
    String? name,
    GetPageBuilder? page,
    bool? popGesture,
    Map<String, String>? parameters,
    String? title,
    Transition? transition,
    Curve? curve,
    Alignment? alignment,
    bool? maintainState,
    bool? opaque,
    List<BindingsInterface>? bindings,
    BindingsInterface? binding,
    List<Bind>? binds,
    CustomTransition? customTransition,
    Duration? transitionDuration,
    Duration? reverseTransitionDuration,
    bool? fullscreenDialog,
    RouteSettings? settings,
    List<GetPage<T>>? children,
    GetPage? unknownRoute,
    List<GetMiddleware>? middlewares,
    bool? preventDuplicates,
    final double Function(BuildContext context)? gestureWidth,
    bool? participatesInRootNavigator,
    Object? arguments,
    bool? showCupertinoParallax,
    Completer<T?>? completer,
    bool? inheritParentPath,
    bool? canPop,
    PopInvokedWithResultCallback<T>? onPopInvoked,
    String? restorationId,
  })

To Reproduce None

Expected behavior Allow GetPage PreventDuplicateHandlingMode to be customized and used in navigator2

Screenshots

image

Flutter Version: Flutter 3.24.5 • channel stable • https://github.com/flutter/flutter.git Framework • revision dec2ee5c1f (8 days ago) • 2024-11-13 11:13:06 -0800 Engine • revision a18df97ca5 Tools • Dart 3.5.4 • DevTools 2.37.3

Getx Version: ^5.0.0-release-candidate-9.2.1

Describe on which device you found the bug: ex: IPhone 12 mini

Minimal reproduce code None