MakerBook/books_viewer/lib/pages/privacy_page.dart

58 lines
1.4 KiB
Dart

import 'dart:io';
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> {
bool _loading = true;
//late WebViewController _controller;
@override
void initState() {
super.initState();
// Necessário para Android quando usando WebView em SDKs antigos
if (Platform.isAndroid) {
WebView.platform = SurfaceAndroidWebView();
}
}
@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: [
WebView(
initialUrl: 'https://makereducacional.com.br/privacy.html',
javascriptMode: JavascriptMode.unrestricted,
onWebViewCreated: (controller) {
//_controller = controller;
},
onPageFinished: (_) {
setState(() {
_loading = false;
});
},
),
if (_loading)
const Center(
child: CircularProgressIndicator(),
),
],
),
);
}
}