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

A new flutter plugin project.

example/lib/main.dart

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

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

class DemoApp extends StatefulWidget {
  @override
  DemoAppState createState() => new DemoAppState();
}

class DemoAppState extends State<DemoApp> {
  String text = '';

  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: 'Pdf View Plugin Demo',
      home: new Scaffold(
          appBar: new AppBar(
            title: const Text('Pdf View Plugin Demo'),
          ),
          body: new Padding(
            padding: const EdgeInsets.all(24.0),
            child: new Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: <Widget>[
                new TextField(
                  decoration: const InputDecoration(
                    labelText: 'Text:',
                    hintText: 'Enter some text',
                  ),
                  maxLines: 4,
                  onChanged: (String value) => setState(() {
                    text = value;
                  }),
                ),
                new RaisedButton(
                  child: const Text('PDF View'),
                  onPressed: text.isNotEmpty
                      ? () {
                    pdfview(text);
                  }
                      : null,
                ),
                new RaisedButton(
                  child: const Text('HTML PDF View'),
                  onPressed: () {
                    pdfview("""<h1>Title</h1><table border=1><tr><td>Table</td><td>Test</td></tr>
                    <tr><td>
                    <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/5/53/Wikipedia-logo-en-big.png/196px-Wikipedia-logo-en-big.png"/>
                    </td></tr>
                    </table>""");
                  },
                ),
              ],
            ),
          )),
    );
  }
}
0
likes
15
pub points
0%
popularity

Publisher

unverified uploader

A new flutter plugin project.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on flutter_html2pdf_viewer