feat(settings): refactor SettingsRepositoryImpl and update client settings page UI
This commit is contained in:
@@ -1,21 +1,21 @@
|
||||
import 'package:firebase_auth/firebase_auth.dart';
|
||||
|
||||
import '../../domain/repositories/settings_repository_interface.dart';
|
||||
|
||||
/// Implementation of [SettingsRepositoryInterface].
|
||||
///
|
||||
/// This implementation delegates authentication operations to [FirebaseAuth].
|
||||
class SettingsRepositoryImpl implements SettingsRepositoryInterface {
|
||||
/// The Firebase Auth instance.
|
||||
final FirebaseAuth _firebaseAuth;
|
||||
/// Creates a [SettingsRepositoryImpl] with the required [_firebaseAuth].
|
||||
const SettingsRepositoryImpl({required this.firebaseAuth});
|
||||
|
||||
/// Creates a [SettingsRepositoryImpl] with the required [_firebaseAuth].
|
||||
SettingsRepositoryImpl({required FirebaseAuth firebaseAuth})
|
||||
: _firebaseAuth = firebaseAuth;
|
||||
/// The Firebase Auth instance.
|
||||
final FirebaseAuth firebaseAuth;
|
||||
|
||||
@override
|
||||
Future<void> signOut() async {
|
||||
try {
|
||||
await _firebaseAuth.signOut();
|
||||
await firebaseAuth.signOut();
|
||||
} catch (e) {
|
||||
throw Exception('Error signing out: ${e.toString()}');
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import 'package:design_system/design_system.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
|
||||
import '../blocs/client_settings_bloc.dart';
|
||||
import '../widgets/client_settings_page/settings_actions.dart';
|
||||
import '../widgets/client_settings_page/settings_profile_header.dart';
|
||||
import '../widgets/client_settings_page/settings_quick_links.dart';
|
||||
|
||||
/// Page for client settings and profile management.
|
||||
///
|
||||
@@ -20,9 +19,9 @@ class ClientSettingsPage extends StatelessWidget {
|
||||
/// Builds the client settings page UI.
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider<ClientSettingsBloc>(
|
||||
create: (context) => Modular.get<ClientSettingsBloc>(),
|
||||
create: (BuildContext context) => Modular.get<ClientSettingsBloc>(),
|
||||
child: BlocListener<ClientSettingsBloc, ClientSettingsState>(
|
||||
listener: (context, state) {
|
||||
listener: (BuildContext context, ClientSettingsState state) {
|
||||
if (state is ClientSettingsSignOutSuccess) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Signed out successfully')),
|
||||
@@ -36,12 +35,10 @@ class ClientSettingsPage extends StatelessWidget {
|
||||
}
|
||||
},
|
||||
child: const Scaffold(
|
||||
backgroundColor: UiColors.background,
|
||||
body: CustomScrollView(
|
||||
slivers: [
|
||||
slivers: <Widget>[
|
||||
SettingsProfileHeader(),
|
||||
SettingsActions(),
|
||||
SettingsQuickLinks(),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -24,10 +24,8 @@ class SettingsActions extends StatelessWidget {
|
||||
delegate: SliverChildListDelegate(<Widget>[
|
||||
const SizedBox(height: UiConstants.space5),
|
||||
|
||||
// Edit profile button
|
||||
UiButton.primary(text: labels.edit_profile, onPressed: () {}),
|
||||
|
||||
const SizedBox(height: UiConstants.space4),
|
||||
/// TODO: FEATURE_NOT_YET_IMPLEMENTED
|
||||
// Edit profile is not yet implemented
|
||||
|
||||
// Hubs button
|
||||
UiButton.primary(
|
||||
|
||||
@@ -39,6 +39,7 @@ class SettingsQuickLinks extends StatelessWidget {
|
||||
title: labels.clock_in_hubs,
|
||||
onTap: () => Modular.to.pushHubs(),
|
||||
),
|
||||
|
||||
_QuickLinkItem(
|
||||
icon: UiIcons.building,
|
||||
title: labels.billing_payments,
|
||||
|
||||
Reference in New Issue
Block a user