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

A Flutter package to easily display web content from a given URL with built-in internet connectivity checks and error handling.

example/lib/main.dart

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

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

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Simple WebView Example',
      theme: ThemeData(useMaterial3: true, colorSchemeSeed: Colors.blue),
      home: const HomePage(),
    );
  }
}

class HomePage extends StatelessWidget {
  const HomePage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Simple WebView Example')),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            ElevatedButton.icon(
              onPressed: () {
                Navigator.push(
                  context,
                  MaterialPageRoute(
                    builder: (context) => const SimpleWebViewScaffold(
                      url: 'https://flutter.dev',
                      title: 'Flutter Official Site',
                    ),
                  ),
                );
              },
              icon: const Icon(Icons.web),
              label: const Text('Open Flutter.dev'),
            ),
            const SizedBox(height: 20),
            ElevatedButton.icon(
              onPressed: () {
                Navigator.push(
                  context,
                  MaterialPageRoute(
                    builder: (context) => const SimpleWebViewScaffold(
                      url: 'https://google.com',
                      title: 'Google Search',
                      showAppBar: true,
                      appBarColor: Colors.blueAccent,
                      accentColor: Colors.orange,
                    ),
                  ),
                );
              },
              icon: const Icon(Icons.search),
              label: const Text('Open Google with Custom Theme'),
            ),
            const SizedBox(height: 20),
            ElevatedButton.icon(
              onPressed: () {
                Navigator.push(
                  context,
                  MaterialPageRoute(
                    builder: (context) => SimpleWebViewScaffold(
                      url: 'https://pub.dev',
                      title: 'Pub.dev (Cookies Example)',
                      initialCookies: [
                        Cookie('test_cookie', 'hello_world')
                          ..domain = 'pub.dev'
                          ..path = '/',
                      ],
                    ),
                  ),
                );
              },
              icon: const Icon(Icons.cookie),
              label: const Text('Open Pub.dev with Initial Cookies'),
            ),
          ],
        ),
      ),
    );
  }
}
5
likes
135
points
244
downloads

Publisher

verified publisherrahulreza.com

Weekly Downloads

A Flutter package to easily display web content from a given URL with built-in internet connectivity checks and error handling.

Homepage

Documentation

API reference

License

MIT (license)

Dependencies

appcare_flutter, dio, file_picker, flutter, http, mime, path_provider, permission_handler, url_launcher, webview_cookie_manager, webview_flutter, webview_flutter_android, webview_flutter_wkwebview

More

Packages that depend on flutter_simple_webview