Refactor: Implement multi-item inventory for Pad Tracker and dynamic navigation
This commit is contained in:
@@ -3,6 +3,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import '../../models/user_profile.dart';
|
||||
import '../../providers/user_provider.dart';
|
||||
import '../../theme/app_theme.dart';
|
||||
import '../../widgets/pad_settings_dialog.dart';
|
||||
|
||||
class AppearanceScreen extends ConsumerWidget {
|
||||
const AppearanceScreen({super.key});
|
||||
@@ -23,9 +24,9 @@ class AppearanceScreen extends ConsumerWidget {
|
||||
_buildThemeModeSelector(context, ref, userProfile.themeMode),
|
||||
const SizedBox(height: 24),
|
||||
_buildAccentColorSelector(
|
||||
context, ref, userProfile.accentColor, AppColors.sageGreen),
|
||||
const SizedBox(height: 32),
|
||||
_buildRelationshipStatusSelector(context, ref, userProfile.relationshipStatus),
|
||||
context, ref, userProfile.accentColor),
|
||||
const SizedBox(height: 24),
|
||||
// _buildPadSettings removed as per new design
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -77,6 +78,16 @@ class AppearanceScreen extends ConsumerWidget {
|
||||
|
||||
Widget _buildAccentColorSelector(BuildContext context, WidgetRef ref,
|
||||
String currentAccent) {
|
||||
final accents = [
|
||||
{'color': AppColors.sageGreen, 'value': '0xFFA8C5A8'},
|
||||
{'color': AppColors.rose, 'value': '0xFFE8A0B0'},
|
||||
{'color': AppColors.lavender, 'value': '0xFFD4C4E8'},
|
||||
{'color': AppColors.info, 'value': '0xFF7BB8E8'},
|
||||
{'color': AppColors.softGold, 'value': '0xFFD4A574'},
|
||||
{'color': AppColors.mint, 'value': '0xFF98DDCA'},
|
||||
{'color': AppColors.teal, 'value': '0xFF5B9AA0'},
|
||||
];
|
||||
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@@ -88,73 +99,44 @@ class AppearanceScreen extends ConsumerWidget {
|
||||
Wrap(
|
||||
spacing: 16,
|
||||
runSpacing: 16,
|
||||
children: [
|
||||
GestureDetector(
|
||||
children: accents.map((accent) {
|
||||
final color = accent['color'] as Color;
|
||||
final value = accent['value'] as String;
|
||||
final isSelected = currentAccent == value;
|
||||
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
ref
|
||||
.read(userProfileProvider.notifier)
|
||||
.updateAccentColor('0xFFA8C5A8');
|
||||
ref.read(userProfileProvider.notifier).updateAccentColor(value);
|
||||
},
|
||||
child: Container(
|
||||
width: 48,
|
||||
height: 48,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.sageGreen,
|
||||
color: color,
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(
|
||||
color:
|
||||
Theme.of(context).colorScheme.primary, // Assuming currentAccent is sageGreen
|
||||
width: 3,
|
||||
),
|
||||
border: isSelected
|
||||
? Border.all(
|
||||
color: Theme.of(context).brightness == Brightness.dark
|
||||
? Colors.white
|
||||
: AppColors.charcoal,
|
||||
width: 3,
|
||||
)
|
||||
: null,
|
||||
boxShadow: [
|
||||
if (isSelected)
|
||||
BoxShadow(
|
||||
color: color.withOpacity(0.4),
|
||||
blurRadius: 8,
|
||||
offset: const Offset(0, 4),
|
||||
)
|
||||
],
|
||||
),
|
||||
child: const Icon(Icons.check, color: Colors.white),
|
||||
child: isSelected
|
||||
? const Icon(Icons.check, color: Colors.white)
|
||||
: null,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildRelationshipStatusSelector(
|
||||
BuildContext context, WidgetRef ref, RelationshipStatus currentStatus) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Relationship Status',
|
||||
style: Theme.of(context).textTheme.titleLarge,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
SegmentedButton<RelationshipStatus>(
|
||||
segments: const [
|
||||
ButtonSegment(
|
||||
value: RelationshipStatus.single,
|
||||
label: Text('Single'),
|
||||
icon: Icon(Icons.person_outline),
|
||||
),
|
||||
ButtonSegment(
|
||||
value: RelationshipStatus.engaged,
|
||||
label: Text('Engaged'),
|
||||
icon: Icon(Icons.favorite_border),
|
||||
),
|
||||
ButtonSegment(
|
||||
value: RelationshipStatus.married,
|
||||
label: Text('Married'),
|
||||
icon: Icon(Icons.favorite),
|
||||
),
|
||||
],
|
||||
selected: {currentStatus},
|
||||
onSelectionChanged: (Set<RelationshipStatus> newSelection) {
|
||||
if (newSelection.isNotEmpty) {
|
||||
ref
|
||||
.read(userProfileProvider.notifier)
|
||||
.updateRelationshipStatus(newSelection.first);
|
||||
}
|
||||
},
|
||||
style: SegmentedButton.styleFrom(
|
||||
fixedSize: const Size.fromHeight(48),
|
||||
)
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user