asset_webview 0.0.4 copy "asset_webview: ^0.0.4" to clipboard
asset_webview: ^0.0.4 copied to clipboard

outdated

A Flutter plug-in providing a native web view that loads Flutter assets. Useful for embdding HTML content in your application, for example to display help content.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:asset_webview/asset_webview.dart';
import 'package:asset_webview/asset_webview_controller.dart';

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

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

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      navigatorKey: _navigatorKey,
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Example Usage of asset_webview'),
        ),
        body: SafeArea(
            child: Column(children: [
          Expanded(
              child: AssetWebview(
                  initialUrl: 'asset://local/help/index.html',
                  controller:
                      NavigationAssetWebviewController(_currentContext)))
        ])),
      ),
      routes: {"about": (context) => AboutPage()},
    );
  }
}

class AboutPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('About asset_webview'),
      ),
      body: SafeArea(child: Center(child: Text("Sample about page."))),
    );
  }
}

BuildContext _currentContext() => _navigatorKey.currentContext!;
final _navigatorKey = GlobalKey<NavigatorState>();
16
likes
0
pub points
78%
popularity

Publisher

verified publishergreensopinion.com

A Flutter plug-in providing a native web view that loads Flutter assets. Useful for embdding HTML content in your application, for example to display help content.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on asset_webview