init
This commit is contained in:
19
lib/const.dart
Normal file
19
lib/const.dart
Normal file
@@ -0,0 +1,19 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
final isDarkMode = true;
|
||||
final imageURL =
|
||||
'https://lh3.googleusercontent.com/aida-public/AB6AXuACAJl0VSuQ2Ix9QfEZLLOwybczej9BGvwBb2GCuiY2QB5BxCj9VYM7rPTAsrcD2MtpaXXfATfV_Ko6TYXJ-sQ0uX4v_sZKTJYy42JXjBVqhin2Z4yh0mtRrVGzZi_WgBWkDzYF9JjqB1_BMpLgjsBy0PfI_skYvYECttgmQhvvTYiut-5nGrBu72DSxB5Oc7rtiTFpO6dypLCLWuhq1UEAk7rGAfwYx_8Oc9InevGM_z0pfoqf3N0jcRqlGepQshp7pSYOxsHHE6U';
|
||||
|
||||
final backgroundColor = isDarkMode
|
||||
? const Color(0xFF101922)
|
||||
: const Color(0xFFF6F7F8);
|
||||
final textColor = isDarkMode
|
||||
? const Color(0xFFE5E7EB)
|
||||
: const Color(0xFF1F2937);
|
||||
final subtleTextColor = isDarkMode
|
||||
? const Color(0xFF9CA3AF)
|
||||
: const Color(0xFF6B7280);
|
||||
final inputBackgroundColor = isDarkMode
|
||||
? const Color(0xFF1F2937)
|
||||
: const Color(0xFFE5E7EB);
|
||||
const primaryColor = Color(0xFF137FEC);
|
||||
24
lib/main.dart
Normal file
24
lib/main.dart
Normal file
@@ -0,0 +1,24 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:ldh_flutter/pages/login.dart';
|
||||
|
||||
void main() {
|
||||
runApp(const MainApp());
|
||||
}
|
||||
|
||||
class MainApp extends StatelessWidget {
|
||||
const MainApp({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
title: 'Flutter Demo',
|
||||
theme: ThemeData(
|
||||
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
|
||||
useMaterial3: true,
|
||||
),
|
||||
darkTheme: ThemeData.dark(useMaterial3: true),
|
||||
themeMode: ThemeMode.system,
|
||||
home: const LoginPage(),
|
||||
);
|
||||
}
|
||||
}
|
||||
149
lib/pages/login.dart
Normal file
149
lib/pages/login.dart
Normal file
@@ -0,0 +1,149 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:ldh_flutter/const.dart';
|
||||
|
||||
class LoginPage extends StatelessWidget {
|
||||
const LoginPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: backgroundColor,
|
||||
body: Stack(
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
AppBar(
|
||||
backgroundColor: Colors.transparent,
|
||||
elevation: 0,
|
||||
leading: IconButton(
|
||||
icon: Icon(Icons.arrow_back, color: textColor),
|
||||
onPressed: () {},
|
||||
),
|
||||
title: Text(
|
||||
'Login',
|
||||
style: GoogleFonts.inter(
|
||||
color: textColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 20,
|
||||
),
|
||||
),
|
||||
centerTitle: true,
|
||||
actions: [SizedBox(width: 48)],
|
||||
),
|
||||
const Spacer(),
|
||||
|
||||
Container(
|
||||
padding: const EdgeInsets.fromLTRB(24, 32, 24, 8),
|
||||
decoration: BoxDecoration(color: backgroundColor),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
_buildTextField(
|
||||
icon: Icons.person_outline,
|
||||
hintText: 'Username',
|
||||
isDarkMode: isDarkMode,
|
||||
inputBackgroundColor: inputBackgroundColor,
|
||||
subtleTextColor: subtleTextColor,
|
||||
textColor: textColor,
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
_buildTextField(
|
||||
icon: Icons.person_outline,
|
||||
hintText: 'pasword',
|
||||
obscureText: true,
|
||||
isDarkMode: isDarkMode,
|
||||
inputBackgroundColor: inputBackgroundColor,
|
||||
subtleTextColor: subtleTextColor,
|
||||
textColor: textColor,
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
ElevatedButton(
|
||||
onPressed: () {},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: primaryColor,
|
||||
minimumSize: const Size(double.infinity, 60),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
elevation: 0,
|
||||
),
|
||||
child: Text(
|
||||
'Login',
|
||||
style: GoogleFonts.inter(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
TextButton(
|
||||
onPressed: () {},
|
||||
child: Text(
|
||||
'Forgot Password?',
|
||||
style: GoogleFonts.inter(
|
||||
color: primaryColor,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
TextButton(
|
||||
onPressed: () {},
|
||||
child: Text(
|
||||
'Sign up',
|
||||
style: GoogleFonts.inter(
|
||||
color: primaryColor,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Widget _buildTextField({
|
||||
required IconData icon,
|
||||
required String hintText,
|
||||
bool obscureText = false,
|
||||
required bool isDarkMode,
|
||||
required Color inputBackgroundColor,
|
||||
required Color subtleTextColor,
|
||||
required Color textColor,
|
||||
}) {
|
||||
return TextField(
|
||||
obscureText: obscureText,
|
||||
style: GoogleFonts.inter(color: textColor),
|
||||
decoration: InputDecoration(
|
||||
contentPadding: const EdgeInsets.symmetric(vertical: 20),
|
||||
hintText: hintText,
|
||||
hintStyle: GoogleFonts.inter(color: subtleTextColor),
|
||||
prefixIcon: Padding(
|
||||
padding: const EdgeInsets.only(left: 20, right: 12),
|
||||
child: Icon(icon, color: subtleTextColor),
|
||||
),
|
||||
filled: true,
|
||||
fillColor: inputBackgroundColor,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: BorderSide.none,
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: const BorderSide(color: Color(0xFF137FEC), width: 2),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user