TKK_E32220112/Aplikasi Mobile/lib/app/modules/signup/views/signup_view.dart

157 lines
4.5 KiB
Dart

import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:siparkir/app/modules/signup/controllers/signup_controller.dart';
class SignupView extends GetView<SignupController> {
const SignupView({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: const Color.fromARGB(255, 253, 253, 253),
body: SafeArea(
child: SingleChildScrollView(
child: Center(
child: Padding(
padding: const EdgeInsets.all(20.0),
child: Column(
children: [
const SizedBox(height: 40),
_buildTitle(),
const SizedBox(height: 20),
_buildSignupCard(),
],
),
),
),
),
),
);
}
Widget _buildTitle() {
return Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
"Buat Akun Anda",
style: GoogleFonts.poppins(
color: Colors.black,
fontSize: 22,
fontWeight: FontWeight.bold,
),
),
Text(
"Daftar untuk memulai",
style: GoogleFonts.poppins(
fontSize: 16,
color: Colors.black54,
),
),
],
);
}
Widget _buildSignupCard() {
return Card(
color: Colors.white,
elevation: 6,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(18),
),
child: Padding(
padding: const EdgeInsets.all(20.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildInputField("Nama Lengkap", controller.nameController, false),
const SizedBox(height: 15),
_buildInputField("Devisi", controller.devisiController, false), // ← tambahkan
const SizedBox(height: 15),
_buildInputField("No Telepon", controller.noTelpController, false), // ← tambahkan
const SizedBox(height: 15),
_buildInputField("Email", controller.emailController, false),
const SizedBox(height: 15),
_buildInputField("Password", controller.passwordController, true),
const SizedBox(height: 20),
_buildSignupButton(),
const SizedBox(height: 10),
_buildLoginOption(),
],
),
),
);
}
Widget _buildInputField(String label, TextEditingController controller, bool isObscure) {
return TextField(
controller: controller,
obscureText: isObscure,
decoration: InputDecoration(
labelText: label,
labelStyle: GoogleFonts.poppins(
color: Colors.black54,
fontSize: 14,
),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(12),
),
filled: true,
fillColor: Colors.white,
),
);
}
Widget _buildSignupButton() {
return SizedBox(
width: double.infinity,
child: Obx(() => ElevatedButton(
onPressed: controller.isLoading.value ? null : controller.signup,
style: ElevatedButton.styleFrom(
backgroundColor: Colors.black,
padding: const EdgeInsets.symmetric(vertical: 15),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
),
child: controller.isLoading.value
? const CircularProgressIndicator(color: Colors.white)
: Text(
"Daftar",
style: GoogleFonts.poppins(
color: Colors.white,
fontSize: 16,
fontWeight: FontWeight.bold,
),
),
)),
);
}
Widget _buildLoginOption() {
return Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"Saya Sudah Memiliki Akun ",
style: GoogleFonts.poppins(fontSize: 14, color: Colors.black54),
),
TextButton(
onPressed: () => Get.toNamed('/login'),
child: Text(
"Masuk",
style: GoogleFonts.poppins(
fontSize: 14,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
),
],
),
);
}
}