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

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(new MyApp());

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

  void _launchURL(BuildContext context) async {
    try {
      await launch(
        'https://flutter.io/',
        option: new CustomTabsOption(
          toolbarColor: Theme.of(context).primaryColor,
          enableDefaultShare: true,
          enableUrlBarHiding: true,
          showPageTitle: true,
          animation: new CustomTabsAnimation.slideIn(),
          extraCustomTabs: <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());
    }
  }
}
232
likes
0
pub points
98%
popularity

Publisher

unverified uploader

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

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, url_launcher

More

Packages that depend on flutter_custom_tabs