1-) FLUTTER - webview ileri geri back next favori button
telefon whatsap mail destekli splash screenli indirme linki
https://drive.google.com/file/d/14Jx0FiYWMJTeZvG7KsVE1YW3qqZmHSyx/view?usp=sharing
1 -BASİT WEB VİEW SON HALİ
AndroidManifest.xml e -> android:usesCleartextTraffic="true" ve android:exported="true" eklenir. ve internet izni alınır
<uses-permission android:name="android.permission.INTERNET"/>
<application android:label="RMOS GUEST" android:usesCleartextTraffic="true" ...> <activity android:exported="true" ...>
ios-> Runner -> Info.plist e eğer http ise izin alınır . https ise gerek yok
<key>CFBundleName</key>
<string>RMOS GUEST</string>
...
...
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>guest.rmoscrm.com</key>
<dict>
<!--Include to allow subdomains-->
<key>NSIncludesSubdomains</key>
<true/>
<!--Include to allow HTTP requests-->
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
<!--Include to specify minimum TLS version-->
<key>NSTemporaryExceptionMinimumTLSVersion</key>
<string>TLSv1.1</string>
</dict>
</dict>
</dict>
...
</dict>
</plist>
main.dart
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:webview_flutter/webview_flutter.dart';
import 'dart:async';
void main() => runApp(MaterialApp(
debugShowCheckedModeBanner: false,
routes: {"/": (context) => WikipediaExplorer()},
));
class WikipediaExplorer extends StatefulWidget {
@override
_WikipediaExplorerState createState() => _WikipediaExplorerState();
}
class _WikipediaExplorerState extends State<WikipediaExplorer> {
Completer<WebViewController> _controller = Completer<WebViewController>();
WebViewController webViewController;
Future<bool> _onBack() async {
bool goBack;
var value = await webViewController.canGoBack();
if (value) {
webViewController.goBack();
return false;
} else {
await showDialog(
context: context,
builder: (context) => new AlertDialog(
title: new Text('Onay ', style: TextStyle(color: Colors.purple)),
content: new Text('Uygulamadan çıkılsın mı ? '),
actions: <Widget>[
new ElevatedButton(
onPressed: () {
Navigator.of(context).pop();
setState(() {
goBack = true;
});
},
child: new Text('Yes'), // No
),
new ElevatedButton(
onPressed: () {
Navigator.of(context).pop(false);
setState(() {
goBack = false;
});
},
child: new Text('No'), // Yes
),
],
),
);
if (goBack) {
exit(0);
}
}
}
_launchURL(url) async {
if (await canLaunch(url)) {
await launch(url);
} else {
throw 'Could not launch $url';
}
}
@override
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: _onBack,
child: Scaffold(
appBar: null,
body: SafeArea(
child: WebView(
navigationDelegate: (NavigationRequest request) {
if (request.url.contains("mailto:")) {
final Uri params = Uri(
scheme: 'mailto',
path: request.url.replaceAll("mailto:", ""),
query:'subject=&body=', //add subject and body here
);
var url = params.toString();
if (canLaunch(url) != null) {
launch(url);
return NavigationDecision.prevent;
}
} else if (request.url.contains("tel:")) {
_launchURL(request.url);
return NavigationDecision.prevent;
} else if (request.url.contains("wa.me")) {
_launchURL(request.url);
return NavigationDecision.prevent;
} else if (request.url.contains("whatsapp:")) {
_launchURL(request.url);
return NavigationDecision.prevent;
}
return NavigationDecision.navigate;
},
initialUrl: 'https://marmaraenstitu.com.tr/',
onWebViewCreated: (WebViewController webViewController) {
_controller.complete(webViewController);
this.webViewController = webViewController;
},
javascriptMode: JavascriptMode.unrestricted),
),
// floatingActionButton: _bookmarkButton(),
),
);
}
}
pubspec.yaml ım bu şekilde burada birşey yapmadım.
environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
webview_flutter: ^3.0.0
url_launcher: ^6.0.18
dev_dependencies:
flutter_test:
sdk: flutter
flutter_launcher_icons: ^0.9.2
change_app_package_name: ^1.0.0
flutter_icons:
image_path: "assets/images/rmoslogo.png"
android: true
ios: true
flutter:
uses-material-design: true
düzenlenmiş indirme linki : bu linkteki uygulamada geri ileri favori button menu button yoktur
telefon whatsap mail destekli indirme linki
https://drive.google.com/file/d/14EfR2tNhBtsYzef7xeSTdTA1bHwBnDwF/view?usp=sharing
telefon whatsap mail destekli splash screenli indirme linki
https://drive.google.com/file/d/14Jx0FiYWMJTeZvG7KsVE1YW3qqZmHSyx/view?usp=sharing
telefon whatsap mail desteksiz indirme linki
https://drive.google.com/file/d/134jdDlyLRGrk4Jr6T43DrnPlhBA2ORz0/view?usp=sharing
****2 - BİR DİĞER UYGULAMA BAKMASANDA OLUR BASİT UYGULAMA****
düzenlenmiş indirme linki : bu linkteki uygulamada geri ileri favori button menu button vardır
https://drive.google.com/file/d/11g5jL8el4JZU2G5CfNjKf6cPucOeiNWp/view?usp=sharing
EKRAN GÖRÜNTÜSÜ
kaynak : https://github.com/enespolat25/wiki_browser