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

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
120
pub points
80%
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

Documentation

API reference

License

Apache-2.0 (LICENSE)

Dependencies

flutter

More

Packages that depend on asset_webview