A Flutter plugin to use Chrome Custom Tabs.

Overview

flutter_custom_tabs

pub package Build Status

A Flutter plugin to use Chrome Custom Tabs.

screenshot

Custom Tabs is supported only Chrome for Android. For this reason, the interface is same, but behavior is following:

  • Android
    If Chrome is installed, open web URL in custom tab that you have customized some of look & feel. If it is not installed, open in other browser.
  • iOS
    Open SFSafariViewController using url_launcher, and all options at launch are ignored.

Getting Started

Add flutter_custom_tabs to the dependencies of your pubspec.yaml.

dependencies:
  flutter_custom_tabs: "^0.4.0"

Usage

Open the web URL like url_launcher.

Example

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      theme: new ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: new Scaffold(
        body: new Center(
          child: new FlatButton(
            child: new Text('Show Flutter homepage'),
            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()
          // or user defined animation.
          animation: new CustomTabsAnimation(
            startEnter: 'slide_up',
            startExit: 'android:anim/fade_out',
            endEnter: 'android:anim/fade_in',
            endExit: 'slide_down',
          ),
          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());
    }
  }
}

License

Copyright (C) 2015 The Android Open Source Project
Copyright (C) 2018 Shinya Kumagai

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
You might also like...

The Drawer Manager class has the ability to swap Scaffold body contents, using a custom provider

The Drawer Manager class has the ability to swap Scaffold body contents, using a custom provider

The Drawer Manager class has the ability to swap Scaffold body contents, using a custom provider. Open Drawer Hello, Flutter! Counter The MAC All Page

Mar 18, 2022

DoneIt is a sample note app πŸ“ Flutter application πŸ“± built to demonstrate use of Clean Architecture tools. Dedicated to all Flutter Developers with ❀️.

DoneIt is a sample note app πŸ“ Flutter application πŸ“± built to demonstrate use of Clean Architecture tools. Dedicated to all Flutter Developers with ❀️.

DoneIt πŸ“ DoneIt is a sample note app πŸ“ Flutter application πŸ“± built to demonstrate use of Clean Architecture tools. Dedicated to all Flutter Develop

Dec 24, 2022

Expenses tracker built with Flutter and Dart making use of Provider, Intl, Syncfusion Flutter Datepicker and more

expense_app A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if t

Dec 10, 2022

A simple easy to use Flutter DApp , which keeps a track of all your day to day transactions by using Ethereum blockchain in the background which in turn increases your credit score.

A simple easy to use Flutter DApp , which keeps a track of all your day to day transactions by using Ethereum blockchain in the background which in turn increases your credit score.

Sahayog A simple easy to use Flutter DApp , which keeps a track of all your day to day transactions by using Ethereum blockchain in the background whi

May 21, 2022

An flutter package to use DevIcons https://devicon.dev/

An flutter package to use DevIcons https://devicon.dev/

dev_icons This flutter package allows you to use all the Dev Icons. You can view the icons catalog on devicon.dev Installation In the dependencies: se

Oct 9, 2022

A weather app built to learn how to use Canvas and Animation in Flutter.

A weather app built to learn how to use Canvas and Animation in Flutter.

Weather Quick Disclaimer I removed my private OpenWeather API key from the repo, if you want to get the weather forecast use your own in the openweath

Dec 21, 2022

A set of real world timelines to showcase the use of timeline_tile package, built with Flutter.

A set of real world timelines to showcase the use of timeline_tile package, built with Flutter.

beatiful_timelines Beautiful timelines built with Flutter and timeline_tile. Current examples: Timeline Showcase Football Timeline Activity Timeline S

Dec 21, 2022

Windows95 UI components for Flutter apps. Bring back the nostalgic look and feel of old operating systems with this set of UI components ready to use.

Windows95 UI components for Flutter apps. Bring back the nostalgic look and feel of old operating systems with this set of UI components ready to use.

Flutter95 Windows95 UI components for Flutter apps. UNDER CONSTRUCTION Screenshots Components Scaffold95 Scaffold as a Windows95 styled window. Provid

Jan 2, 2023

A new Flutter Application to control self build lamps for my personal use.

A new Flutter Application to control self build lamps for my personal use.

A new Flutter Application to control self build lamps for my personal use. You need extra hardware & software for getting this project running. This is just the code of the App.

Mar 2, 2022
Owner
Sarbagya Dhaubanjar
Senior Software Engineer at @khalti
Sarbagya Dhaubanjar
Custom Gesture Detector for Flutter. Empower your users with custom gestures.

Gestures Custom Gesture Detector for Flutter. Empower your users with custom gestures. How to use In your pubspec.yaml: dependencies: gestures: ^1.0

AndrΓ© Baltazar 11 Nov 4, 2022
Flutter plugin to use ContentProvider/ContentResolver APIs on Android

android_content_provider This plugin exposes ContentProvider and related ContentResolver APIs on Android. Android 11 package visibility Android 11 int

null 9 Oct 28, 2022
QR.Flutter is a Flutter library for simple and fast QR code rendering via a Widget or custom painter.

QR.Flutter is a Flutter library for simple and fast QR code rendering via a Widget or custom painter. Need help? Please do not submit an issue for a "

Yakka 612 Jan 4, 2023
A Flutter package for show custom in-app notification.

?? in_app_notification A Flutter package to show custom in-app notification with any Widgets. ✍️ Usage Import it. dependencies: in_app_notificatio

CBcloud 18 Oct 27, 2022
A Flutter package for building custom skeleton widgets to mimic the page's layout while loading.

Skeletons A Flutter package for building custom skeleton widgets to mimic the page's layout while loading. Examples Items ListView (Default) ListView

Moh Badjah 46 Dec 17, 2022
A Flutter package with custom implementation of Drawer

Flutter Zoom Drawer A Flutter package with custom implementation of the Side Menu (Drawer) Getting Started To start using this package, add flutter_zo

null 335 Dec 22, 2022
A chatting app made with Flutter and FireBase. It supports GIPHY gifs, images, stcikers, dark mode, custom animations, google login, online storage, beautiful UI and more.

ChatMe A Flutter based chatting app which lets user chat from random peoples or strangers, has GIPHY gif support, sitckers, custom animations, dark mo

Hash Studios 20 Nov 7, 2022
Simple markdown editor. with custom keyboard helper for making bold, italic, list, URL, photoURL, etc

Flutter Markdown Editor A simple markdown creator/editor application, developer with flutter. special auxiliary keyboard features (for develop markdow

Ismael Shakverdiev 36 Dec 15, 2022
Custom bottom navigation bar with diamond icon in the middle.

Pub.dev Scaled List Custom bottom navigation bar with diamond icon in the middle you can customize the number of items either be Five or three. Usage

Hosain Mohamed 4 Dec 21, 2022
tmodinstaller - A beautiful mod installer for minecraft supporting custom repositories and more

tmodinstaller A beautiful mod installer for minecraft supporting custom repositories and more. TMod Installer is a cross platform mod installer and up

Tricked 16 Aug 28, 2022