WhatsApp'tan Ulaşın
Çeşitli Hukuk Hizmetlerimizle En Popüler Hukuk Bürosuyuz!
Hakkımızda
Lawai Hukuk Danışmanlık
İletişime Geç
Instagram'da Takip Et
dependencies:
flutter:
sdk: flutter
webview_flutter: ^4.10.0
url_launcher: ^6.3.0
import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';
import 'package:url_launcher/url_launcher.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
runApp(const LawaiWebViewApp());}
class LawaiWebViewApp extends StatelessWidget {const LawaiWebViewApp({super.key});
@override
Widget build(BuildContext context) {return MaterialApp(
title: 'Lawai Hukuk',
debugShowCheckedModeBanner: false,
theme: ThemeData.dark().copyWith(
scaffoldBackgroundColor: const Color(0xFF121212),
appBarTheme: const AppBarTheme(backgroundColor: Color(0xFF1E1E1E)), ), home: const WebViewScreen(), ); }}
class WebViewScreen extends StatefulWidget {const WebViewScreen({super.key}); @override
State createState() => _WebViewScreenState();}
class _WebViewScreenState extends State { late final WebViewController _controller;
bool _isLoading = true;
@override
void initState() {super.initState();
_controller = WebViewController()
..setJavaScriptMode(JavaScriptMode.unrestricted)
..setBackgroundColor(const Color(0xFF121212))
..setNavigationDelegate(
NavigationDelegate(
onPageStarted: (String url) {
setState(() => _isLoading = true);},
onPageFinished: (String url) { setState(() => _isLoading = false); },
onNavigationRequest: (NavigationRequest request) async { final url = request.url;
// WhatsApp, Telefon ve Instagram bağlantılarını harici uygulamada aç
if (url.startsWith('https://wa.me/') ||
url.startsWith('whatsapp://') ||
url.startsWith('tel:') ||
url.startsWith('mailto:') ||
url.contains('instagram.com')) {final Uri uri = Uri.parse(url);
if (await canLaunchUrl(uri)) {await launchUrl(uri, mode: LaunchMode.externalApplication);}
return NavigationDecision.prevent;}
return NavigationDecision.navigate;}, ), )
..loadRequest(Uri.parse('https://lawai.com.tr')); }
@override
Widget build(BuildContext context) {return PopScope(canPop: false,
onPopInvokedWithResult: (bool didPop, dynamic result) async {
if (didPop) return;
if (await _controller.canGoBack()) {
await _controller.goBack();} else {
if (context.mounted) {
Navigator.of(context).pop(); } } },
child: Scaffold(
body: SafeArea(
child: Stack(
children: [
WebViewWidget(controller: _controller),
if (_isLoading)
const Center(
child: CircularProgressIndicator(
color: Color(0xFFD4AF37),
),
),
],
),
),
),
);
}
}
...
LSApplicationQueriesSchemes
whatsapp
tel
mailto
instagram
flutter build appbundle --release
flutter build ipa --release
flutter build ipa --release