Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
mortzaCFT authored Nov 14, 2024
1 parent 00a6e32 commit 4870c47
Show file tree
Hide file tree
Showing 13 changed files with 387 additions and 84 deletions.
8 changes: 4 additions & 4 deletions lib/screens/HomeScreen.dart
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:msf/controllers/IdleController.dart';
import 'package:msf/controllers/WsConnection.dart';
import 'package:msf/controllers/settings/IdleController.dart';
import 'package:msf/controllers/ws/WsController.dart';
import 'package:msf/screens/dashboard/dashboard_screen.dart';
import 'package:msf/utills/responsive.dart';
import 'component/SideBar.dart';
import 'package:msf/controllers/MenuController.dart';
import 'package:msf/controllers/settings/MenuController.dart';

class HomeScreen extends StatelessWidget {
final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();
final Menu_Controller menuController = Get.find<Menu_Controller>();
final WsConnection comController = Get.put(WsConnection());
final WsController comController = Get.find<WsController>();

@override
Widget build(BuildContext context) {
Expand Down
136 changes: 83 additions & 53 deletions lib/screens/LoginScreen.dart
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import 'package:carousel_slider_plus/carousel_slider_plus.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:msf/controllers/LoginController.dart';
import 'package:msf/controllers/auth/CaptchaController.dart';
import 'package:msf/controllers/auth/LoginController.dart';
import 'package:msf/utills/colorconfig.dart';
import 'package:msf/utills/responsive.dart';

class LoginScreen extends StatelessWidget {

final TextEditingController usernameController = TextEditingController();
final TextEditingController passwordController = TextEditingController();
final TextEditingController captchaInputController = TextEditingController();
final CaptchaController captchaController = Get.find<CaptchaController>();

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -50,7 +52,7 @@ class LoginScreen extends StatelessWidget {
padEnds: false,
enableInfiniteScroll: false,
autoPlayAnimationDuration:
Duration(milliseconds: 800),
Duration(milliseconds: 800),
viewportFraction: 1.0,
),
items: [
Expand All @@ -71,16 +73,12 @@ class LoginScreen extends StatelessWidget {
"Welcome to WAF2Flutter!",
style: TextStyle(fontSize: 30),
),
SizedBox(
height: 20,
),
SizedBox(height: 20),
Text(
" Login ",
style: TextStyle(fontSize: 20),
),
SizedBox(
height: 20,
),
SizedBox(height: 20),
Container(
width: Responsive.isDesktop(context)
? screenWidth * 0.4
Expand All @@ -95,14 +93,12 @@ class LoginScreen extends StatelessWidget {
border: const OutlineInputBorder(
borderSide: BorderSide.none,
borderRadius:
BorderRadius.all(Radius.circular(10)),
BorderRadius.all(Radius.circular(10)),
),
),
),
),
SizedBox(
height: 20,
),
SizedBox(height: 20),
Container(
width: Responsive.isDesktop(context)
? screenWidth * 0.4
Expand All @@ -117,54 +113,88 @@ class LoginScreen extends StatelessWidget {
border: const OutlineInputBorder(
borderSide: BorderSide.none,
borderRadius:
BorderRadius.all(Radius.circular(10)),
BorderRadius.all(Radius.circular(10)),
),
),
),
),
SizedBox(
height: 20,
SizedBox(height: 20),
Obx(() => Text(
"${captchaController.captcha.value}",
style: TextStyle(fontSize: 24),
)),
SizedBox(height: 20),
Container(
width: Responsive.isDesktop(context)
? screenWidth * 0.4
: screenWidth * 0.8,
height: 60,
child: TextField(
controller: captchaInputController,
decoration: InputDecoration(
hintText: "Enter Captcha",
fillColor: secondryColor,
filled: true,
border: const OutlineInputBorder(
borderSide: BorderSide.none,
borderRadius:
BorderRadius.all(Radius.circular(10)),
),
),
onChanged: (value) {
captchaController.verifyCaptcha(value);
},
),
),
SizedBox(height: 20),
Obx(
() => Get.find<LoginController>()
.loginProcess
.value
() => Get.find<LoginController>()
.loginProcess
.value
? Center(
child: CircularProgressIndicator(),
)
child: CircularProgressIndicator(),
)
: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor:
primaryColor.withOpacity(0.4),
shape: RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(8),
),
minimumSize: Size(
Responsive.isDesktop(context)
? screenWidth * 0.2
: screenWidth * 0.8,
50,
),
),
onPressed: () {
if (!Get.find<LoginController>()
.loginProcess
.value) {
Get.find<LoginController>().login(
usernameController.text,
passwordController.text);
}
},
child: Text(
'Login',
style: TextStyle(
color: Colors.white,
fontSize: 18,
),
),
),
)
style: ElevatedButton.styleFrom(
backgroundColor:
primaryColor.withOpacity(0.4),
shape: RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(8),
),
minimumSize: Size(
Responsive.isDesktop(context)
? screenWidth * 0.2
: screenWidth * 0.8,
50,
),
),
onPressed: () {
if (!Get.find<LoginController>()
.loginProcess
.value) {
if (captchaController
.isCaptchaCorrect.value) {
Get.find<LoginController>()
.login(
usernameController.text,
passwordController.text,
);
} else {
Get.snackbar("Error",
"Captcha is incorrect!");
}
}
},
child: Text(
'Login',
style: TextStyle(
color: Colors.white,
fontSize: 18,
),
),
),
),
],
),
),
Expand Down
4 changes: 2 additions & 2 deletions lib/screens/SettingScreen.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import 'package:flutter/material.dart';
import 'package:msf/controllers/IdleController.dart';
import 'package:msf/controllers/settings/IdleController.dart';
import 'package:msf/screens/websites/websites_screen.dart';
import 'package:msf/utills/responsive.dart';
import '../controllers/MenuController.dart';
import '../controllers/settings/MenuController.dart';
import 'component/SideBar.dart';
import 'package:get/get.dart';

Expand Down
4 changes: 2 additions & 2 deletions lib/screens/WebSiteScreen.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import 'package:flutter/material.dart';
import 'package:msf/controllers/IdleController.dart';
import 'package:msf/controllers/settings/IdleController.dart';
import 'package:msf/screens/websites/websites_screen.dart';
import 'package:msf/utills/responsive.dart';
import '../controllers/MenuController.dart';
import '../controllers/settings/MenuController.dart';
import 'component/SideBar.dart';
import 'package:get/get.dart';

Expand Down
4 changes: 2 additions & 2 deletions lib/screens/component/Header.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import 'package:flutter/material.dart';
import 'package:auto_size_text/auto_size_text.dart';
import 'package:get/get.dart';
import 'package:msf/controllers/CounterController.dart';
import 'package:msf/controllers/dashboard/CounterController.dart';
import 'package:msf/utills/colorconfig.dart';
import 'package:msf/utills/responsive.dart';
import 'package:msf/controllers/MenuController.dart';
import 'package:msf/controllers/settings/MenuController.dart';

class Header extends StatelessWidget {
final GlobalKey<ScaffoldState> scaffoldKey;
Expand Down
4 changes: 2 additions & 2 deletions lib/screens/component/SideBar.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:auto_size_text/auto_size_text.dart';
import 'package:msf/controllers/ThemeController.dart';
import 'package:msf/controllers/TranslateController.dart';
import 'package:msf/controllers/settings/ThemeController.dart';
import 'package:msf/controllers/settings/TranslateController.dart';
import 'package:get/get.dart';

class SideBar extends StatelessWidget {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:msf/controllers/RecentActivityController.dart';
import 'package:msf/controllers/dashboard/RecentActivityController.dart';
class AttacksPerApplicationTable extends StatelessWidget {
const AttacksPerApplicationTable({
Key? key,
Expand Down
2 changes: 1 addition & 1 deletion lib/screens/dashboard/component/InfoCardGridView.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_octicons/flutter_octicons.dart';
import 'package:get/get.dart';
import 'package:msf/controllers/ResourceUsageController.dart';
import 'package:msf/controllers/dashboard/ResourceUsageController.dart';
import 'package:msf/screens/dashboard/component/InfoCard.dart';

class InfoCardGridView extends StatelessWidget {
Expand Down
94 changes: 94 additions & 0 deletions lib/screens/doc/components/Header.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
import 'package:flutter/material.dart';
import 'package:auto_size_text/auto_size_text.dart';
import 'package:get/get.dart';
import 'package:msf/controllers/dashboard/CounterController.dart';
import 'package:msf/utills/colorconfig.dart';
import 'package:msf/utills/responsive.dart';
import 'package:msf/controllers/settings/MenuController.dart';

class Header extends StatelessWidget {
final GlobalKey<ScaffoldState> scaffoldKey;
final Menu_Controller menuController = Get.find<Menu_Controller>();

Header({required this.scaffoldKey});

@override
Widget build(BuildContext context) {
return Row(
children: [
if (!Responsive.isDesktop(context))
IconButton(
onPressed: () {
menuController.openDrawer(scaffoldKey);
},
icon: const Icon(Icons.menu_sharp),
),
if (!Responsive.isMobile(context))
AutoSizeText(
"Docs".tr,
style: Theme.of(context).textTheme.bodyLarge,
),
if (!Responsive.isMobile(context))
Spacer(flex: Responsive.isDesktop(context) ? 1 : 2),
Spacer(),
GestureDetector(
onTap: (){
Get.toNamed("/home");
},
child: Container(
width: 100,
height: 40,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10), color: secondryColor),
child: Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(Icons.arrow_back_ios_sharp),
SizedBox(width: 6,),
Text(
"Back".tr,
),
]),
)),
),
SizedBox(width: 10),

],
);
}

void _showLogoutConfirmation() {
Get.dialog(
AlertDialog(
backgroundColor: secondryColor,
title: Text(
"Logout".tr,
style: TextStyle(color: Colors.white),
),
content: Text(
"Are you sure you want to logout?".tr,
style: TextStyle(color: Colors.white),
),
actions: [
TextButton(
onPressed: () {
Get.back();
},
child: Text(
"Cancel".tr,
style: TextStyle(color: Colors.red),
),
),
TextButton(
onPressed: () {
Get.back();
},
child: Text("Confirm".tr),
),
],
),
barrierDismissible: true,
);
}
}
Loading

0 comments on commit 4870c47

Please sign in to comment.