flutter_custom_tabs 0.7.0 copy "flutter_custom_tabs: ^0.7.0" to clipboard
flutter_custom_tabs: ^0.7.0 copied to clipboard

PlatformAndroidiOS
outdated

Flutter plugin for seamlessly displaying web content using Chrome Custom Tabs.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_custom_tabs/flutter_custom_tabs.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    final theme = Theme.of(context);
    return MaterialApp(
      title: 'Flutter Custom Tabs Example',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Flutter Custom Tabs Example'),
        ),
        body: Center(
          child: TextButton(
            onPressed: () => _launchURL(context),
            child: Text(
              'Show Flutter homepage',
              style: TextStyle(
                fontSize: 17,
                color: theme.primaryColor,
              ),
            ),
          ),
        ),
      ),
    );
  }

  Future<void> _launchURL(BuildContext context) async {
    try {
      await launch(
        'https://flutter.dev',
        option: CustomTabsOption(
          toolbarColor: Theme.of(context).primaryColor,
          enableDefaultShare: true,
          enableUrlBarHiding: true,
          showPageTitle: true,
          animation: CustomTabsAnimation.slideIn(),
          extraCustomTabs: const <String>[
            // ref. https://play.google.com/store/apps/details?id=org.mozilla.firefox
            'org.mozilla.firefox',
            // ref. https://play.google.com/store/apps/details?id=com.microsoft.emmx
            'com.microsoft.emmx',
          ],
        ),
      );
    } catch (e) {
      // An exception is thrown if browser app is not installed on Android device.
      debugPrint(e.toString());
    }
  }
}
245
likes
150
points
164k
downloads

Publisher

unverified uploader

Weekly Downloads

Flutter plugin for seamlessly displaying web content using Chrome Custom Tabs.

Repository (GitHub)

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

flutter, meta, url_launcher

More

Packages that depend on flutter_custom_tabs