flutter_web_browser 0.14.0 copy "flutter_web_browser: ^0.14.0" to clipboard
flutter_web_browser: ^0.14.0 copied to clipboard

outdated

A flutter plugin project to open a web page with Chrome Custom Tabs & SFSafariViewController.

example/lib/main.dart

import 'dart:io';

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

void main() {
  runApp(new MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => new _MyAppState();
}

class _MyAppState extends State<MyApp> {
  openBrowserTab() async {
    await FlutterWebBrowser.openWebPage(url: "https://flutter.io/");
  }

  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(
          title: new Text('Plugin example app'),
        ),
        body: new Center(
          child: Column(
            mainAxisSize: MainAxisSize.min,
            children: <Widget>[
              RaisedButton(
                onPressed: () => FlutterWebBrowser.warmup(),
                child: new Text('Warmup browser website'),
              ),
              RaisedButton(
                onPressed: () => openBrowserTab(),
                child: new Text('Open Flutter website'),
              ),
              if (Platform.isAndroid) ...[
                Text('test Android customizations'),
                RaisedButton(
                  onPressed: () {
                    FlutterWebBrowser.openWebPage(
                      url: "https://flutter.io/",
                      customTabsOptions: CustomTabsOptions(
                        colorScheme: CustomTabsColorScheme.dark,
                        toolbarColor: Colors.deepPurple,
                        secondaryToolbarColor: Colors.green,
                        navigationBarColor: Colors.amber,
                        addDefaultShareMenuItem: true,
                        instantAppsEnabled: true,
                        showTitle: true,
                        urlBarHidingEnabled: true,
                      ),
                    );
                  },
                  child: Text('Open Flutter website'),
                ),
              ],
              if (Platform.isIOS) ...[
                Text('test iOS customizations'),
                RaisedButton(
                  onPressed: () {
                    FlutterWebBrowser.openWebPage(
                      url: "https://flutter.io/",
                      safariVCOptions: SafariViewControllerOptions(
                        barCollapsingEnabled: true,
                        preferredBarTintColor: Colors.green,
                        preferredControlTintColor: Colors.amber,
                        dismissButtonStyle: SafariViewControllerDismissButtonStyle.close,
                        modalPresentationCapturesStatusBarAppearance: true,
                      ),
                    );
                  },
                  child: Text('Open Flutter website'),
                ),
              ]
            ],
          ),
        ),
      ),
    );
  }
}
89
likes
0
pub points
97%
popularity

Publisher

unverified uploader

A flutter plugin project to open a web page with Chrome Custom Tabs & SFSafariViewController.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on flutter_web_browser