|
|
|
@ -23,7 +23,6 @@ import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_html/flutter_html.dart';
|
|
|
|
import 'package:flutter_html/flutter_html.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'package:url_launcher/url_launcher.dart';
|
|
|
|
|
|
|
|
import 'package:webview_flutter/webview_flutter.dart';
|
|
|
|
import 'package:webview_flutter/webview_flutter.dart';
|
|
|
|
|
|
|
|
|
|
|
|
class UserLoginAgreementPage extends StatefulWidget {
|
|
|
|
class UserLoginAgreementPage extends StatefulWidget {
|
|
|
|
@ -45,7 +44,7 @@ class _UserLoginAgreementPageState extends State<UserLoginAgreementPage> {
|
|
|
|
final authService = AuthProvider();
|
|
|
|
final authService = AuthProvider();
|
|
|
|
|
|
|
|
|
|
|
|
late final WebViewController _controller;
|
|
|
|
late final WebViewController _controller;
|
|
|
|
bool isPageLoaded = true;
|
|
|
|
bool isPageLoaded = false;
|
|
|
|
|
|
|
|
|
|
|
|
bool isTermsAndConditionsPage = true;
|
|
|
|
bool isTermsAndConditionsPage = true;
|
|
|
|
bool acceptTerms = false;
|
|
|
|
bool acceptTerms = false;
|
|
|
|
@ -53,31 +52,31 @@ class _UserLoginAgreementPageState extends State<UserLoginAgreementPage> {
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
super.initState();
|
|
|
|
// _controller = WebViewController()
|
|
|
|
_controller = WebViewController()
|
|
|
|
// ..setJavaScriptMode(JavaScriptMode.unrestricted)
|
|
|
|
..setJavaScriptMode(JavaScriptMode.unrestricted)
|
|
|
|
// ..setNavigationDelegate(
|
|
|
|
..setNavigationDelegate(
|
|
|
|
// NavigationDelegate(
|
|
|
|
NavigationDelegate(
|
|
|
|
// onProgress: (int progress) {
|
|
|
|
onProgress: (int progress) {
|
|
|
|
// // Update loading bar.
|
|
|
|
// Update loading bar.
|
|
|
|
// print("Progress: $progress");
|
|
|
|
print("Progress: $progress");
|
|
|
|
// },
|
|
|
|
},
|
|
|
|
// onPageStarted: (String url) {},
|
|
|
|
onPageStarted: (String url) {},
|
|
|
|
// onPageFinished: (String url) {
|
|
|
|
onPageFinished: (String url) {
|
|
|
|
// setState(() {
|
|
|
|
setState(() {
|
|
|
|
// isPageLoaded = true;
|
|
|
|
isPageLoaded = true;
|
|
|
|
// });
|
|
|
|
});
|
|
|
|
// },
|
|
|
|
},
|
|
|
|
// onHttpError: (HttpResponseError error) {},
|
|
|
|
onHttpError: (HttpResponseError error) {},
|
|
|
|
// onWebResourceError: (WebResourceError error) {},
|
|
|
|
onWebResourceError: (WebResourceError error) {},
|
|
|
|
// onNavigationRequest: (NavigationRequest request) {
|
|
|
|
onNavigationRequest: (NavigationRequest request) {
|
|
|
|
// if (request.url.startsWith('https://www.youtube.com/')) {
|
|
|
|
if (request.url.startsWith('https://www.youtube.com/')) {
|
|
|
|
// return NavigationDecision.prevent;
|
|
|
|
return NavigationDecision.prevent;
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
// return NavigationDecision.navigate;
|
|
|
|
return NavigationDecision.navigate;
|
|
|
|
// },
|
|
|
|
},
|
|
|
|
// ),
|
|
|
|
),
|
|
|
|
// )
|
|
|
|
)
|
|
|
|
// ..loadRequest(Uri.parse(widget.isArabic ? "https://hmg.com/ar/Pages/Privacy.aspx" : "https://hmg.com/en/Pages/Privacy.aspx"));
|
|
|
|
..loadRequest(Uri.parse(widget.isArabic ? "https://hmg.com/ar/Pages/MBTerms.aspx" : "https://hmg.com/en/Pages/MBTerms.aspx"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
@ -94,16 +93,17 @@ class _UserLoginAgreementPageState extends State<UserLoginAgreementPage> {
|
|
|
|
body:
|
|
|
|
body:
|
|
|
|
// isTermsAndConditionsPage
|
|
|
|
// isTermsAndConditionsPage
|
|
|
|
// ?
|
|
|
|
// ?
|
|
|
|
getTermsAndConditionsContent(),
|
|
|
|
// getTermsAndConditionsContent(),
|
|
|
|
// : isPageLoaded
|
|
|
|
// :
|
|
|
|
// ? WebViewWidget(controller: _controller)
|
|
|
|
isPageLoaded
|
|
|
|
// : Container(
|
|
|
|
? WebViewWidget(controller: _controller)
|
|
|
|
// child: Center(
|
|
|
|
: Container(
|
|
|
|
// child: GifLoaderContainer(
|
|
|
|
child: Center(
|
|
|
|
// barrierDismissible: false,
|
|
|
|
child: GifLoaderContainer(
|
|
|
|
// ),
|
|
|
|
barrierDismissible: false,
|
|
|
|
// ),
|
|
|
|
),
|
|
|
|
// ),
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
// Padding(
|
|
|
|
// Padding(
|
|
|
|
// padding: const EdgeInsets.all(8.0),
|
|
|
|
// padding: const EdgeInsets.all(8.0),
|
|
|
|
// child: SingleChildScrollView(child: WebViewWidget(controller: _controller)
|
|
|
|
// child: SingleChildScrollView(child: WebViewWidget(controller: _controller)
|
|
|
|
@ -142,6 +142,24 @@ class _UserLoginAgreementPageState extends State<UserLoginAgreementPage> {
|
|
|
|
letterSpacing: -0.64,
|
|
|
|
letterSpacing: -0.64,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
mHeight(24.0),
|
|
|
|
|
|
|
|
Row(
|
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
Checkbox(
|
|
|
|
|
|
|
|
value: acceptTerms,
|
|
|
|
|
|
|
|
onChanged: (v) {
|
|
|
|
|
|
|
|
setState(() => acceptTerms = v!);
|
|
|
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
Expanded(
|
|
|
|
|
|
|
|
child: Text(
|
|
|
|
|
|
|
|
TranslationBase.of(context).termsConditionsRead,
|
|
|
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
|
|
|
fontSize: 16, fontFamily: (projectViewModel.isArabic ? 'Cairo' : 'Poppins'), fontWeight: FontWeight.w700, color: Color(0xff2B353E), letterSpacing: -1.44, height: 35 / 24),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
SizedBox(height: 12),
|
|
|
|
SizedBox(height: 12),
|
|
|
|
Row(
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
@ -156,10 +174,8 @@ class _UserLoginAgreementPageState extends State<UserLoginAgreementPage> {
|
|
|
|
child: CustomTextButton(
|
|
|
|
child: CustomTextButton(
|
|
|
|
backgroundColor: CustomColors.green,
|
|
|
|
backgroundColor: CustomColors.green,
|
|
|
|
elevation: 0,
|
|
|
|
elevation: 0,
|
|
|
|
onPressed:
|
|
|
|
onPressed: isPageLoaded
|
|
|
|
// isPageLoaded
|
|
|
|
? () {
|
|
|
|
// ?
|
|
|
|
|
|
|
|
() {
|
|
|
|
|
|
|
|
// if (isTermsAndConditionsPage) {
|
|
|
|
// if (isTermsAndConditionsPage) {
|
|
|
|
if (acceptTerms) {
|
|
|
|
if (acceptTerms) {
|
|
|
|
addUsageAgreement();
|
|
|
|
addUsageAgreement();
|
|
|
|
@ -172,8 +188,8 @@ class _UserLoginAgreementPageState extends State<UserLoginAgreementPage> {
|
|
|
|
// } else {
|
|
|
|
// } else {
|
|
|
|
// addUsageAgreement();
|
|
|
|
// addUsageAgreement();
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
},
|
|
|
|
}
|
|
|
|
// : null,
|
|
|
|
: null,
|
|
|
|
child: Text(TranslationBase.of(context).acceptLbl.toUpperCase(),
|
|
|
|
child: Text(TranslationBase.of(context).acceptLbl.toUpperCase(),
|
|
|
|
style: TextStyle(
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 18.0,
|
|
|
|
fontSize: 18.0,
|
|
|
|
@ -244,22 +260,23 @@ class _UserLoginAgreementPageState extends State<UserLoginAgreementPage> {
|
|
|
|
style: TextStyle(fontSize: 16, fontFamily: (projectViewModel.isArabic ? 'Cairo' : 'Poppins'), color: Color(0xff2B353E), letterSpacing: -1.44, height: 35 / 24),
|
|
|
|
style: TextStyle(fontSize: 16, fontFamily: (projectViewModel.isArabic ? 'Cairo' : 'Poppins'), color: Color(0xff2B353E), letterSpacing: -1.44, height: 35 / 24),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
mHeight(12.0),
|
|
|
|
mHeight(12.0),
|
|
|
|
InkWell(
|
|
|
|
// InkWell(
|
|
|
|
onTap: () async {
|
|
|
|
// onTap: () async {
|
|
|
|
await launchUrl(Uri.parse(widget.isArabic ? "https://hmg.com/ar/Pages/Privacy.aspx" : "https://hmg.com/en/Pages/Privacy.aspx"));
|
|
|
|
// await launchUrl(uri);
|
|
|
|
},
|
|
|
|
// Uri.parse(widget.isArabic ? "https://hmg.com/ar/Pages/Privacy.aspx" : "https://hmg.com/en/Pages/Privacy.aspx");
|
|
|
|
child: Text(
|
|
|
|
// },
|
|
|
|
TranslationBase.of(context).clickPrivacyPolicy,
|
|
|
|
// child: Text(
|
|
|
|
style: TextStyle(
|
|
|
|
// TranslationBase.of(context).clickPrivacyPolicy,
|
|
|
|
fontSize: 16,
|
|
|
|
// style: TextStyle(
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
// fontSize: 16,
|
|
|
|
fontFamily: (projectViewModel.isArabic ? 'Cairo' : 'Poppins'),
|
|
|
|
// fontWeight: FontWeight.bold,
|
|
|
|
color: Colors.blue,
|
|
|
|
// fontFamily: (projectViewModel.isArabic ? 'Cairo' : 'Poppins'),
|
|
|
|
letterSpacing: -1.44,
|
|
|
|
// color: Colors.blue,
|
|
|
|
height: 35 / 24,
|
|
|
|
// letterSpacing: -1.44,
|
|
|
|
decoration: TextDecoration.underline),
|
|
|
|
// height: 35 / 24,
|
|
|
|
),
|
|
|
|
// decoration: TextDecoration.underline),
|
|
|
|
),
|
|
|
|
// ),
|
|
|
|
|
|
|
|
// ),
|
|
|
|
mHeight(12.0),
|
|
|
|
mHeight(12.0),
|
|
|
|
Text(
|
|
|
|
Text(
|
|
|
|
TranslationBase.of(context).termsConditions4,
|
|
|
|
TranslationBase.of(context).termsConditions4,
|
|
|
|
|