143 lines
5.4 KiB
Dart
143 lines
5.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
import '../controllers/login_controller.dart';
|
|
|
|
class LoginView extends GetView<LoginController> {
|
|
const LoginView({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
Get.put(LoginController());
|
|
|
|
return Scaffold(
|
|
backgroundColor: Colors.white,
|
|
body: SafeArea(
|
|
child: SingleChildScrollView(
|
|
padding: const EdgeInsets.all(24),
|
|
child: Center(
|
|
// Wrap the entire content inside Center widget to center vertically
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
const SizedBox(height: 20),
|
|
const Text(
|
|
'Login',
|
|
style: TextStyle(fontSize: 30, fontWeight: FontWeight.bold),
|
|
),
|
|
const SizedBox(height: 50),
|
|
Container(
|
|
decoration: BoxDecoration(
|
|
color: Colors.grey[100],
|
|
borderRadius: BorderRadius.circular(15),
|
|
),
|
|
child: TextField(
|
|
controller: controller.usernameController,
|
|
keyboardType: TextInputType.emailAddress,
|
|
decoration: InputDecoration(
|
|
hintText: 'Masukkan email',
|
|
hintStyle: TextStyle(color: Colors.grey[400]),
|
|
prefixIcon: Icon(
|
|
Icons.mail_outline,
|
|
color: Colors.grey[400],
|
|
),
|
|
border: InputBorder.none,
|
|
contentPadding: const EdgeInsets.all(20),
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(height: 20),
|
|
Obx(
|
|
() => Container(
|
|
decoration: BoxDecoration(
|
|
color: Colors.grey[100],
|
|
borderRadius: BorderRadius.circular(15),
|
|
),
|
|
child: TextField(
|
|
controller: controller.passwordController,
|
|
obscureText: controller.isPasswordHidden.value,
|
|
decoration: InputDecoration(
|
|
hintText: 'Masukkan password',
|
|
hintStyle: TextStyle(color: Colors.grey[400]),
|
|
prefixIcon: Icon(
|
|
Icons.lock_outline,
|
|
color: Colors.grey[400],
|
|
),
|
|
suffixIcon: IconButton(
|
|
icon: Icon(
|
|
controller.isPasswordHidden.value
|
|
? Icons.visibility_off_outlined
|
|
: Icons.visibility_outlined,
|
|
color: Colors.grey[400],
|
|
),
|
|
onPressed: controller.togglePasswordVisibility,
|
|
),
|
|
border: InputBorder.none,
|
|
contentPadding: const EdgeInsets.all(20),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(height: 30),
|
|
Obx(
|
|
() => SizedBox(
|
|
width: double.infinity,
|
|
height: 55,
|
|
child: ElevatedButton(
|
|
onPressed: controller.isLoading.value
|
|
? null
|
|
: controller.login,
|
|
style: ElevatedButton.styleFrom(
|
|
backgroundColor: const Color(0xFF1976D2),
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(15),
|
|
),
|
|
),
|
|
child: controller.isLoading.value
|
|
? const SizedBox(
|
|
height: 20,
|
|
width: 20,
|
|
child: CircularProgressIndicator(
|
|
color: Colors.white,
|
|
strokeWidth: 2,
|
|
),
|
|
)
|
|
: const Text(
|
|
'Login',
|
|
style: TextStyle(
|
|
fontSize: 18,
|
|
fontWeight: FontWeight.w600,
|
|
color: Colors.white,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(height: 20),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
const Text(
|
|
"Tidak memiliki akun? ",
|
|
style: TextStyle(color: Colors.black87),
|
|
),
|
|
TextButton(
|
|
onPressed: controller.contactNurse,
|
|
child: const Text(
|
|
'Hubungi Perawat',
|
|
style: TextStyle(
|
|
color: Color(0xFF1976D2),
|
|
fontWeight: FontWeight.w600,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|