From f2f360a25120c2a12f877b60377d0267d7baab84 Mon Sep 17 00:00:00 2001 From: Fahed Khan <127182880+12fahed@users.noreply.github.com> Date: Tue, 6 Aug 2024 21:46:44 +0530 Subject: [PATCH] navigate to fill form on website if correct code --- .../screens/launch_screen/launch_screen.dart | 67 +++++++++++++++---- 1 file changed, 53 insertions(+), 14 deletions(-) diff --git a/lib/new_ui/screens/launch_screen/launch_screen.dart b/lib/new_ui/screens/launch_screen/launch_screen.dart index a6e66f7..7ea66fe 100644 --- a/lib/new_ui/screens/launch_screen/launch_screen.dart +++ b/lib/new_ui/screens/launch_screen/launch_screen.dart @@ -6,6 +6,7 @@ import 'package:go_router/go_router.dart'; import 'package:tsec_app/new_ui/colors.dart'; import 'package:tsec_app/new_ui/screens/Maintainance_Screen/maintainance_screen.dart'; // import 'package:tsec_app/new_ui/screens/login_screen/login_screen.dart'; +import 'package:url_launcher/url_launcher.dart'; class LaunchScreen extends StatefulWidget { @override @@ -59,16 +60,25 @@ class _LaunchScreenState extends State { }); } - void _navigateToLogin() async{ + void _navigateToLogin() async { DocumentSnapshot> snapshot = await FirebaseFirestore.instance .collection('Launch') .doc('launch') .get(); int unlockedData = snapshot.data()!["unlocked"]; Map map = { - "unlocked":++unlockedData + "unlocked": ++unlockedData }; await FirebaseFirestore.instance.collection("Launch").doc('launch').update(map); + + // Launch URL + const url = 'https://tsecdevsclub.com/launchForm'; + if (await canLaunch(url)) { + await launch(url); + } else { + throw 'Could not launch $url'; + } + context.go('/login'); } @@ -117,18 +127,21 @@ class _LaunchScreenState extends State { SizedBox( height: 35, ), - Row( - children: [ - Spacer(), - Text("Student's Unlocked: $unlocked",style: TextStyle( - color: Colors.grey[600], - fontSize: 15, - ),), - SizedBox( - width: 15, - ), - ], - ), + // Row( + // children: [ + // Spacer(), + // SizedBox( + // height: 10, + // ), + // Text("Student's Unlocked: $unlocked",style: TextStyle( + // color: Colors.grey[600], + // fontSize: 10, + // ),), + // SizedBox( + // width: 15, + // ), + // ], + // ), SizedBox( height: 60, ), @@ -194,6 +207,32 @@ class _LaunchScreenState extends State { }, ), ), + SizedBox(height: 30), + Center(), + SizedBox( + height: 10, + ), + InkWell( + splashFactory: NoSplash.splashFactory, + onTap: () async { + const url = 'https://tsecdevsclub.com/launchDashboard'; + if (await canLaunch(url)) { + await launch(url); + } else { + throw 'Could not launch $url'; + } + }, + child: Text( + "Student's Unlocked: $unlocked", + style: TextStyle( + color: Colors.grey[600], + fontSize: 10, + ), + ), + ), + SizedBox( + width: 15, + ), ], ), ),