improve this code
import 'package:firebase_ui_auth/firebase_ui_auth.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'auth_providers.dart';
class CustomSignInScreen extends ConsumerWidget {
const CustomSignInScreen({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
final authProviders = ref.watch(authProvidersProvider);
return Scaffold(
appBar: AppBar(
title: const Text(
'HADIR-IN',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
),
centerTitle: true,
backgroundColor: Colors.blueAccent,
elevation: 4,
),
body: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 20.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
// Header Customization
Column(
children: [
Image.asset('assets/smp2.jpg', height: 100),
const SizedBox(height: 10),
const Text(
'Selamat Datang di Aplikasi Absensi',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w600,
color: Colors.black87,
),
textAlign: TextAlign.center,
),
const SizedBox(height: 20),
],
),
Expanded(
child: SignInScreen(
providers: authProviders,
footerBuilder: (context, action) {
return Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
children: [
const Text(
'Dengan masuk, Anda menyetujui syarat dan ketentuan kami.',
style: TextStyle(fontSize: 12, color: Colors.black54),
textAlign: TextAlign.center,
),
const SizedBox(height: 10),
TextButton(
onPressed: () {
// Tambahkan navigasi ke halaman bantuan jika ada
},
child: const Text(
'Butuh bantuan?',
style: TextStyle(color: Colors.blueAccent),
),
),
],
),
);
},
),
),
],
),
),
backgroundColor: Colors.white,
);
}
}
I'll improve your Flutter authentication screen with better structure, responsiveness, and error handling:
Code Structure:
UI Improvements:
Performance:
Maintainability:
Functionality:
This implementation follows Flutter best practices and makes your code more maintainable, responsive, and user-friendly.