Skip to content

Commit

Permalink
updated code
Browse files Browse the repository at this point in the history
  • Loading branch information
azharhayat271 committed May 8, 2024
1 parent 1b329f8 commit ff1fa89
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .flutter-plugins-dependencies
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"mapbox_gl","path":"C:\\\\Users\\\\azhar\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\mapbox_gl-0.16.0\\\\","native_build":true,"dependencies":[]},{"name":"webview_flutter_wkwebview","path":"C:\\\\Users\\\\azhar\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\webview_flutter_wkwebview-3.13.0\\\\","native_build":true,"dependencies":[]}],"android":[{"name":"mapbox_gl","path":"C:\\\\Users\\\\azhar\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\mapbox_gl-0.16.0\\\\","native_build":true,"dependencies":[]},{"name":"webview_flutter_android","path":"C:\\\\Users\\\\azhar\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\webview_flutter_android-3.16.1\\\\","native_build":true,"dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[{"name":"mapbox_gl_web","path":"C:\\\\Users\\\\azhar\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\mapbox_gl_web-0.16.0\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"mapbox_gl","dependencies":["mapbox_gl_web"]},{"name":"mapbox_gl_web","dependencies":[]},{"name":"webview_flutter","dependencies":["webview_flutter_android","webview_flutter_wkwebview"]},{"name":"webview_flutter_android","dependencies":[]},{"name":"webview_flutter_wkwebview","dependencies":[]}],"date_created":"2024-05-08 12:17:21.833551","version":"3.19.5"}
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"mapbox_gl","path":"C:\\\\Users\\\\azhar\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\mapbox_gl-0.16.0\\\\","native_build":true,"dependencies":[]},{"name":"webview_flutter_wkwebview","path":"C:\\\\Users\\\\azhar\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\webview_flutter_wkwebview-3.13.0\\\\","native_build":true,"dependencies":[]}],"android":[{"name":"mapbox_gl","path":"C:\\\\Users\\\\azhar\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\mapbox_gl-0.16.0\\\\","native_build":true,"dependencies":[]},{"name":"webview_flutter_android","path":"C:\\\\Users\\\\azhar\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\webview_flutter_android-3.16.1\\\\","native_build":true,"dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[{"name":"mapbox_gl_web","path":"C:\\\\Users\\\\azhar\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\mapbox_gl_web-0.16.0\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"mapbox_gl","dependencies":["mapbox_gl_web"]},{"name":"mapbox_gl_web","dependencies":[]},{"name":"webview_flutter","dependencies":["webview_flutter_android","webview_flutter_wkwebview"]},{"name":"webview_flutter_android","dependencies":[]},{"name":"webview_flutter_wkwebview","dependencies":[]}],"date_created":"2024-05-08 23:25:29.370343","version":"3.19.5"}
46 changes: 25 additions & 21 deletions lib/ui/login.dart
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,15 @@ class _SignInEightState extends State<LoginPage> {
}

Widget welcomeText() {
return Center(
return const Center(
child: Text.rich(
TextSpan(
style: TextStyle(
fontSize: 22.0,
color: Colors.black,
height: 1.45,
),
children: const [
children: [
TextSpan(
text: 'Welcome Back',
),
Expand Down Expand Up @@ -138,15 +138,15 @@ class _SignInEightState extends State<LoginPage> {
}

Widget richText(double fontSize) {
return Text.rich(
return const Text.rich(
TextSpan(
style: TextStyle(
fontSize: 20.42,
color: const Color(0xFF21899C),
color: Color(0xFF21899C),
letterSpacing: 2.0000000290903555,
fontWeight: FontWeight.w800,
),
children: const [
children: [
TextSpan(
text: 'UET',
),
Expand All @@ -161,6 +161,7 @@ class _SignInEightState extends State<LoginPage> {
);
}

// ignore: non_constant_identifier_names
Widget UserNameTextField(Size size) {
return SizedBox(
height: size.height / 10,
Expand All @@ -169,9 +170,9 @@ class _SignInEightState extends State<LoginPage> {
maxLines: 1,
keyboardType: TextInputType.name,
cursorColor: const Color.fromRGBO(44, 185, 176, 1),
style: TextStyle(
style: const TextStyle(
fontSize: 17.0,
color: const Color(0xFF36455A),
color: Color(0xFF36455A),
fontWeight: FontWeight.w500,
),
decoration: InputDecoration(
Expand Down Expand Up @@ -220,9 +221,9 @@ class _SignInEightState extends State<LoginPage> {
obscureText: true,
cursorColor: const Color.fromRGBO(44, 185, 176, 1),
keyboardType: TextInputType.visiblePassword,
style: TextStyle(
style: const TextStyle(
fontSize: 17.0,
color: const Color(0xFF36455A),
color: Color(0xFF36455A),
fontWeight: FontWeight.w500,
),
decoration: InputDecoration(
Expand Down Expand Up @@ -278,10 +279,10 @@ class _SignInEightState extends State<LoginPage> {
),
),
child: isLoading
? CircularProgressIndicator(
? const CircularProgressIndicator(
valueColor: AlwaysStoppedAnimation<Color>(Colors.white),
)
: Text(
: const Text(
'Sign in',
style: TextStyle(
fontSize: 16.0,
Expand All @@ -295,11 +296,11 @@ class _SignInEightState extends State<LoginPage> {
}

Widget buildNoAccountText() {
return Row(
return const Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
const Expanded(
Expanded(
flex: 2,
child: Divider(
color: Color(0xFF969AA8),
Expand All @@ -312,13 +313,13 @@ class _SignInEightState extends State<LoginPage> {
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 12.0,
color: const Color(0xFF969AA8),
color: Color(0xFF969AA8),
fontWeight: FontWeight.w500,
height: 1.67,
),
),
),
const Expanded(
Expanded(
flex: 2,
child: Divider(
color: Color(0xFF969AA8),
Expand All @@ -333,7 +334,7 @@ class _SignInEightState extends State<LoginPage> {
width: size.width * 0.7,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15.0),
gradient: LinearGradient(
gradient: const LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Expand All @@ -346,7 +347,7 @@ class _SignInEightState extends State<LoginPage> {
color: Colors.grey.withOpacity(0.5),
spreadRadius: 3,
blurRadius: 7,
offset: Offset(0, 3),
offset: const Offset(0, 3),
),
],
),
Expand Down Expand Up @@ -409,6 +410,7 @@ class _SignInEightState extends State<LoginPage> {
if (username == 'admin') {
// Navigate to the admin page
Navigator.pushReplacement(
// ignore: use_build_context_synchronously
context,
MaterialPageRoute(
builder: (context) =>
Expand All @@ -418,26 +420,28 @@ class _SignInEightState extends State<LoginPage> {
} else {
// Navigate to CustomBottomNavBar
Navigator.pushReplacement(
// ignore: use_build_context_synchronously
context,
MaterialPageRoute(
builder: (context) => CustomBottomNavBar(),
builder: (context) => const CustomBottomNavBar(),
),
);
}
} else {
// Show invalid credential message
showDialog(
// ignore: use_build_context_synchronously
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: Text('Invalid Credentials'),
content: Text('Please enter valid username and password.'),
title: const Text('Invalid Credentials'),
content: const Text('Please enter valid username and password.'),
actions: [
TextButton(
onPressed: () {
Navigator.of(context).pop();
},
child: Text('OK'),
child: const Text('OK'),
),
],
);
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ dependencies:
cupertino_icons: ^1.0.6
http: ^1.2.1
flutter_svg: ^2.0.10+1
flutter_stetho: ^0.3.1
webview_flutter: ^4.7.0
mapbox_gl: ^0.16.0

Expand Down

0 comments on commit ff1fa89

Please sign in to comment.