Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

让全局配置opaqueRoute生效 #3229

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return GetMaterialApp(
opaqueRoute: false,
getPages: [
GetPage(
participatesInRootNavigator: true,
Expand Down Expand Up @@ -132,6 +133,17 @@ class Second extends StatelessWidget {
Widget build(BuildContext context) {
final controller = Get.put(SecondController());
print('second rebuild');
return Container(
child: Column(
children: [
Container(
height: 100,
width: double.infinity,
color: Colors.red,
)
],
),
);
return Scaffold(
appBar: AppBar(
title: Text('page two ${Get.parameters["id"]}'),
Expand Down
1 change: 1 addition & 0 deletions lib/get_navigation/src/root/get_cupertino_app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ class GetCupertinoApp extends StatelessWidget {
Widget build(BuildContext context) {
return GetRoot(
config: ConfigData(
defaultOpaqueRoute: opaqueRoute??true,
backButtonDispatcher: backButtonDispatcher,
binds: binds,
customTransition: customTransition,
Expand Down
1 change: 1 addition & 0 deletions lib/get_navigation/src/root/get_material_app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ class GetMaterialApp extends StatelessWidget {
Widget build(BuildContext context) {
return GetRoot(
config: ConfigData(
defaultOpaqueRoute: opaqueRoute??true,
backButtonDispatcher: backButtonDispatcher,
binds: binds,
customTransition: customTransition,
Expand Down
6 changes: 4 additions & 2 deletions lib/get_navigation/src/routes/default_route.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/cupertino.dart';
import 'package:get/get_navigation/src/root/get_root.dart';

import '../../../get.dart';
import '../router_report.dart';
Expand Down Expand Up @@ -42,7 +43,7 @@ class GetPageRoute<T> extends PageRoute<T>
super.settings,
this.transitionDuration = const Duration(milliseconds: 300),
this.reverseTransitionDuration = const Duration(milliseconds: 300),
this.opaque = true,
this.getOpaque,
this.parameter,
this.gestureWidth,
this.curve,
Expand Down Expand Up @@ -82,8 +83,9 @@ class GetPageRoute<T> extends PageRoute<T>
@override
final bool showCupertinoParallax;

final bool? getOpaque;
@override
final bool opaque;
bool get opaque => getOpaque??Get.defaultOpaqueRoute;
final bool? popGesture;

@override
Expand Down
4 changes: 2 additions & 2 deletions lib/get_navigation/src/routes/get_route.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class GetPage<T> extends Page<T> {
final bool? participatesInRootNavigator;
final Alignment? alignment;
final bool maintainState;
final bool opaque;
final bool? opaque;
final double Function(BuildContext context)? gestureWidth;
final BindingsInterface? binding;
final List<BindingsInterface> bindings;
Expand Down Expand Up @@ -66,7 +66,7 @@ class GetPage<T> extends Page<T> {
this.curve = Curves.linear,
this.alignment,
this.parameters,
this.opaque = true,
this.opaque,
this.transitionDuration,
this.reverseTransitionDuration,
this.popGesture,
Expand Down
2 changes: 1 addition & 1 deletion lib/get_navigation/src/routes/route_middleware.dart
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ class PageRedirect {
curve: r.curve,
showCupertinoParallax: r.showCupertinoParallax,
gestureWidth: r.gestureWidth,
opaque: r.opaque,
getOpaque: r.opaque,
customTransition: r.customTransition,
bindings: r.bindings,
binding: r.binding,
Expand Down