Webview in Flutter Example 4
Webview in Flutter Example 4
Ecco Suprastyo
4. Create or select the parent directory for the new project folder.
You must use flutter webview container for custom widget, create
file with name web_view_container.dart like below :
import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';class
WebViewContainer extends StatefulWidget {
final url; WebViewContainer(this.url); @override
createState() => _WebViewContainerState(this.url);
}class _WebViewContainerState extends State<WebViewContainer> {
var _url;
final _key = UniqueKey(); _WebViewContainerState(this._url);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(),
body: Column(
children: [
Expanded(
child: WebView(
key: _key,
javascriptMode: JavascriptMode.unrestricted,
initialUrl: _url))
],
));
}
}
4. Create or select the parent directory for the new project folder.
After the new project is created, create the database file in the
directory application that was created. (e.g
[projectname]/data/[databasename].db.
dev_dependencies:
flutter_test:
sdk: flutter
# For information on the generic Dart part of this file, see the
# following page: https://www.dartlang.org/tools/pub/pubspec# The
following section is specific to Flutter.
flutter: # The following line ensures that the Material Icons font
is
# included with your application, so that you can use the icons
in
# the material Icons class.
uses-material-design: true
assets:
- data/flutter.db
# To add assets to your application, add an assets section, like
this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg # An image asset can refer to one or
more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware. # For
details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages # To add
custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have
a
# "family" key with the font family name, and a "fonts" key with
a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages
List<Fruits> list =
res.isNotEmpty ? res.map((c) => Fruits.fromMap(c)).toList()
: null; return list;
}
}