Skip to content

Instantly share code, notes, and snippets.

@OmarYehiaDev
Created February 18, 2023 19:09
Show Gist options
  • Save OmarYehiaDev/55030022585fae89ca5c90aacd078a67 to your computer and use it in GitHub Desktop.
Save OmarYehiaDev/55030022585fae89ca5c90aacd078a67 to your computer and use it in GitHub Desktop.
Task 1
import 'package:flutter/material.dart';
class LoginScreen extends StatefulWidget {
const LoginScreen({super.key});
@override
State<LoginScreen> createState() => _LoginScreenState();
}
class _LoginScreenState extends State<LoginScreen> {
@override
Widget build(BuildContext context) {
double height = MediaQuery.of(context).size.height;
double width = MediaQuery.of(context).size.width;
List<String> data = List.generate(
10,
(index) => index.toString(),
);
return Scaffold(
resizeToAvoidBottomInset: true,
appBar: AppBar(
title: const Text("Login Screen"),
),
body: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
Align(
alignment: Alignment.topCenter,
child: FlutterLogo(
size: height * 0.2,
),
),
Card(
elevation: 10,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15),
),
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
"LOGIN",
style: Theme.of(context).textTheme.headlineMedium!.copyWith(
fontWeight: FontWeight.bold,
color: Colors.lightGreen,
),
),
),
Container(
margin: const EdgeInsets.all(8.0),
width: width * 0.7,
child: TextFormField(
keyboardType: TextInputType.emailAddress,
decoration: const InputDecoration(
hintText: "[email protected]",
labelText: "Email",
border: OutlineInputBorder(
borderRadius: BorderRadius.all(
Radius.circular(15),
),
borderSide: BorderSide(
width: 2,
color: Colors.blueGrey,
),
),
),
),
),
Container(
margin: const EdgeInsets.all(8.0),
width: width * 0.7,
child: TextFormField(
keyboardType: TextInputType.visiblePassword,
decoration: const InputDecoration(
labelText: "Password",
border: OutlineInputBorder(
borderRadius: BorderRadius.all(
Radius.circular(15),
),
borderSide: BorderSide(
width: 2,
color: Colors.blueGrey,
),
),
),
),
),
TextButton(
onPressed: () {},
child: const Text("Forgot Password"),
),
],
),
),
),
Container(
margin: const EdgeInsets.all(16),
width: width * 0.6,
child: OutlinedButton.icon(
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(
Colors.green,
),
foregroundColor: MaterialStateProperty.all(
Colors.white,
),
),
onPressed: () {},
icon: const Icon(
Icons.login,
size: 30,
),
label: const Padding(
padding: EdgeInsets.all(8.0),
child: Text(
"LOGIN",
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w500,
),
),
),
),
),
],
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment