MakerBook/books_viewer/lib/pages/privacy_page.dart

54 lines
1.4 KiB
Dart

import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';
class PrivacyPage extends StatefulWidget {
const PrivacyPage({super.key});
@override
State<PrivacyPage> createState() => _PrivacyPageState();
}
class _PrivacyPageState extends State<PrivacyPage> {
late final WebViewController _controller;
bool _loading = true;
@override
void initState() {
super.initState();
_controller = WebViewController()
..setJavaScriptMode(JavaScriptMode.unrestricted)
..setNavigationDelegate(
NavigationDelegate(
onPageFinished: (_) {
setState(() => _loading = false);
},
onWebResourceError: (error) {
// Opcional: se quiser mostrar algo quando falhar
// print('WebView error: ${error.description}');
},
),
)
..loadRequest(Uri.parse('https://makereducacional.com.br/privacy.html'));
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Política de Privacidade'),
centerTitle: true,
backgroundColor: Colors.cyanAccent,
foregroundColor: Colors.black,
),
body: Stack(
children: [
WebViewWidget(controller: _controller),
if (_loading)
const Center(child: CircularProgressIndicator()),
],
),
);
}
}