feat: register page
This commit is contained in:
parent
16bafb7e17
commit
59e61fe6c8
@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
|||||||
|
|
||||||
import '../../../../common/theme/theme.dart';
|
import '../../../../common/theme/theme.dart';
|
||||||
import '../../../components/button/button.dart';
|
import '../../../components/button/button.dart';
|
||||||
|
import '../../../router/app_router.gr.dart';
|
||||||
import 'widgets/phone_field.dart';
|
import 'widgets/phone_field.dart';
|
||||||
|
|
||||||
@RoutePage()
|
@RoutePage()
|
||||||
@ -12,7 +13,6 @@ class LoginPage extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: AppColor.backgroundLight,
|
|
||||||
appBar: AppBar(title: const Text('Masuk')),
|
appBar: AppBar(title: const Text('Masuk')),
|
||||||
body: Padding(
|
body: Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 24.0),
|
padding: const EdgeInsets.symmetric(horizontal: 24.0),
|
||||||
@ -27,7 +27,12 @@ class LoginPage extends StatelessWidget {
|
|||||||
const SizedBox(height: 50),
|
const SizedBox(height: 50),
|
||||||
|
|
||||||
// Continue Button
|
// Continue Button
|
||||||
AppElevatedButton(onPressed: null, title: 'Lanjutkan'),
|
AppElevatedButton(
|
||||||
|
onPressed: () {
|
||||||
|
context.router.push(RegisterRoute());
|
||||||
|
},
|
||||||
|
title: 'Lanjutkan',
|
||||||
|
),
|
||||||
|
|
||||||
const SizedBox(height: 24),
|
const SizedBox(height: 24),
|
||||||
|
|
||||||
|
|||||||
41
lib/presentation/pages/auth/register/register_page.dart
Normal file
41
lib/presentation/pages/auth/register/register_page.dart
Normal file
@ -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),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
12
lib/presentation/pages/auth/register/widgets/name_field.dart
Normal file
12
lib/presentation/pages/auth/register/widgets/name_field.dart
Normal file
@ -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');
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -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<RegisterPhoneField> createState() => _RegisterPhoneFieldState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _RegisterPhoneFieldState extends State<RegisterPhoneField> {
|
||||||
|
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(() {});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -13,5 +13,6 @@ class AppRouter extends RootStackRouter {
|
|||||||
|
|
||||||
// Auth
|
// Auth
|
||||||
AutoRoute(page: LoginRoute.page),
|
AutoRoute(page: LoginRoute.page),
|
||||||
|
AutoRoute(page: RegisterRoute.page),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,21 +9,23 @@
|
|||||||
// coverage:ignore-file
|
// coverage:ignore-file
|
||||||
|
|
||||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
// 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/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'
|
import 'package:enaklo/presentation/pages/onboarding/onboarding_page.dart'
|
||||||
as _i2;
|
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
|
/// generated route for
|
||||||
/// [_i1.LoginPage]
|
/// [_i1.LoginPage]
|
||||||
class LoginRoute extends _i4.PageRouteInfo<void> {
|
class LoginRoute extends _i5.PageRouteInfo<void> {
|
||||||
const LoginRoute({List<_i4.PageRouteInfo>? children})
|
const LoginRoute({List<_i5.PageRouteInfo>? children})
|
||||||
: super(LoginRoute.name, initialChildren: children);
|
: super(LoginRoute.name, initialChildren: children);
|
||||||
|
|
||||||
static const String name = 'LoginRoute';
|
static const String name = 'LoginRoute';
|
||||||
|
|
||||||
static _i4.PageInfo page = _i4.PageInfo(
|
static _i5.PageInfo page = _i5.PageInfo(
|
||||||
name,
|
name,
|
||||||
builder: (data) {
|
builder: (data) {
|
||||||
return const _i1.LoginPage();
|
return const _i1.LoginPage();
|
||||||
@ -33,13 +35,13 @@ class LoginRoute extends _i4.PageRouteInfo<void> {
|
|||||||
|
|
||||||
/// generated route for
|
/// generated route for
|
||||||
/// [_i2.OnboardingPage]
|
/// [_i2.OnboardingPage]
|
||||||
class OnboardingRoute extends _i4.PageRouteInfo<void> {
|
class OnboardingRoute extends _i5.PageRouteInfo<void> {
|
||||||
const OnboardingRoute({List<_i4.PageRouteInfo>? children})
|
const OnboardingRoute({List<_i5.PageRouteInfo>? children})
|
||||||
: super(OnboardingRoute.name, initialChildren: children);
|
: super(OnboardingRoute.name, initialChildren: children);
|
||||||
|
|
||||||
static const String name = 'OnboardingRoute';
|
static const String name = 'OnboardingRoute';
|
||||||
|
|
||||||
static _i4.PageInfo page = _i4.PageInfo(
|
static _i5.PageInfo page = _i5.PageInfo(
|
||||||
name,
|
name,
|
||||||
builder: (data) {
|
builder: (data) {
|
||||||
return const _i2.OnboardingPage();
|
return const _i2.OnboardingPage();
|
||||||
@ -48,17 +50,33 @@ class OnboardingRoute extends _i4.PageRouteInfo<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// generated route for
|
/// generated route for
|
||||||
/// [_i3.SplashPage]
|
/// [_i3.RegisterPage]
|
||||||
class SplashRoute extends _i4.PageRouteInfo<void> {
|
class RegisterRoute extends _i5.PageRouteInfo<void> {
|
||||||
const SplashRoute({List<_i4.PageRouteInfo>? children})
|
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<void> {
|
||||||
|
const SplashRoute({List<_i5.PageRouteInfo>? children})
|
||||||
: super(SplashRoute.name, initialChildren: children);
|
: super(SplashRoute.name, initialChildren: children);
|
||||||
|
|
||||||
static const String name = 'SplashRoute';
|
static const String name = 'SplashRoute';
|
||||||
|
|
||||||
static _i4.PageInfo page = _i4.PageInfo(
|
static _i5.PageInfo page = _i5.PageInfo(
|
||||||
name,
|
name,
|
||||||
builder: (data) {
|
builder: (data) {
|
||||||
return const _i3.SplashPage();
|
return const _i4.SplashPage();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user