mirror of
https://github.com/wger-project/flutter.git
synced 2026-12-02 18:19:25 +01:00
Replace more hard coded colors with theme generated ones
This commit is contained in:
@@ -154,7 +154,11 @@ class _PlainErrorBody extends StatelessWidget {
|
||||
const SizedBox(height: 8),
|
||||
SelectableText(
|
||||
stacktrace.toString(),
|
||||
style: const TextStyle(fontFamily: 'monospace', fontSize: 11, color: Colors.grey),
|
||||
style: TextStyle(
|
||||
fontFamily: 'monospace',
|
||||
fontSize: 11,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
|
||||
@@ -28,6 +28,11 @@ class _AddExerciseMultiselectButtonState<T> extends State<AddExerciseMultiselect
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final scheme = Theme.of(context).colorScheme;
|
||||
// Dimmed once something is selected: the chips below carry the content and
|
||||
// the title drops back to a caption.
|
||||
final labelColor = _selectedItems.isEmpty ? scheme.onSurfaceVariant : scheme.outline;
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: MultiSelectDialogField(
|
||||
@@ -53,19 +58,13 @@ class _AddExerciseMultiselectButtonState<T> extends State<AddExerciseMultiselect
|
||||
icon: const Icon(Icons.close),
|
||||
),
|
||||
title: Text(widget.title),
|
||||
buttonText: Text(
|
||||
widget.title,
|
||||
style: TextStyle(
|
||||
color: _selectedItems.isEmpty ? Colors.grey[700] : Colors.grey,
|
||||
),
|
||||
),
|
||||
buttonIcon: Icon(
|
||||
Icons.arrow_drop_down,
|
||||
color: _selectedItems.isEmpty ? Colors.grey[700] : Colors.grey,
|
||||
),
|
||||
buttonText: Text(widget.title, style: TextStyle(color: labelColor)),
|
||||
buttonIcon: Icon(Icons.arrow_drop_down, color: labelColor),
|
||||
decoration: BoxDecoration(
|
||||
// Once chips carry the selection the outline is dropped, the same way
|
||||
// a filled input field loses its placeholder framing.
|
||||
border: Border.all(
|
||||
color: _selectedItems.isEmpty ? Colors.grey : Colors.transparent,
|
||||
color: _selectedItems.isEmpty ? scheme.outline : Colors.transparent,
|
||||
),
|
||||
borderRadius: const BorderRadius.all(Radius.circular(10)),
|
||||
),
|
||||
|
||||
@@ -155,13 +155,13 @@ class _ImageDetailsFormState extends State<ImageDetailsForm> {
|
||||
widget.onAdd(widget.submissionImage);
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Theme.of(context).primaryColor,
|
||||
foregroundColor: Colors.white,
|
||||
backgroundColor: Theme.of(context).colorScheme.primary,
|
||||
foregroundColor: Theme.of(context).colorScheme.onPrimary,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 32, vertical: 12),
|
||||
),
|
||||
child: Text(
|
||||
AppLocalizations.of(context).add,
|
||||
style: const TextStyle(fontWeight: FontWeight.bold, color: Colors.white),
|
||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -181,7 +181,7 @@ class ImagePreview extends StatelessWidget {
|
||||
constraints: const BoxConstraints(maxWidth: 300, maxHeight: 200),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(color: Colors.grey.shade300),
|
||||
border: Border.all(color: Theme.of(context).colorScheme.outlineVariant),
|
||||
),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
|
||||
@@ -203,13 +203,17 @@ class _Step5ImagesState extends ConsumerState<Step5Images> with ExerciseImagePic
|
||||
return Column(
|
||||
children: [
|
||||
const SizedBox(height: 20),
|
||||
Icon(Icons.add_photo_alternate, size: 80, color: Colors.grey.shade400),
|
||||
Icon(
|
||||
Icons.add_photo_alternate,
|
||||
size: 80,
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
'No images selected',
|
||||
style: Theme.of(
|
||||
context,
|
||||
).textTheme.titleMedium?.copyWith(color: Colors.grey.shade600),
|
||||
style: Theme.of(context).textTheme.titleMedium?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
// Camera and Gallery buttons
|
||||
@@ -240,9 +244,9 @@ class _Step5ImagesState extends ConsumerState<Step5Images> with ExerciseImagePic
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: Text(
|
||||
'Only JPEG, PNG and WEBP files below 20 MB are supported',
|
||||
style: Theme.of(
|
||||
context,
|
||||
).textTheme.bodySmall?.copyWith(color: Colors.grey.shade600),
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -34,7 +34,9 @@ class PlateWeight extends StatelessWidget {
|
||||
alignment: Alignment.center,
|
||||
margin: EdgeInsets.all(margin),
|
||||
decoration: BoxDecoration(
|
||||
color: isSelected ? color : Colors.black12,
|
||||
// Selected shows the real plate color, so its rim and label stay
|
||||
// black whatever the theme. Unselected sits on the surface instead.
|
||||
color: isSelected ? color : Theme.of(context).colorScheme.surfaceContainerHighest,
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(color: Colors.black, width: isSelected ? 2 : 0),
|
||||
),
|
||||
@@ -44,7 +46,7 @@ class PlateWeight extends StatelessWidget {
|
||||
value.toString(),
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: isSelected ? Colors.black : Colors.black87,
|
||||
color: isSelected ? Colors.black : Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
fontWeight: isSelected ? FontWeight.bold : FontWeight.normal,
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user