diff --git a/lib/presentation/pages/auth/login/login_page.dart b/lib/presentation/pages/auth/login/login_page.dart index 781207e..f50ce9d 100644 --- a/lib/presentation/pages/auth/login/login_page.dart +++ b/lib/presentation/pages/auth/login/login_page.dart @@ -3,6 +3,7 @@ import 'package:flutter/material.dart'; import '../../../../common/theme/theme.dart'; import '../../../components/button/button.dart'; +import '../../../router/app_router.gr.dart'; import 'widgets/phone_field.dart'; @RoutePage() @@ -12,7 +13,6 @@ class LoginPage extends StatelessWidget { @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), @@ -27,7 +27,12 @@ class LoginPage extends StatelessWidget { const SizedBox(height: 50), // Continue Button - AppElevatedButton(onPressed: null, title: 'Lanjutkan'), + AppElevatedButton( + onPressed: () { + context.router.push(RegisterRoute()); + }, + title: 'Lanjutkan', + ), const SizedBox(height: 24), diff --git a/lib/presentation/pages/auth/register/register_page.dart b/lib/presentation/pages/auth/register/register_page.dart new file mode 100644 index 0000000..8261f43 --- /dev/null +++ b/lib/presentation/pages/auth/register/register_page.dart @@ -0,0 +1,41 @@ +import 'package:auto_route/auto_route.dart'; +import 'package:flutter/material.dart'; + +import '../../../components/button/button.dart'; +import 'widgets/name_field.dart'; +import 'widgets/phone_field.dart'; + +@RoutePage() +class RegisterPage extends StatelessWidget { + const RegisterPage({super.key}); + + @override + Widget build(BuildContext context) { + return Scaffold( + 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 + RegisterPhoneField(), + SizedBox(height: 24), + RegisterNameField(), + + const SizedBox(height: 50), + + Spacer(), + + // Continue Button + AppElevatedButton(onPressed: () {}, title: 'Daftar & Lanjutkan'), + + const SizedBox(height: 24), + ], + ), + ), + ); + } +} diff --git a/lib/presentation/pages/auth/register/widgets/name_field.dart b/lib/presentation/pages/auth/register/widgets/name_field.dart new file mode 100644 index 0000000..19462bf --- /dev/null +++ b/lib/presentation/pages/auth/register/widgets/name_field.dart @@ -0,0 +1,12 @@ +import 'package:flutter/material.dart'; + +import '../../../../components/field/field.dart'; + +class RegisterNameField extends StatelessWidget { + const RegisterNameField({super.key}); + + @override + Widget build(BuildContext context) { + return AppTextFormField(title: 'Masukkan nama', hintText: 'John Doe'); + } +} diff --git a/lib/presentation/pages/auth/register/widgets/phone_field.dart b/lib/presentation/pages/auth/register/widgets/phone_field.dart new file mode 100644 index 0000000..74e45e4 --- /dev/null +++ b/lib/presentation/pages/auth/register/widgets/phone_field.dart @@ -0,0 +1,71 @@ +import 'package:flutter/material.dart'; + +import '../../../../../common/theme/theme.dart'; +import '../../../../components/field/field.dart'; + +class RegisterPhoneField extends StatefulWidget { + const RegisterPhoneField({super.key}); + + @override + State createState() => _RegisterPhoneFieldState(); +} + +class _RegisterPhoneFieldState extends State { + 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(() {}); + }, + ); + } +} diff --git a/lib/presentation/router/app_router.dart b/lib/presentation/router/app_router.dart index d32fd3e..da35479 100644 --- a/lib/presentation/router/app_router.dart +++ b/lib/presentation/router/app_router.dart @@ -13,5 +13,6 @@ class AppRouter extends RootStackRouter { // Auth AutoRoute(page: LoginRoute.page), + AutoRoute(page: RegisterRoute.page), ]; } diff --git a/lib/presentation/router/app_router.gr.dart b/lib/presentation/router/app_router.gr.dart index ec111a7..e51f8b8 100644 --- a/lib/presentation/router/app_router.gr.dart +++ b/lib/presentation/router/app_router.gr.dart @@ -9,21 +9,23 @@ // coverage:ignore-file // ignore_for_file: no_leading_underscores_for_library_prefixes -import 'package:auto_route/auto_route.dart' as _i4; +import 'package:auto_route/auto_route.dart' as _i5; import 'package:enaklo/presentation/pages/auth/login/login_page.dart' as _i1; +import 'package:enaklo/presentation/pages/auth/register/register_page.dart' + as _i3; import 'package:enaklo/presentation/pages/onboarding/onboarding_page.dart' as _i2; -import 'package:enaklo/presentation/pages/splash/splash_page.dart' as _i3; +import 'package:enaklo/presentation/pages/splash/splash_page.dart' as _i4; /// generated route for /// [_i1.LoginPage] -class LoginRoute extends _i4.PageRouteInfo { - const LoginRoute({List<_i4.PageRouteInfo>? children}) +class LoginRoute extends _i5.PageRouteInfo { + const LoginRoute({List<_i5.PageRouteInfo>? children}) : super(LoginRoute.name, initialChildren: children); static const String name = 'LoginRoute'; - static _i4.PageInfo page = _i4.PageInfo( + static _i5.PageInfo page = _i5.PageInfo( name, builder: (data) { return const _i1.LoginPage(); @@ -33,13 +35,13 @@ class LoginRoute extends _i4.PageRouteInfo { /// generated route for /// [_i2.OnboardingPage] -class OnboardingRoute extends _i4.PageRouteInfo { - const OnboardingRoute({List<_i4.PageRouteInfo>? children}) +class OnboardingRoute extends _i5.PageRouteInfo { + const OnboardingRoute({List<_i5.PageRouteInfo>? children}) : super(OnboardingRoute.name, initialChildren: children); static const String name = 'OnboardingRoute'; - static _i4.PageInfo page = _i4.PageInfo( + static _i5.PageInfo page = _i5.PageInfo( name, builder: (data) { return const _i2.OnboardingPage(); @@ -48,17 +50,33 @@ class OnboardingRoute extends _i4.PageRouteInfo { } /// generated route for -/// [_i3.SplashPage] -class SplashRoute extends _i4.PageRouteInfo { - const SplashRoute({List<_i4.PageRouteInfo>? children}) +/// [_i3.RegisterPage] +class RegisterRoute extends _i5.PageRouteInfo { + const RegisterRoute({List<_i5.PageRouteInfo>? children}) + : super(RegisterRoute.name, initialChildren: children); + + static const String name = 'RegisterRoute'; + + static _i5.PageInfo page = _i5.PageInfo( + name, + builder: (data) { + return const _i3.RegisterPage(); + }, + ); +} + +/// generated route for +/// [_i4.SplashPage] +class SplashRoute extends _i5.PageRouteInfo { + const SplashRoute({List<_i5.PageRouteInfo>? children}) : super(SplashRoute.name, initialChildren: children); static const String name = 'SplashRoute'; - static _i4.PageInfo page = _i4.PageInfo( + static _i5.PageInfo page = _i5.PageInfo( name, builder: (data) { - return const _i3.SplashPage(); + return const _i4.SplashPage(); }, ); }