html_view 0.0.3 copy "html_view: ^0.0.3" to clipboard
html_view: ^0.0.3 copied to clipboard

rendering .html file on Web Platform.

example/html_view_example.dart

import 'dart:async';

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

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

class HtmlViewExample extends StatefulWidget {
  HtmlViewExample({Key? key}) : super(key: key);

  @override
  State<HtmlViewExample> createState() => _HtmlViewExampleState();
}

class _HtmlViewExampleState extends State<HtmlViewExample> {
  final HtmlView htmlView = HtmlView();
  final String viewID = "viewId";
  late final StreamSubscription subscription;

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

  initListener() {
    subscription = htmlView.listen((event) async {
      print(event);
    });
  }

  @override
  void dispose() {
    subscription.cancel();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    htmlView.initView(
      viewID,
      styleWidth: "100px",
      styleHeight: "500px",
      width: "100px",
      height: "500px",
      src: 'screen/index.html',
    );
    return SizedBox(
      height: 500,
      child: HtmlElementView(
        viewType: viewID,
      ),
    );
  }
}
copied to clipboard
0
likes
130
points
41
downloads

Publisher

unverified uploader

Weekly Downloads

2024.09.26 - 2025.04.10

rendering .html file on Web Platform.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on html_view