Untitled
unknown
plain_text
10 months ago
2.1 kB
12
Indexable
import 'package:flutter/material.dart';
void main() {
runApp(MainApp());
}
class MainApp extends StatelessWidget {
const MainApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: "Login Screen",
theme: ThemeData(primarySwatch: Colors.blue),
home: LoginScreen(),
);
}
}
class LoginScreen extends StatelessWidget {
LoginScreen({super.key});
final TextEditingController userNameController = TextEditingController();
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
height: double.infinity,
width: double.infinity,
padding: EdgeInsets.all(30),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text("Login", style: TextStyle(fontSize: 36, color: Colors.black)),
SizedBox(height: 20),
TextField(
controller: userNameController,
decoration: InputDecoration(
hintText: "Enter Username",
labelText: "Username",
border: OutlineInputBorder(
borderSide: BorderSide(color: Colors.black),
),
),
),
SizedBox(height: 20),
TextField(
decoration: InputDecoration(
hintText: "Enter Password",
labelText: "Password",
border: OutlineInputBorder(
borderSide: BorderSide(color: Colors.black, width: 5),
),
),
),
SizedBox(height: 20),
SizedBox(
width: 100,
child: ElevatedButton(
onPressed: () {
print(userNameController.text);
},
style: ElevatedButton.styleFrom(backgroundColor: Colors.purple),
child: Text("Log In", style: TextStyle(color: Colors.white)),
),
),
],
),
),
);
}
}
Editor is loading...
Leave a Comment