-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add state management, routing (#201)
* wip * feat: update services , repositories, add models * add AuthenticationRepository, clean up * wip * add auth and login blocs * Update project.dic * feat: add app routes * Update bootstrap.dart * wip * update pages, integration tests, add routes * Update login_form.dart
- Loading branch information
Showing
63 changed files
with
1,262 additions
and
258 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,17 +13,17 @@ void main() { | |
(tester) async { | ||
loginRobot = await _configure(tester); | ||
|
||
await loginRobot.enterUsername('Not Valid'); | ||
await loginRobot.enterEmail('Not Valid'); | ||
await loginRobot.tapLoginButton(); | ||
await loginRobot.checkInvalidCredentialsMessageIsShown(); | ||
}); | ||
|
||
testWidgets('authenticates a user with an username and password', | ||
testWidgets('authenticates a user with an email and password', | ||
(tester) async { | ||
loginRobot = await _configure(tester); | ||
|
||
await loginRobot.enterUsername('robot'); | ||
await loginRobot.enterPassword('1234'); | ||
await loginRobot.enterEmail('[email protected]'); | ||
await loginRobot.enterPassword('MyPass123'); | ||
await loginRobot.tapLoginButton(); | ||
}); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,2 @@ | ||
import 'package:catalyst_voices/dummy/dummy.dart'; | ||
import 'package:catalyst_voices_localization/catalyst_voices_localization.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_localized_locales/flutter_localized_locales.dart'; | ||
|
||
final class App extends StatelessWidget { | ||
const App({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return MaterialApp( | ||
restorationScopeId: 'rootVoices', | ||
localizationsDelegates: const [ | ||
...VoicesLocalizations.localizationsDelegates, | ||
LocaleNamesLocalizationsDelegate(), | ||
], | ||
supportedLocales: VoicesLocalizations.supportedLocales, | ||
localeListResolutionCallback: basicLocaleListResolution, | ||
home: isUserLoggedIn ? const HomeScreen() : const LoginPage(), | ||
); | ||
} | ||
} | ||
export 'app_content.dart'; | ||
export 'app_page.dart'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import 'package:catalyst_voices/routes/routes.dart' show AppRouter; | ||
import 'package:catalyst_voices_blocs/catalyst_voices_blocs.dart'; | ||
import 'package:catalyst_voices_localization/catalyst_voices_localization.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_bloc/flutter_bloc.dart'; | ||
import 'package:flutter_localized_locales/flutter_localized_locales.dart'; | ||
|
||
final class AppContent extends StatelessWidget { | ||
const AppContent({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return BlocListener<AuthenticationBloc, AuthenticationState>( | ||
listener: (context, state) {}, | ||
child: MaterialApp.router( | ||
restorationScopeId: 'rootVoices', | ||
localizationsDelegates: const [ | ||
...VoicesLocalizations.localizationsDelegates, | ||
LocaleNamesLocalizationsDelegate(), | ||
], | ||
supportedLocales: VoicesLocalizations.supportedLocales, | ||
localeListResolutionCallback: basicLocaleListResolution, | ||
routerConfig: AppRouter.init( | ||
authenticationBloc: context.read<AuthenticationBloc>(), | ||
), | ||
title: 'Catalyst Voices', | ||
theme: ThemeData( | ||
useMaterial3: true, | ||
brightness: Brightness.dark, | ||
bottomNavigationBarTheme: const BottomNavigationBarThemeData( | ||
type: BottomNavigationBarType.fixed, | ||
), | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import 'package:catalyst_voices/app/view/app_content.dart'; | ||
import 'package:catalyst_voices_blocs/catalyst_voices_blocs.dart'; | ||
import 'package:catalyst_voices_repositories/catalyst_voices_repositories.dart'; | ||
import 'package:catalyst_voices_services/catalyst_voices_services.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_bloc/flutter_bloc.dart'; | ||
|
||
final class App extends StatefulWidget { | ||
const App({super.key}); | ||
|
||
@override | ||
State<App> createState() => _AppState(); | ||
} | ||
|
||
final class _AppState extends State<App> { | ||
late final AuthenticationRepository _authenticationRepository; | ||
late final CredentialsStorageRepository _credentialsStorageRepository; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return MultiRepositoryProvider( | ||
providers: [ | ||
RepositoryProvider.value( | ||
value: _authenticationRepository, | ||
), | ||
], | ||
child: BlocProvider( | ||
create: (_) => AuthenticationBloc( | ||
authenticationRepository: _authenticationRepository, | ||
), | ||
child: const AppContent(), | ||
), | ||
); | ||
} | ||
|
||
@override | ||
Future<void> dispose() async { | ||
await _authenticationRepository.dispose(); | ||
|
||
super.dispose(); | ||
} | ||
|
||
@override | ||
void initState() { | ||
super.initState(); | ||
|
||
_configureRepositories(); | ||
} | ||
|
||
void _configureRepositories() { | ||
_credentialsStorageRepository = CredentialsStorageRepository( | ||
secureStorageService: SecureStorageService(), | ||
); | ||
|
||
_authenticationRepository = AuthenticationRepository( | ||
credentialsStorageRepository: _credentialsStorageRepository, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
9 changes: 5 additions & 4 deletions
9
catalyst_voices/lib/dummy/home_screen.dart → ...lyst_voices/lib/pages/home/home_page.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.