bir zamanlar ufakça yazıp kenara atmışım işinize yarar
main.dart
import 'package:flutter/material.dart';import 'package:flutter_webview_plugin/flutter_webview_plugin.dart';import 'custom-web-view.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget { // This widget is the root of your application. @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', theme: ThemeData( primarySwatch: Colors.blue, ), home: MyHomePage(), ); }}
class MyHomePage extends StatelessWidget {
@override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: Text('Enes Şahin'), backgroundColor: Colors.blueGrey, ), drawer: Drawer( child: ListView( children: <Widget>[ DrawerHeader( padding: EdgeInsets.all(0), child: Container( padding: EdgeInsets.all(20), color: Colors.blueGrey, child: Row( crossAxisAlignment: CrossAxisAlignment.end, children: <Widget>[ Text('Enes Şahin'), ], ), ), ), ListTile(leading: Icon(Icons.home), title: Text('Home'), ), ], ), ), body: Center( child: WebviewScaffold(url: "https://sahinenes.com/", withZoom: true, withJavascript: true, withLocalStorage: false, ),),
);
}}custom-web-view.dar
import 'package:flutter/material.dart';import 'package:flutter_webview_plugin/flutter_webview_plugin.dart';
class MyCustomWebview extends StatelessWidget { final String url; final String title;
MyCustomWebview({@required this.url, @required this.title});
@override Widget build(BuildContext context) { return Scaffold(
body: Center( child: WebviewScaffold(url: url, appBar: AppBar(title: Text('Flutter Webview'),), withZoom: true, withJavascript: true, withLocalStorage: false, ),),
); }}pubsec.yaml e bunu eklemeyi unutmayın
sdk: flutter
flutter_webview_plugin: