launchWithCustomAnimation2 method

Future<void> launchWithCustomAnimation2({
  1. required String url,
})

Implementation

Future<void> launchWithCustomAnimation2({ required String url}) async {
  final theme = Theme.of(Get.context!);
  try {
    await launchUrl(
      Uri.parse(url),
      // Android Custom Tabs config
      customTabsOptions: CustomTabsOptions(
        urlBarHidingEnabled: true,
        instantAppsEnabled: false,
        showTitle: false,
        browser: const CustomTabsBrowserConfiguration(
          prefersDefaultBrowser: false,
        ),
        colorSchemes: CustomTabsColorSchemes.defaults(
          toolbarColor: theme.colorScheme.surface,
        ),
        animations: CustomTabsSystemAnimations.fade(),
      ),
      // iOS Safari View Controller config
      safariVCOptions: SafariViewControllerOptions(
        barCollapsingEnabled: true,
        entersReaderIfAvailable: false,
        preferredBarTintColor: theme.colorScheme.surface,
        preferredControlTintColor: theme.colorScheme.onSurface,
        modalPresentationStyle: ViewControllerModalPresentationStyle.automatic,
        dismissButtonStyle: SafariViewControllerDismissButtonStyle.close,
      ),
    );
  } catch (e) {
    debugPrint(e.toString());
  }
}