chai_webview_plugin 0.0.2 copy "chai_webview_plugin: ^0.0.2" to clipboard
chai_webview_plugin: ^0.0.2 copied to clipboard

flutter webview plugin

example/lib/main.dart

import 'package:chai_webview_plugin_example/webview_opener.dart';
import 'package:flutter/material.dart';
import 'dart:async';

import 'package:flutter/services.dart';
import 'package:chai_webview_plugin/chai_webview_plugin.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'ChaiWebviewPluginDemo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget{

  @override
  _MyHomePageState createState() => _MyHomePageState();

}

class _MyHomePageState extends State<MyHomePage> {
  String _platformVersion = 'Unknown';

  @override
  void initState() {
    super.initState();
    initPlatformState();
  }

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {
    String platformVersion;
    // Platform messages may fail, so we use a try/catch PlatformException.
    try {
      platformVersion = await ChaiWebviewPlugin.platformVersion;
    } on PlatformException {
      platformVersion = 'Failed to get platform version.';
    }

    // If the widget was removed from the tree while the asynchronous platform
    // message was in flight, we want to discard the reply rather than calling
    // setState to update our non-existent appearance.
    if (!mounted) return;

    setState(() {
      _platformVersion = platformVersion;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('ChaiWebview example app'),
      ),
      body: Center(
        child: Text('Running on: $_platformVersion\n'),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: (){
          openWebView(context, 'https://www7.lunapic.com/editor/?action=crop');
        },
        tooltip: 'open test website',
        child: Icon(Icons.add),
      ),
    );
  }
}
0
likes
20
pub points
0%
popularity

Publisher

unverified uploader

flutter webview plugin

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on chai_webview_plugin