setting to show link open prompt
This commit is contained in:
@@ -54,6 +54,10 @@ part of 'routes.dart';
|
||||
name: 'TabTreeRoute',
|
||||
path: 'tab_tree/:rootTabId',
|
||||
),
|
||||
TypedGoRoute<OpenSharedContentRoute>(
|
||||
name: 'OpenSharedContentRoute',
|
||||
path: 'open_content',
|
||||
),
|
||||
],
|
||||
)
|
||||
class BrowserRoute extends GoRouteData with _$BrowserRoute {
|
||||
@@ -75,9 +79,12 @@ class SearchRoute extends GoRouteData with _$SearchRoute {
|
||||
//This should be nullable but isnt allowed by go_router
|
||||
final String searchText;
|
||||
|
||||
final bool $extra;
|
||||
|
||||
const SearchRoute({
|
||||
required this.tabType,
|
||||
this.searchText = SearchRoute.emptySearchText,
|
||||
this.$extra = false,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -87,6 +94,7 @@ class SearchRoute extends GoRouteData with _$SearchRoute {
|
||||
initialSearchText: (searchText.isEmpty || searchText == emptySearchText)
|
||||
? null
|
||||
: searchText,
|
||||
launchedFromIntent: $extra,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -159,3 +167,14 @@ class TabTreeRoute extends GoRouteData with _$TabTreeRoute {
|
||||
return DialogPage(builder: (_) => TabTreeDialog(rootTabId));
|
||||
}
|
||||
}
|
||||
|
||||
class OpenSharedContentRoute extends GoRouteData with _$OpenSharedContentRoute {
|
||||
final Uri $extra;
|
||||
|
||||
const OpenSharedContentRoute(this.$extra);
|
||||
|
||||
@override
|
||||
Page<void> buildPage(BuildContext context, GoRouterState state) {
|
||||
return DialogPage(builder: (_) => OpenSharedContent(sharedUrl: $extra));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import 'package:weblibre/features/about/presentation/screens/about.dart';
|
||||
import 'package:weblibre/features/bangs/presentation/screens/categories.dart';
|
||||
import 'package:weblibre/features/bangs/presentation/screens/list.dart';
|
||||
import 'package:weblibre/features/bangs/presentation/screens/search.dart';
|
||||
import 'package:weblibre/features/geckoview/features/browser/presentation/dialogs/open_shared_content.dart';
|
||||
import 'package:weblibre/features/geckoview/features/browser/presentation/dialogs/tab_tree.dart';
|
||||
import 'package:weblibre/features/geckoview/features/browser/presentation/screens/browser.dart';
|
||||
import 'package:weblibre/features/geckoview/features/contextmenu/extensions/hit_result.dart';
|
||||
|
||||
@@ -333,6 +333,12 @@ RouteBase get $browserRoute => GoRouteData.$route(
|
||||
|
||||
factory: _$TabTreeRoute._fromState,
|
||||
),
|
||||
GoRouteData.$route(
|
||||
path: 'open_content',
|
||||
name: 'OpenSharedContentRoute',
|
||||
|
||||
factory: _$OpenSharedContentRoute._fromState,
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
@@ -361,6 +367,7 @@ mixin _$SearchRoute on GoRouteData {
|
||||
tabType: _$TabTypeEnumMap._$fromName(state.pathParameters['tabType']!)!,
|
||||
searchText:
|
||||
state.pathParameters['searchText'] ?? SearchRoute.emptySearchText,
|
||||
$extra: state.extra as bool,
|
||||
);
|
||||
|
||||
SearchRoute get _self => this as SearchRoute;
|
||||
@@ -371,17 +378,19 @@ mixin _$SearchRoute on GoRouteData {
|
||||
);
|
||||
|
||||
@override
|
||||
void go(BuildContext context) => context.go(location);
|
||||
void go(BuildContext context) => context.go(location, extra: _self.$extra);
|
||||
|
||||
@override
|
||||
Future<T?> push<T>(BuildContext context) => context.push<T>(location);
|
||||
Future<T?> push<T>(BuildContext context) =>
|
||||
context.push<T>(location, extra: _self.$extra);
|
||||
|
||||
@override
|
||||
void pushReplacement(BuildContext context) =>
|
||||
context.pushReplacement(location);
|
||||
context.pushReplacement(location, extra: _self.$extra);
|
||||
|
||||
@override
|
||||
void replace(BuildContext context) => context.replace(location);
|
||||
void replace(BuildContext context) =>
|
||||
context.replace(location, extra: _self.$extra);
|
||||
}
|
||||
|
||||
const _$TabTypeEnumMap = {
|
||||
@@ -552,6 +561,31 @@ mixin _$TabTreeRoute on GoRouteData {
|
||||
void replace(BuildContext context) => context.replace(location);
|
||||
}
|
||||
|
||||
mixin _$OpenSharedContentRoute on GoRouteData {
|
||||
static OpenSharedContentRoute _fromState(GoRouterState state) =>
|
||||
OpenSharedContentRoute(state.extra as Uri);
|
||||
|
||||
OpenSharedContentRoute get _self => this as OpenSharedContentRoute;
|
||||
|
||||
@override
|
||||
String get location => GoRouteData.$location('/open_content');
|
||||
|
||||
@override
|
||||
void go(BuildContext context) => context.go(location, extra: _self.$extra);
|
||||
|
||||
@override
|
||||
Future<T?> push<T>(BuildContext context) =>
|
||||
context.push<T>(location, extra: _self.$extra);
|
||||
|
||||
@override
|
||||
void pushReplacement(BuildContext context) =>
|
||||
context.pushReplacement(location, extra: _self.$extra);
|
||||
|
||||
@override
|
||||
void replace(BuildContext context) =>
|
||||
context.replace(location, extra: _self.$extra);
|
||||
}
|
||||
|
||||
extension<T extends Enum> on Map<T, String> {
|
||||
T? _$fromName(String? value) =>
|
||||
entries.where((element) => element.value == value).firstOrNull?.key;
|
||||
|
||||
Reference in New Issue
Block a user