fix
This commit is contained in:
8
lib/features/settings/data/data.dart
Normal file
8
lib/features/settings/data/data.dart
Normal file
@@ -0,0 +1,8 @@
|
||||
/// Export all settings data layer components
|
||||
///
|
||||
/// Contains data sources, models, and repository implementations
|
||||
library;
|
||||
|
||||
export 'datasources/datasources.dart';
|
||||
export 'models/models.dart';
|
||||
export 'repositories/settings_repository_impl.dart';
|
||||
6
lib/features/settings/data/datasources/datasources.dart
Normal file
6
lib/features/settings/data/datasources/datasources.dart
Normal file
@@ -0,0 +1,6 @@
|
||||
/// Export all settings data sources
|
||||
///
|
||||
/// Contains local data sources for settings
|
||||
library;
|
||||
|
||||
export 'settings_local_datasource.dart';
|
||||
6
lib/features/settings/data/models/models.dart
Normal file
6
lib/features/settings/data/models/models.dart
Normal file
@@ -0,0 +1,6 @@
|
||||
/// Export all settings data models
|
||||
///
|
||||
/// Contains DTOs and models for app settings data transfer
|
||||
library;
|
||||
|
||||
export 'app_settings_model.dart';
|
||||
8
lib/features/settings/domain/domain.dart
Normal file
8
lib/features/settings/domain/domain.dart
Normal file
@@ -0,0 +1,8 @@
|
||||
/// Export all settings domain layer components
|
||||
///
|
||||
/// Contains entities, repository interfaces, and use cases
|
||||
library;
|
||||
|
||||
export 'entities/entities.dart';
|
||||
export 'repositories/settings_repository.dart';
|
||||
export 'usecases/usecases.dart';
|
||||
6
lib/features/settings/domain/entities/entities.dart
Normal file
6
lib/features/settings/domain/entities/entities.dart
Normal file
@@ -0,0 +1,6 @@
|
||||
/// Export all settings domain entities
|
||||
///
|
||||
/// Contains core business entities for app settings
|
||||
library;
|
||||
|
||||
export 'app_settings.dart';
|
||||
7
lib/features/settings/domain/usecases/usecases.dart
Normal file
7
lib/features/settings/domain/usecases/usecases.dart
Normal file
@@ -0,0 +1,7 @@
|
||||
/// Export all settings domain use cases
|
||||
///
|
||||
/// Contains business logic for settings operations
|
||||
library;
|
||||
|
||||
export 'get_settings.dart';
|
||||
export 'update_settings.dart';
|
||||
6
lib/features/settings/presentation/pages/pages.dart
Normal file
6
lib/features/settings/presentation/pages/pages.dart
Normal file
@@ -0,0 +1,6 @@
|
||||
/// Export all settings presentation pages
|
||||
///
|
||||
/// Contains all screens related to settings
|
||||
library;
|
||||
|
||||
export 'settings_page.dart';
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import '../providers/settings_provider.dart';
|
||||
import '../../../auth/presentation/providers/auth_provider.dart';
|
||||
import '../../../../core/constants/app_constants.dart';
|
||||
|
||||
/// Settings page
|
||||
@@ -37,8 +38,105 @@ class SettingsPage extends ConsumerWidget {
|
||||
),
|
||||
),
|
||||
data: (settings) {
|
||||
final user = ref.watch(currentUserProvider);
|
||||
|
||||
return ListView(
|
||||
children: [
|
||||
// User Profile Section
|
||||
if (user != null) ...[
|
||||
Card(
|
||||
margin: const EdgeInsets.all(16),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
children: [
|
||||
CircleAvatar(
|
||||
radius: 40,
|
||||
backgroundColor: Theme.of(context).colorScheme.primaryContainer,
|
||||
child: Text(
|
||||
user.name.isNotEmpty ? user.name[0].toUpperCase() : '?',
|
||||
style: TextStyle(
|
||||
fontSize: 32,
|
||||
color: Theme.of(context).colorScheme.onPrimaryContainer,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
user.name,
|
||||
style: Theme.of(context).textTheme.titleLarge,
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
user.email,
|
||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
if (user.roles.isNotEmpty) ...[
|
||||
const SizedBox(height: 12),
|
||||
Wrap(
|
||||
spacing: 8,
|
||||
alignment: WrapAlignment.center,
|
||||
children: user.roles
|
||||
.map((role) => Chip(
|
||||
label: Text(
|
||||
role.toUpperCase(),
|
||||
style: const TextStyle(fontSize: 11),
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
backgroundColor:
|
||||
Theme.of(context).colorScheme.primaryContainer,
|
||||
labelStyle: TextStyle(
|
||||
color: Theme.of(context).colorScheme.onPrimaryContainer,
|
||||
),
|
||||
))
|
||||
.toList(),
|
||||
),
|
||||
],
|
||||
const SizedBox(height: 16),
|
||||
FilledButton.icon(
|
||||
onPressed: () async {
|
||||
// Show confirmation dialog
|
||||
final confirmed = await showDialog<bool>(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: const Text('Logout'),
|
||||
content: const Text('Are you sure you want to logout?'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context, false),
|
||||
child: const Text('Cancel'),
|
||||
),
|
||||
FilledButton(
|
||||
onPressed: () => Navigator.pop(context, true),
|
||||
style: FilledButton.styleFrom(
|
||||
backgroundColor: Theme.of(context).colorScheme.error,
|
||||
),
|
||||
child: const Text('Logout'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
if (confirmed == true && context.mounted) {
|
||||
await ref.read(authProvider.notifier).logout();
|
||||
}
|
||||
},
|
||||
icon: const Icon(Icons.logout),
|
||||
label: const Text('Logout'),
|
||||
style: FilledButton.styleFrom(
|
||||
backgroundColor: Theme.of(context).colorScheme.error,
|
||||
foregroundColor: Theme.of(context).colorScheme.onError,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const Divider(),
|
||||
],
|
||||
|
||||
// Appearance Section
|
||||
_buildSectionHeader(context, 'Appearance'),
|
||||
ListTile(
|
||||
|
||||
8
lib/features/settings/presentation/presentation.dart
Normal file
8
lib/features/settings/presentation/presentation.dart
Normal file
@@ -0,0 +1,8 @@
|
||||
/// Export all settings presentation layer components
|
||||
///
|
||||
/// Contains pages, widgets, and providers for settings UI
|
||||
library;
|
||||
|
||||
export 'pages/pages.dart';
|
||||
export 'providers/providers.dart';
|
||||
export 'widgets/widgets.dart';
|
||||
7
lib/features/settings/presentation/widgets/widgets.dart
Normal file
7
lib/features/settings/presentation/widgets/widgets.dart
Normal file
@@ -0,0 +1,7 @@
|
||||
/// Export all settings presentation widgets
|
||||
///
|
||||
/// Contains reusable widgets for settings UI
|
||||
/// (Currently empty - add settings-specific widgets here)
|
||||
library;
|
||||
|
||||
// TODO: Add settings-specific widgets (e.g., settings tiles, sections)
|
||||
15
lib/features/settings/settings.dart
Normal file
15
lib/features/settings/settings.dart
Normal file
@@ -0,0 +1,15 @@
|
||||
/// Settings Feature
|
||||
///
|
||||
/// Complete settings feature following clean architecture.
|
||||
/// Includes app configuration, theme management, and user preferences.
|
||||
///
|
||||
/// Usage:
|
||||
/// ```dart
|
||||
/// import 'package:retail/features/settings/settings.dart';
|
||||
/// ```
|
||||
library;
|
||||
|
||||
// Export all layers
|
||||
export 'data/data.dart';
|
||||
export 'domain/domain.dart';
|
||||
export 'presentation/presentation.dart';
|
||||
Reference in New Issue
Block a user