141 lines
4.0 KiB
Dart
141 lines
4.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
void main() {
|
|
runApp(const MyApp());
|
|
}
|
|
|
|
class MyApp extends StatelessWidget {
|
|
const MyApp({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MaterialApp(
|
|
title: 'FitLife Login',
|
|
debugShowCheckedModeBanner: false,
|
|
theme: ThemeData(
|
|
primarySwatch: Colors.blue,
|
|
),
|
|
home: const LoginScreen(),
|
|
);
|
|
}
|
|
}
|
|
|
|
class LoginScreen extends StatefulWidget {
|
|
const LoginScreen({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
State<LoginScreen> createState() => _LoginScreenState();
|
|
}
|
|
|
|
class _LoginScreenState extends State<LoginScreen> {
|
|
final _emailController = TextEditingController();
|
|
final _passwordController = TextEditingController();
|
|
bool _isPasswordVisible = false;
|
|
|
|
@override
|
|
void dispose() {
|
|
_emailController.dispose();
|
|
_passwordController.dispose();
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
backgroundColor: Colors.white,
|
|
body: SafeArea(
|
|
child: Center(
|
|
child: SingleChildScrollView(
|
|
padding: const EdgeInsets.all(24.0),
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
// Logo
|
|
Icon(
|
|
Icons.fitness_center,
|
|
size: 80,
|
|
color: Colors.blue,
|
|
),
|
|
const SizedBox(height: 20),
|
|
|
|
// Title
|
|
Text(
|
|
'FitLife',
|
|
style: TextStyle(
|
|
fontSize: 32,
|
|
fontWeight: FontWeight.bold,
|
|
color: Colors.blue,
|
|
),
|
|
),
|
|
const SizedBox(height: 40),
|
|
|
|
// Email Field
|
|
TextField(
|
|
controller: _emailController,
|
|
decoration: InputDecoration(
|
|
labelText: 'Email',
|
|
prefixIcon: Icon(Icons.email),
|
|
border: OutlineInputBorder(
|
|
borderRadius: BorderRadius.circular(10),
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(height: 16),
|
|
|
|
// Password Field
|
|
TextField(
|
|
controller: _passwordController,
|
|
obscureText: !_isPasswordVisible,
|
|
decoration: InputDecoration(
|
|
labelText: 'Password',
|
|
prefixIcon: Icon(Icons.lock),
|
|
suffixIcon: IconButton(
|
|
icon: Icon(
|
|
_isPasswordVisible
|
|
? Icons.visibility
|
|
: Icons.visibility_off,
|
|
),
|
|
onPressed: () {
|
|
setState(() {
|
|
_isPasswordVisible = !_isPasswordVisible;
|
|
});
|
|
},
|
|
),
|
|
border: OutlineInputBorder(
|
|
borderRadius: BorderRadius.circular(10),
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(height: 24),
|
|
|
|
// Login Button
|
|
SizedBox(
|
|
width: double.infinity,
|
|
height: 50,
|
|
child: ElevatedButton(
|
|
onPressed: () {
|
|
// Handle login
|
|
},
|
|
child: Text(
|
|
'Login',
|
|
style: TextStyle(fontSize: 16),
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(height: 16),
|
|
|
|
// Sign Up Text
|
|
TextButton(
|
|
onPressed: () {
|
|
// Handle sign up
|
|
},
|
|
child: Text('Belum punya akun? Daftar'),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
} |