2024-09-23 09:34:20 +00:00
|
|
|
import 'package:agrilink_vocpro/core/constant/app_theme.dart';
|
|
|
|
|
import 'package:agrilink_vocpro/core/route/app_route.dart';
|
|
|
|
|
import 'package:agrilink_vocpro/core/widgets/app_button.dart';
|
|
|
|
|
import 'package:agrilink_vocpro/core/widgets/app_textfield.dart';
|
|
|
|
|
import 'package:agrilink_vocpro/features/auth/provider/auth_provider.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:go_router/go_router.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
|
|
class LoginScreen extends StatelessWidget {
|
|
|
|
|
const LoginScreen({super.key});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return Scaffold(
|
|
|
|
|
body: GestureDetector(
|
|
|
|
|
onTap: () {
|
|
|
|
|
FocusScope.of(context).unfocus();
|
|
|
|
|
},
|
|
|
|
|
child: SafeArea(
|
|
|
|
|
child: Consumer<AuthProvider>(builder: (context, authP, child) {
|
|
|
|
|
return ListView(
|
|
|
|
|
padding: const EdgeInsets.all(16),
|
|
|
|
|
children: [
|
|
|
|
|
const SizedBox(height: 40),
|
|
|
|
|
Text(
|
|
|
|
|
'Hello Wellcome back 👋',
|
|
|
|
|
style: AppTheme.titleLarge,
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
'Happy to have you back',
|
|
|
|
|
style: AppTheme.titleMedium,
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(height: 40),
|
|
|
|
|
Text('Email address', style: AppTheme.labelLarge),
|
|
|
|
|
const SizedBox(height: 4),
|
|
|
|
|
AppTextfield(
|
|
|
|
|
controller: authP.emailController,
|
|
|
|
|
hintText: 'Masukkan username',
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(height: 24),
|
|
|
|
|
Text('Password', style: AppTheme.labelLarge),
|
|
|
|
|
const SizedBox(height: 4),
|
|
|
|
|
AppTextfield(
|
|
|
|
|
controller: authP.passwordController,
|
|
|
|
|
hintText: 'Masukkan password',
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(height: 24),
|
|
|
|
|
const SizedBox(height: 24),
|
|
|
|
|
AppButton(
|
|
|
|
|
onPressed: () {
|
|
|
|
|
GoRouter.of(context).go(AppRoute.dashboard);
|
|
|
|
|
},
|
|
|
|
|
text: 'Login'),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|