|
|
|
|
@ -20,6 +20,7 @@ import 'package:flutter/cupertino.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter_html/flutter_html.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
import 'package:webview_flutter/webview_flutter.dart';
|
|
|
|
|
|
|
|
|
|
class UserLoginAgreementPage extends StatefulWidget {
|
|
|
|
|
final String userAgreementText;
|
|
|
|
|
@ -38,6 +39,38 @@ class _UserLoginAgreementPageState extends State<UserLoginAgreementPage> {
|
|
|
|
|
late ToDoCountProviderModel toDoProvider;
|
|
|
|
|
final authService = AuthProvider();
|
|
|
|
|
|
|
|
|
|
late final WebViewController _controller;
|
|
|
|
|
bool isPageLoaded = false;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
super.initState();
|
|
|
|
|
_controller = WebViewController()
|
|
|
|
|
..setJavaScriptMode(JavaScriptMode.unrestricted)
|
|
|
|
|
..setNavigationDelegate(
|
|
|
|
|
NavigationDelegate(
|
|
|
|
|
onProgress: (int progress) {
|
|
|
|
|
// Update loading bar.
|
|
|
|
|
},
|
|
|
|
|
onPageStarted: (String url) {},
|
|
|
|
|
onPageFinished: (String url) {
|
|
|
|
|
setState(() {
|
|
|
|
|
isPageLoaded = true;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
onHttpError: (HttpResponseError error) {},
|
|
|
|
|
onWebResourceError: (WebResourceError error) {},
|
|
|
|
|
onNavigationRequest: (NavigationRequest request) {
|
|
|
|
|
if (request.url.startsWith('https://www.youtube.com/')) {
|
|
|
|
|
return NavigationDecision.prevent;
|
|
|
|
|
}
|
|
|
|
|
return NavigationDecision.navigate;
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
..loadRequest(Uri.parse("https://hmg.com/en/Pages/Privacy.aspx"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
projectViewModel = Provider.of(context);
|
|
|
|
|
@ -49,14 +82,15 @@ class _UserLoginAgreementPageState extends State<UserLoginAgreementPage> {
|
|
|
|
|
showNewAppBar: true,
|
|
|
|
|
isShowDecPage: false,
|
|
|
|
|
appBarTitle: TranslationBase.of(context).userAgreement,
|
|
|
|
|
body: Padding(
|
|
|
|
|
padding: const EdgeInsets.all(8.0),
|
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
|
child: Html(
|
|
|
|
|
data: widget.userAgreementText,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
body: WebViewWidget(controller: _controller),
|
|
|
|
|
// Padding(
|
|
|
|
|
// padding: const EdgeInsets.all(8.0),
|
|
|
|
|
// child: SingleChildScrollView(child: WebViewWidget(controller: _controller)
|
|
|
|
|
// // Html(
|
|
|
|
|
// // data: widget.userAgreementText,
|
|
|
|
|
// // ),
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
bottomSheet: Container(
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
@ -101,9 +135,11 @@ class _UserLoginAgreementPageState extends State<UserLoginAgreementPage> {
|
|
|
|
|
child: CustomTextButton(
|
|
|
|
|
backgroundColor: CustomColors.green,
|
|
|
|
|
elevation: 0,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
addUsageAgreement();
|
|
|
|
|
},
|
|
|
|
|
onPressed: isPageLoaded
|
|
|
|
|
? () {
|
|
|
|
|
addUsageAgreement();
|
|
|
|
|
}
|
|
|
|
|
: null,
|
|
|
|
|
child: Text(TranslationBase.of(context).acceptLbl.toUpperCase(),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 18.0,
|
|
|
|
|
@ -123,14 +159,16 @@ class _UserLoginAgreementPageState extends State<UserLoginAgreementPage> {
|
|
|
|
|
child: CustomTextButton(
|
|
|
|
|
backgroundColor: Color(0xffc5272d),
|
|
|
|
|
elevation: 0,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.pushAndRemoveUntil(
|
|
|
|
|
context,
|
|
|
|
|
FadePage(
|
|
|
|
|
page: LandingPage(),
|
|
|
|
|
),
|
|
|
|
|
(r) => false);
|
|
|
|
|
},
|
|
|
|
|
onPressed: isPageLoaded
|
|
|
|
|
? () {
|
|
|
|
|
Navigator.pushAndRemoveUntil(
|
|
|
|
|
context,
|
|
|
|
|
FadePage(
|
|
|
|
|
page: LandingPage(),
|
|
|
|
|
),
|
|
|
|
|
(r) => false);
|
|
|
|
|
}
|
|
|
|
|
: null,
|
|
|
|
|
child: Text(TranslationBase.of(context).declineLbl.toUpperCase(), style: TextStyle(fontSize: 18.0, color: Colors.white)),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
|