launchUrlInBottomSheet method
Future<void>
launchUrlInBottomSheet(
)
Implementation
Future<void> launchUrlInBottomSheet() async {
final theme = Theme.of(Get.context!);
final mediaQuery = MediaQuery.of(Get.context!);
try {
await launchUrl(
Uri.parse('https://flutter.dev'),
customTabsOptions: CustomTabsOptions.partial(
configuration: PartialCustomTabsConfiguration(
initialHeight: mediaQuery.size.height * 0.7,
),
colorSchemes: CustomTabsColorSchemes.defaults(
colorScheme: theme.brightness.toColorScheme(),
toolbarColor: theme.colorScheme.primary,
),
showTitle: true,
),
safariVCOptions: SafariViewControllerOptions.pageSheet(
configuration: const SheetPresentationControllerConfiguration(
detents: {
SheetPresentationControllerDetent.large,
SheetPresentationControllerDetent.medium,
},
prefersScrollingExpandsWhenScrolledToEdge: true,
prefersGrabberVisible: true,
prefersEdgeAttachedInCompactHeight: true,
preferredCornerRadius: 16.0,
),
preferredBarTintColor: theme.colorScheme.primary,
preferredControlTintColor: theme.colorScheme.onPrimary,
entersReaderIfAvailable: true,
dismissButtonStyle: SafariViewControllerDismissButtonStyle.close,
),
);
} catch (e) {
debugPrint(e.toString());
}
}