master #81

Closed
malo wants to merge 322 commits from master into feat/bloc_layout/new-package
14 changed files with 302 additions and 141 deletions
Showing only changes of commit 1de922f644 - Show all commits

View File

@ -1,19 +0,0 @@
// Copyright (C) 2023 WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
abstract class AppFormName {
static const editProfile = 'editProfile';
}

View File

@ -14,9 +14,10 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
import 'package:example_router/presentation/features/authentication/sign_in/sign_in_page.dart';
import 'package:example_router/presentation/features/authentication/sign_up/sign_up_page.dart';
import 'package:example_router/presentation/features/edit_account/edit_account_page.dart';
import 'package:example_router/presentation/features/home/home_page.dart'; import 'package:example_router/presentation/features/home/home_page.dart';
import 'package:example_router/presentation/features/sign_in/sign_in_page.dart';
import 'package:example_router/presentation/features/sign_up/sign_up_page.dart';
import 'package:example_router/presentation/features/sub/sub_page.dart'; import 'package:example_router/presentation/features/sub/sub_page.dart';
import 'package:example_router/presentation/features/welcome/welcome_page.dart'; import 'package:example_router/presentation/features/welcome/welcome_page.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
@ -82,6 +83,15 @@ class AppRouter {
const SubPage(), const SubPage(),
), ),
), ),
GoRoute(
path: 'edit_account',
name: EditAccountPage.pageName,
pageBuilder: (context, state) => defaultTransition(
context,
state,
const EditAccountPage(),
),
),
]), ]),
]; ];
} }

View File

@ -16,14 +16,13 @@
import 'dart:async'; import 'dart:async';
import 'package:example_router/core/constants/form_field.dart';
import 'package:example_router/core/dependency_injection/get_it.dart'; import 'package:example_router/core/dependency_injection/get_it.dart';
import 'package:example_router/core/routes/router.dart'; import 'package:example_router/core/routes/router.dart';
import 'package:example_router/core/utils/custom_password.dart'; import 'package:example_router/core/utils/custom_password.dart';
import 'package:example_router/core/utils/forms.dart';
import 'package:example_router/presentation/features/authentication/authentication_cubit.dart'; import 'package:example_router/presentation/features/authentication/authentication_cubit.dart';
import 'package:example_router/presentation/features/sign_in/blocs/custom_sign_in_cubit.dart'; import 'package:example_router/presentation/features/authentication/sign_in/blocs/sign_in_cubit.dart';
import 'package:example_router/presentation/features/sign_up/blocs/custom_sign_up_cubit.dart'; import 'package:example_router/presentation/features/authentication/sign_up/blocs/sign_up_cubit.dart';
import 'package:example_router/presentation/features/edit_account/blocs/edit_account_cubit.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
@ -38,7 +37,7 @@ class App extends StatelessWidget {
customPasswordValidator: const CustomPassword.pure(), customPasswordValidator: const CustomPassword.pure(),
extraSignUpInputs: [ extraSignUpInputs: [
FormInput( FormInput(
AppFormField.confirmedPassword, AuthFormField.confirmPassword,
const ConfirmedPassword.pure(), const ConfirmedPassword.pure(),
metadata: const FormInputMetadata<void>(export: false), metadata: const FormInputMetadata<void>(export: false),
), ),
@ -90,9 +89,8 @@ class App extends StatelessWidget {
value: authenticationRepository, value: authenticationRepository,
), ),
RepositoryProvider<FormRepository>( RepositoryProvider<FormRepository>(
create: (context) => create: (context) => FormRepositoryImpl(),
FormRepositoryImpl()..registerForm(AppForms.getEditProfileForm()), )
),
], ],
child: MultiBlocProvider( child: MultiBlocProvider(
providers: [ providers: [
@ -100,12 +98,17 @@ class App extends StatelessWidget {
value: authenticationCubit, value: authenticationCubit,
), ),
BlocProvider<SignUpCubit<int>>( BlocProvider<SignUpCubit<int>>(
create: (_) => CustomSignUpCubit( create: (_) => ExampleSignUpCubit(
authenticationRepository: authenticationRepository, authenticationRepository: authenticationRepository,
), ),
), ),
BlocProvider<SignInCubit<int>>( BlocProvider<SignInCubit<int>>(
create: (_) => CustomSignInCubit( create: (_) => ExampleSignInCubit(
authenticationRepository: authenticationRepository,
),
),
BlocProvider<EditAccountCubit<int>>(
create: (_) => ExampleEditAccountCubit(
authenticationRepository: authenticationRepository, authenticationRepository: authenticationRepository,
), ),
), ),

View File

@ -14,33 +14,35 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
import 'package:wyatt_architecture/src/domain/usecases/usecase.dart'; import 'package:wyatt_architecture/wyatt_architecture.dart';
import 'package:wyatt_architecture/src/core/exceptions/exceptions.dart';
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart'; import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
import 'package:wyatt_type_utils/src/either/either_base.dart'; import 'package:wyatt_form_bloc/wyatt_form_bloc.dart';
import 'package:wyatt_form_bloc/src/domain/form/wyatt_form.dart'; import 'package:wyatt_type_utils/wyatt_type_utils.dart';
class CustomSignInCubit extends SignInCubit<int> { class ExampleSignInCubit extends SignInCubit<int> {
CustomSignInCubit({ ExampleSignInCubit({
required super.authenticationRepository, required super.authenticationRepository,
}); });
@override @override
FutureOrResult<int?> onSignInWithEmailAndPassword(Result<Account, AppException> result, WyattForm form) { FutureOrResult<int?> onSignInWithEmailAndPassword(
Result<Account, AppException> result, WyattForm form) {
print('onSignInWithEmailAndPassword'); print('onSignInWithEmailAndPassword');
return const Ok(1); return const Ok(1);
} }
@override @override
FutureOrResult<int?> onSignInAnonymously(Result<Account, AppException> result, WyattForm form) { FutureOrResult<int?> onSignInAnonymously(
Result<Account, AppException> result, WyattForm form) {
print('onSignInAnonymously'); print('onSignInAnonymously');
return const Ok(1); return const Ok(1);
} }
@override @override
FutureOrResult<int?> onSignInWithGoogle(Result<Account, AppException> result, WyattForm form) { FutureOrResult<int?> onSignInWithGoogle(
Result<Account, AppException> result, WyattForm form) {
print('onSignInWithGoogle'); print('onSignInWithGoogle');
return const Ok(1); return const Ok(1);

View File

@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
import 'package:example_router/presentation/features/sign_in/widgets/sign_in_form.dart'; import 'package:example_router/presentation/features/authentication/sign_in/widgets/sign_in_form.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class SignInPage extends StatelessWidget { class SignInPage extends StatelessWidget {

View File

@ -121,21 +121,19 @@ class SignInForm extends StatelessWidget {
..showSnackBar( ..showSnackBar(
SnackBar(content: Text(errorMessage ?? 'Sign In Failure')), SnackBar(content: Text(errorMessage ?? 'Sign In Failure')),
), ),
child: SingleChildScrollView( child: ListView(
child: Column( shrinkWrap: true,
crossAxisAlignment: CrossAxisAlignment.center, children: [
children: [ _EmailInput(),
_EmailInput(), const SizedBox(height: 8),
const SizedBox(height: 8), _PasswordInput(),
_PasswordInput(), const SizedBox(height: 16),
const SizedBox(height: 16), _SignInButton(),
_SignInButton(), const SizedBox(height: 16),
const SizedBox(height: 16), _SignInAnonymouslyButton(),
_SignInAnonymouslyButton(), const SizedBox(height: 16),
const SizedBox(height: 16), _SignInWithGoogleButton(),
_SignInWithGoogleButton(), ],
],
),
), ),
); );
} }

View File

@ -14,34 +14,21 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
import 'package:wyatt_architecture/wyatt_architecture.dart'; import 'package:wyatt_architecture/wyatt_architecture.dart';
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart'; import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
import 'package:wyatt_form_bloc/wyatt_form_bloc.dart'; import 'package:wyatt_form_bloc/wyatt_form_bloc.dart';
import 'package:wyatt_type_utils/wyatt_type_utils.dart'; import 'package:wyatt_type_utils/wyatt_type_utils.dart';
class CustomSignUpCubit extends SignUpCubit<int> { class ExampleSignUpCubit extends SignUpCubit<int> {
CustomSignUpCubit({ ExampleSignUpCubit({
required super.authenticationRepository, required super.authenticationRepository,
}); });
@override
FutureOrResult<int?> onSignUpWithEmailAndPassword(Result<Account, AppException> result, WyattForm form) async {
// if (result.isOk) {
// await Future.delayed(const Duration(seconds: 3));
// const id = -1;
// final confirmedPassword =
// form.valueOf<String?>(AppFormField.confirmedPassword);
// debugPrint( @override
// 'onSignUpSuccess: ${result.ok}, generatedId: $id, intFormData: $confirmedPassword'); FutureOrResult<int?> onSignUpWithEmailAndPassword(
// return const Ok<int, AppException>(id); Result<Account, AppException> result, WyattForm form) async {
// }
// return const Ok(null);
print('onSignUpWithEmailAndPassword'); print('onSignUpWithEmailAndPassword');
return const Ok(1); return const Ok(1);
} }
} }

View File

@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
import 'package:example_router/presentation/features/sign_up/widgets/sign_up_form.dart'; import 'package:example_router/presentation/features/authentication/sign_up/widgets/sign_up_form.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class SignUpPage extends StatelessWidget { class SignUpPage extends StatelessWidget {

View File

@ -14,7 +14,6 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
import 'package:example_router/core/constants/form_field.dart';
import 'package:example_router/core/utils/custom_password.dart'; import 'package:example_router/core/utils/custom_password.dart';
import 'package:flutter/material.dart' hide FormField; import 'package:flutter/material.dart' hide FormField;
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart'; import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
@ -51,11 +50,11 @@ class _PasswordInput extends StatelessWidget {
cubit.passwordCustomChanged<CustomPassword>( cubit.passwordCustomChanged<CustomPassword>(
CustomPassword.dirty(pwd)); CustomPassword.dirty(pwd));
cubit.dataChanged( cubit.dataChanged(
AppFormField.confirmedPassword, AuthFormField.confirmPassword,
ConfirmedPassword.dirty( ConfirmedPassword.dirty(
password: pwd, password: pwd,
value: state.form value: state.form
.valueOf<String?>(AppFormField.confirmedPassword))); .valueOf<String?>(AuthFormField.confirmPassword)));
}, },
obscureText: true, obscureText: true,
decoration: InputDecoration( decoration: InputDecoration(
@ -73,7 +72,7 @@ class _ConfirmPasswordInput extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return InputBuilder<SignUpCubit<int>>( return InputBuilder<SignUpCubit<int>>(
field: AppFormField.confirmedPassword, field: AuthFormField.confirmPassword,
builder: ((context, cubit, state, field, input) { builder: ((context, cubit, state, field, input) {
return TextField( return TextField(
onChanged: (pwd) { onChanged: (pwd) {
@ -106,7 +105,9 @@ class _SignUpButton extends StatelessWidget {
return status.isSubmissionInProgress return status.isSubmissionInProgress
? const CircularProgressIndicator() ? const CircularProgressIndicator()
: ElevatedButton( : ElevatedButton(
onPressed: status.isValidated ? () => cubit.signUpWithEmailPassword() : null, onPressed: status.isValidated
? () => cubit.signUpWithEmailPassword()
: null,
child: const Text('Sign up'), child: const Text('Sign up'),
); );
}), }),
@ -126,18 +127,17 @@ class SignUpForm extends StatelessWidget {
..showSnackBar( ..showSnackBar(
SnackBar(content: Text(errorMessage ?? 'Sign Up Failure')), SnackBar(content: Text(errorMessage ?? 'Sign Up Failure')),
), ),
child: SingleChildScrollView( child: ListView(
child: Column( shrinkWrap: true,
children: [ children: [
_EmailInput(), _EmailInput(),
const SizedBox(height: 8), const SizedBox(height: 8),
_PasswordInput(), _PasswordInput(),
const SizedBox(height: 8), const SizedBox(height: 8),
_ConfirmPasswordInput(), _ConfirmPasswordInput(),
const SizedBox(height: 16), const SizedBox(height: 16),
_SignUpButton(), _SignUpButton(),
], ],
),
)); ));
} }
} }

View File

@ -14,19 +14,27 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
import 'package:example_router/core/constants/form_field.dart'; import 'package:wyatt_architecture/wyatt_architecture.dart';
import 'package:example_router/core/constants/form_name.dart';
import 'package:example_router/core/utils/custom_password.dart';
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart'; import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
import 'package:wyatt_form_bloc/wyatt_form_bloc.dart'; import 'package:wyatt_form_bloc/wyatt_form_bloc.dart';
import 'package:wyatt_type_utils/wyatt_type_utils.dart';
abstract class AppForms { class ExampleEditAccountCubit extends EditAccountCubit<int> {
static WyattForm getEditProfileForm() => WyattFormImpl( ExampleEditAccountCubit({required super.authenticationRepository});
[
FormInput(AuthFormField.email, const Email.pure()), @override
FormInput(AuthFormField.password, const CustomPassword.pure()), FutureOrResult<int?> onEmailUpdated(
FormInput(AppFormField.oldPassword, const CustomPassword.pure()), Result<Account, AppException> result, WyattForm form) async {
], print('onEmailUpdated');
name: AppFormName.editProfile,
); return const Ok(1);
}
@override
FutureOrResult<int?> onPasswordUpdated(
Result<Account, AppException> result, WyattForm form) async {
print('onPasswordUpdated');
return const Ok(1);
}
} }

View File

@ -14,7 +14,24 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
abstract class AppFormField { import 'package:example_router/presentation/features/edit_account/widgets/edit_account_form.dart';
static const oldPassword = 'oldPassword'; import 'package:flutter/material.dart';
static const confirmedPassword = 'confirmedPassword';
class EditAccountPage extends StatelessWidget {
const EditAccountPage({Key? key}) : super(key: key);
static String pageName = 'EditAccount';
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Edit Account')),
body: const Padding(
padding: EdgeInsets.all(8),
child: SingleChildScrollView(
child: EditAccountForm(),
),
),
);
}
} }

View File

@ -0,0 +1,151 @@
// Copyright (C) 2023 WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
import 'package:example_router/core/utils/custom_password.dart';
import 'package:flutter/material.dart';
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
import 'package:wyatt_form_bloc/wyatt_form_bloc.dart';
class _EmailInput extends StatelessWidget {
@override
Widget build(BuildContext context) {
return InputBuilder<EditAccountCubit<int>>(
field: AuthFormField.email,
builder: ((context, cubit, state, field, input) {
return TextField(
onChanged: (email) => cubit.emailChanged(email),
keyboardType: TextInputType.emailAddress,
decoration: InputDecoration(
labelText: 'Email',
helperText: '',
errorText: input.validator.invalid ? 'Invalid email' : null,
),
);
}),
);
}
}
class _PasswordInput extends StatelessWidget {
@override
Widget build(BuildContext context) {
return InputBuilder<EditAccountCubit<int>>(
field: AuthFormField.password,
builder: ((context, cubit, state, field, input) {
return TextField(
onChanged: (pwd) => cubit
.passwordCustomChanged<CustomPassword>(CustomPassword.dirty(pwd)),
obscureText: true,
decoration: InputDecoration(
labelText: 'Password',
helperText: '',
errorText: input.validator.invalid ? 'Invalid password' : null,
),
);
}),
);
}
}
class _EditAccountButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
return SubmitBuilder<EditAccountCubit<int>>(
builder: ((context, cubit, status) {
return status.isSubmissionInProgress
? const CircularProgressIndicator()
: ElevatedButton(
onPressed: status.isValidated
? () {
cubit.updateEmail();
cubit.updatePassword();
}
: null,
child: const Text('Update Account'),
);
}),
);
}
}
class _EditAccountEmailButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
return SubmitBuilder<EditAccountCubit<int>>(
builder: ((context, cubit, status) {
return status.isSubmissionInProgress
? const CircularProgressIndicator()
: ElevatedButton(
onPressed: status.isValidated
? () {
cubit.updateEmail();
}
: null,
child: const Text('Update Account Email'),
);
}),
);
}
}
class _EditAccountPasswordButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
return SubmitBuilder<EditAccountCubit<int>>(
builder: ((context, cubit, status) {
return status.isSubmissionInProgress
? const CircularProgressIndicator()
: ElevatedButton(
onPressed: status.isValidated
? () {
cubit.updatePassword();
}
: null,
child: const Text('Update Account Password'),
);
}),
);
}
}
class EditAccountForm extends StatelessWidget {
const EditAccountForm({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return EditAccountListener<int>(
onError: (context, status, errorMessage) => ScaffoldMessenger.of(context)
..hideCurrentSnackBar()
..showSnackBar(
SnackBar(content: Text(errorMessage ?? 'Account edition Failure')),
),
child: ListView(
shrinkWrap: true,
children: [
_EmailInput(),
const SizedBox(height: 8),
_PasswordInput(),
const SizedBox(height: 16),
_EditAccountButton(),
const SizedBox(height: 16),
_EditAccountEmailButton(),
const SizedBox(height: 16),
_EditAccountPasswordButton(),
],
),
);
}
}

View File

@ -14,6 +14,7 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
import 'package:example_router/presentation/features/edit_account/edit_account_page.dart';
import 'package:example_router/presentation/features/sub/sub_page.dart'; import 'package:example_router/presentation/features/sub/sub_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
@ -29,7 +30,8 @@ class HomePage extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text('Home | ${context.account<AuthenticationCubit<int>, int>()?.email}'), title: Text(
'Home | ${context.account<AuthenticationCubit<int>, int>()?.email}'),
actions: [ actions: [
IconButton( IconButton(
onPressed: () => onPressed: () =>
@ -39,29 +41,27 @@ class HomePage extends StatelessWidget {
), ),
body: Padding( body: Padding(
padding: const EdgeInsets.all(8), padding: const EdgeInsets.all(8),
child: SingleChildScrollView( child: ListView(
child: Column( children: [
children: [ AuthenticationBuilder<int>(
AuthenticationBuilder<int>( authenticated: (context, sessionWrapper) => Text(
authenticated: (context, sessionWrapper) => Text( 'Logged as ${sessionWrapper.session?.account.email} | GeneratedId is ${sessionWrapper.session?.data}'),
'Logged as ${sessionWrapper.session?.account.email} | GeneratedId is ${sessionWrapper.session?.data}'), unauthenticated: (context) =>
unauthenticated: (context) => const Text('Not logged (unauthenticated)'),
const Text('Not logged (unauthenticated)'), unknown: (context) => const Text('Not logged (unknown)'),
unknown: (context) => const Text('Not logged (unknown)'), ),
), const SizedBox(
const SizedBox( height: 8,
height: 8, ),
), ElevatedButton(
ElevatedButton( onPressed: () => context.pushNamed(SubPage.pageName),
onPressed: () => context.pushNamed(SubPage.pageName), child: const Text('Go to sub page'),
child: const Text('Go to sub page'), ),
), ElevatedButton(
// ElevatedButton( onPressed: () => context.pushNamed(EditAccountPage.pageName),
// onPressed: () => context.pushNamed(EditProfilePage.pageName), child: const Text('Go to edit account page'),
// child: const Text('Go to edit profile page'), ),
// ), ],
],
),
), ),
), ),
); );

View File

@ -14,8 +14,8 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
import 'package:example_router/presentation/features/sign_in/sign_in_page.dart'; import 'package:example_router/presentation/features/authentication/sign_in/sign_in_page.dart';
import 'package:example_router/presentation/features/sign_up/sign_up_page.dart'; import 'package:example_router/presentation/features/authentication/sign_up/sign_up_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
@ -30,22 +30,26 @@ class WelcomePage extends StatelessWidget {
appBar: AppBar( appBar: AppBar(
title: const Text('Welcome'), title: const Text('Welcome'),
), ),
body: SingleChildScrollView( body: ListView(
child: Column( children: [
children: [ Padding(
ElevatedButton( padding: const EdgeInsets.all(8.0),
child: ElevatedButton(
onPressed: () => context.pushNamed(SignUpPage.pageName), onPressed: () => context.pushNamed(SignUpPage.pageName),
child: const Text('Sign Up')), child: const Text('Sign Up')),
ElevatedButton( ),
Padding(
padding: const EdgeInsets.all(8.0),
child: ElevatedButton(
onPressed: () => context.pushNamed(SignInPage.pageName), onPressed: () => context.pushNamed(SignInPage.pageName),
style: ButtonStyle( style: ButtonStyle(
backgroundColor: backgroundColor:
MaterialStateProperty.all<Color>(Colors.white), MaterialStateProperty.all<Color>(Colors.white),
foregroundColor: foregroundColor:
MaterialStateProperty.all<Color>(Colors.blue)), MaterialStateProperty.all<Color>(Colors.blue)),
child: const Text('Sign In')) child: const Text('Sign In')),
], )
), ],
), ),
); );
} }