mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-09 07:28:14 -07:00
fix: Custom tabs not opening default browser (#419)
This commit is contained in:
commit
df28964749
1 changed files with 29 additions and 9 deletions
|
|
@ -54,21 +54,41 @@ Future<void> launchUrl(BuildContext context, String link) async {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
|
final mediaQuery = MediaQuery.of(context);
|
||||||
|
final theme = Theme.of(context);
|
||||||
await customtab.launchUrl(
|
await customtab.launchUrl(
|
||||||
Uri.parse(link),
|
Uri.parse(link),
|
||||||
customTabsOptions: customtab.CustomTabsOptions(
|
customTabsOptions: customtab.CustomTabsOptions.partial(
|
||||||
colorSchemes: customtab.CustomTabsColorSchemes.defaults(
|
configuration: customtab.PartialCustomTabsConfiguration.adaptiveSheet(
|
||||||
toolbarColor: Theme.of(context).primaryColor,
|
initialHeight: mediaQuery.size.height * 0.7,
|
||||||
|
initialWidth: mediaQuery.size.width * 0.4,
|
||||||
|
activitySideSheetMaximizationEnabled: true,
|
||||||
|
activitySideSheetDecorationType: customtab.CustomTabsActivitySideSheetDecorationType.shadow,
|
||||||
|
activitySideSheetRoundedCornersPosition: customtab.CustomTabsActivitySideSheetRoundedCornersPosition.top,
|
||||||
|
cornerRadius: 16,
|
||||||
|
),
|
||||||
|
colorSchemes: customtab.CustomTabsColorSchemes.defaults(
|
||||||
|
toolbarColor: Theme.of(context).colorScheme.primary,
|
||||||
|
navigationBarColor: Theme.of(context).colorScheme.primary,
|
||||||
),
|
),
|
||||||
urlBarHidingEnabled: true,
|
|
||||||
shareState: customtab.CustomTabsShareState.browserDefault,
|
shareState: customtab.CustomTabsShareState.browserDefault,
|
||||||
showTitle: true,
|
showTitle: true,
|
||||||
|
browser: const customtab.CustomTabsBrowserConfiguration(
|
||||||
|
prefersDefaultBrowser: true,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
safariVCOptions: customtab.SafariViewControllerOptions(
|
safariVCOptions: customtab.SafariViewControllerOptions.pageSheet(
|
||||||
preferredBarTintColor: Theme.of(context).primaryColor,
|
configuration: const customtab.SheetPresentationControllerConfiguration(
|
||||||
preferredControlTintColor: Colors.white,
|
detents: {
|
||||||
barCollapsingEnabled: true,
|
customtab.SheetPresentationControllerDetent.large,
|
||||||
entersReaderIfAvailable: false,
|
customtab.SheetPresentationControllerDetent.medium,
|
||||||
|
},
|
||||||
|
prefersScrollingExpandsWhenScrolledToEdge: true,
|
||||||
|
prefersGrabberVisible: true,
|
||||||
|
prefersEdgeAttachedInCompactHeight: true,
|
||||||
|
),
|
||||||
|
preferredBarTintColor: theme.colorScheme.surface,
|
||||||
|
preferredControlTintColor: theme.colorScheme.onSurface,
|
||||||
dismissButtonStyle: customtab.SafariViewControllerDismissButtonStyle.close,
|
dismissButtonStyle: customtab.SafariViewControllerDismissButtonStyle.close,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue