feat: login page
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../../common/theme/theme.dart';
|
||||
import '../../../components/button/button.dart';
|
||||
import 'widgets/phone_field.dart';
|
||||
|
||||
@RoutePage()
|
||||
class LoginPage extends StatelessWidget {
|
||||
const LoginPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColor.backgroundLight,
|
||||
appBar: AppBar(title: const Text('Masuk')),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(height: 40),
|
||||
|
||||
// Title
|
||||
LoginPhoneField(),
|
||||
|
||||
const SizedBox(height: 50),
|
||||
|
||||
// Continue Button
|
||||
AppElevatedButton(onPressed: null, title: 'Lanjutkan'),
|
||||
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// Terms and Conditions
|
||||
Center(
|
||||
child: RichText(
|
||||
textAlign: TextAlign.center,
|
||||
text: TextSpan(
|
||||
style: AppStyle.md.copyWith(
|
||||
color: AppColor.textSecondary,
|
||||
height: 1.4,
|
||||
),
|
||||
children: [
|
||||
const TextSpan(
|
||||
text: 'Dengan masuk Enaklo, kamu telah\nmenyetujui ',
|
||||
),
|
||||
TextSpan(
|
||||
text: 'Syarat & Ketentuan',
|
||||
style: AppStyle.md.copyWith(
|
||||
color: AppColor.primary,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
const TextSpan(text: ' dan\n'),
|
||||
TextSpan(
|
||||
text: 'Kebijakan Privasi',
|
||||
style: AppStyle.md.copyWith(
|
||||
color: AppColor.primary,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 40),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../../../common/theme/theme.dart';
|
||||
import '../../../../components/field/field.dart';
|
||||
|
||||
class LoginPhoneField extends StatefulWidget {
|
||||
const LoginPhoneField({super.key});
|
||||
|
||||
@override
|
||||
State<LoginPhoneField> createState() => _LoginPhoneFieldState();
|
||||
}
|
||||
|
||||
class _LoginPhoneFieldState extends State<LoginPhoneField> {
|
||||
final TextEditingController _controller = TextEditingController();
|
||||
final FocusNode _focusNode = FocusNode();
|
||||
bool _hasFocus = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_focusNode.addListener(() {
|
||||
setState(() {
|
||||
_hasFocus = _focusNode.hasFocus;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_controller.dispose();
|
||||
_focusNode.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void _clearText() {
|
||||
_controller.clear();
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AppTextFormField(
|
||||
title: 'Masukkan no telepon',
|
||||
hintText: '8712671212',
|
||||
controller: _controller,
|
||||
focusNode: _focusNode,
|
||||
keyboardType: TextInputType.phone,
|
||||
prefixIcon: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||
child: Text(
|
||||
'+62',
|
||||
style: AppStyle.md.copyWith(
|
||||
color: AppColor.textPrimary,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
suffixIcon: (_hasFocus && _controller.text.isNotEmpty)
|
||||
? IconButton(
|
||||
onPressed: _clearText,
|
||||
icon: Icon(Icons.close, color: AppColor.primary, size: 20),
|
||||
constraints: const BoxConstraints(),
|
||||
padding: const EdgeInsets.all(8),
|
||||
)
|
||||
: null,
|
||||
onChanged: (value) {
|
||||
setState(() {});
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import '../../../common/theme/theme.dart';
|
||||
import '../../components/assets/assets.gen.dart';
|
||||
import '../../components/button/button.dart';
|
||||
import '../../components/image/image.dart';
|
||||
import '../../router/app_router.gr.dart';
|
||||
|
||||
@RoutePage()
|
||||
class OnboardingPage extends StatefulWidget {
|
||||
@@ -171,7 +172,10 @@ class _OnboardingPageState extends State<OnboardingPage> {
|
||||
|
||||
const Spacer(),
|
||||
|
||||
AppElevatedButton(onPressed: () {}, title: 'Masuk'),
|
||||
AppElevatedButton(
|
||||
onPressed: () => context.router.push(const LoginRoute()),
|
||||
title: 'Masuk',
|
||||
),
|
||||
|
||||
const SizedBox(height: 12),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user