MIF_E31221281/TA-mobile/lib/screen/auth/auth_page.dart

95 lines
3.0 KiB
Dart

import 'package:flutter/material.dart';
import 'package:salon_app/components/login_form.dart';
import 'package:salon_app/components/register_form.dart';
class AuthPage extends StatefulWidget {
const AuthPage({super.key});
@override
State<AuthPage> createState() => _AuthPageState();
}
class _AuthPageState extends State<AuthPage> {
bool isSignIn = true;
@override
Widget build(BuildContext context) {
return Scaffold(
body: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(20),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const SizedBox(height: 50),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
'assets/icon/icon.jpg',
width: 30,
height: 30,
fit: BoxFit.contain,
),
const SizedBox(width: 8),
// Teks setelah gambar
const Flexible(
child: Text(
'Winda Salon',
style:
TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
overflow: TextOverflow.ellipsis,
),
),
],
),
const SizedBox(height: 8),
// Text(
// isSignIn ? 'Sign In' : 'Register',
// style: const TextStyle(fontSize: 28, fontWeight: FontWeight.bold),
// ),
const Text(
'Selamat Datang',
style: TextStyle(fontSize: 28, fontWeight: FontWeight.bold),
),
const SizedBox(height: 16),
isSignIn ? const LoginForm() : const RegisterForm(),
const SizedBox(height: 16),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Flexible(
child: Text(
isSignIn ? 'Belum punya akun?' : 'Sudah punya akun?',
style: const TextStyle(fontSize: 16),
overflow: TextOverflow.ellipsis,
),
),
TextButton(
onPressed: () {
setState(() {
isSignIn = !isSignIn;
});
},
child: Text(
isSignIn ? 'Register' : 'Sign In',
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
color: Colors.blue,
),
),
),
],
),
const SizedBox(height: 20),
],
),
),
),
);
}
}