fist commit ftc staff app clone

This commit is contained in:
2024-08-01 13:46:46 +05:30
commit bf9064a9c9
515 changed files with 42796 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
import 'package:get/get.dart';
class WebviewScreenController extends GetxController {
final isLoading = false.obs;
}

View File

@@ -0,0 +1,92 @@
import 'package:flutter/material.dart';
import 'package:ftc_mobile_app/ftc_mobile_app.dart';
import 'package:get/get.dart';
import 'package:webview_flutter/webview_flutter.dart';
import 'controller/webview_screen_controller.dart';
class WebviewScreenArgument {
final String title;
final String url;
final bool willPop;
WebviewScreenArgument(
{Key? key, required this.title, required this.url, this.willPop = true});
}
class WebviewScreen extends StatefulWidget {
final WebviewScreenArgument args;
const WebviewScreen({Key? key, required this.args}) : super(key: key);
@override
_WebviewScreenState createState() => _WebviewScreenState();
}
class _WebviewScreenState extends State<WebviewScreen> {
final controller =
Get.put<WebviewScreenController>(WebviewScreenController());
late final WebViewController webViewController;
@override
void initState() {
super.initState();
webViewController = WebViewController()
..setJavaScriptMode(JavaScriptMode.unrestricted)
..setBackgroundColor(const Color(0x00000000))
..setNavigationDelegate(
NavigationDelegate(
onProgress: (int progress) {},
onPageStarted: (String url) {
controller.isLoading.value = true;
},
onPageFinished: (String url) {
controller.isLoading.value = false;
},
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(widget.args.url));
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
appBar: CustomAppBarTitleOnly(
context,
titleText: widget.args.title,
),
body: Obx(() {
return Stack(
children: [
Positioned.fill(
// child: WebViewWidget(controller: webController),
child: WebViewWidget(controller: webViewController),
),
Positioned.fill(
child: (controller.isLoading())
? Center(
child: CircularProgressIndicator(
color: Get.theme.primaryColor))
: FrequentFunctions.noWidget,
),
],
);
}),
);
}
@override
void dispose() {
controller.dispose();
super.dispose();
}
}