mirror of
https://github.com/wger-project/flutter.git
synced 2026-02-18 00:17:48 +01:00
Unify color handling
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
* This file is part of wger Workout Manager <https://github.com/wger-project>.
|
||||
* Copyright (C) 2020, 2021 wger Team
|
||||
* Copyright (c) 2026 wger Team
|
||||
*
|
||||
* wger Workout Manager is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* wger Workout Manager is distributed in the hope that it will be useful,
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
@@ -183,3 +183,8 @@ CalendarStyle getWgerCalendarStyle(ThemeData theme) {
|
||||
weekendTextStyle: const TextStyle(color: wgerSecondaryColor),
|
||||
);
|
||||
}
|
||||
|
||||
extension WgerThemeColors on BuildContext {
|
||||
Color get wgerLightGrey =>
|
||||
Theme.of(this).brightness == Brightness.dark ? Colors.grey.shade400 : Colors.grey.shade600;
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
* This file is part of wger Workout Manager <https://github.com/wger-project>.
|
||||
* Copyright (C) 2020, 2021 wger Team
|
||||
* Copyright (c) 2026 wger Team
|
||||
*
|
||||
* wger Workout Manager is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* wger Workout Manager is distributed in the hope that it will be useful,
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:wger/l10n/generated/app_localizations.dart';
|
||||
import 'package:wger/theme/theme.dart';
|
||||
import 'package:wger/widgets/measurements/charts.dart';
|
||||
|
||||
/// A reusable time range tab bar for selecting chart time ranges.
|
||||
@@ -121,7 +122,7 @@ class _TimeRangeTab extends StatelessWidget {
|
||||
fontWeight: isSelected ? FontWeight.w600 : FontWeight.w500,
|
||||
color: isSelected
|
||||
? (isDarkMode ? Colors.white : Colors.black87)
|
||||
: (isDarkMode ? Colors.grey.shade400 : Colors.grey.shade600),
|
||||
: context.wgerLightGrey,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
* This file is part of wger Workout Manager <https://github.com/wger-project>.
|
||||
* Copyright (C) 2020, 2021 wger Team
|
||||
* Copyright (c) 2026 wger Team
|
||||
*
|
||||
* wger Workout Manager is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* wger Workout Manager is distributed in the hope that it will be useful,
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
@@ -106,7 +106,7 @@ class _DashboardMeasurementWidgetState extends State<DashboardMeasurementWidget>
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: Icon(
|
||||
Icons.chevron_right_rounded,
|
||||
color: isDarkMode ? Colors.grey.shade400 : Colors.grey.shade600,
|
||||
color: context.wgerLightGrey,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -122,7 +122,7 @@ class _DashboardWeightWidgetState extends State<DashboardWeightWidget> {
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: Icon(
|
||||
Icons.more_vert,
|
||||
color: isDarkMode ? Colors.grey.shade400 : Colors.grey.shade600,
|
||||
color: context.wgerLightGrey,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,7 +1,24 @@
|
||||
/*
|
||||
* This file is part of wger Workout Manager <https://github.com/wger-project>.
|
||||
* Copyright (c) 2026 wger Team
|
||||
*
|
||||
* wger Workout Manager is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:wger/models/measurements/measurement_category.dart';
|
||||
import 'package:wger/theme/theme.dart';
|
||||
import 'package:wger/widgets/measurements/helpers.dart';
|
||||
|
||||
import 'charts.dart';
|
||||
import 'edit_modals.dart';
|
||||
@@ -71,7 +88,7 @@ class CategoriesCard extends StatelessWidget {
|
||||
Icon(
|
||||
Icons.expand_more_rounded,
|
||||
size: 20,
|
||||
color: isDarkMode ? Colors.grey.shade400 : Colors.grey.shade500,
|
||||
color: context.wgerLightGrey,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
* This file is part of wger Workout Manager <https://github.com/wger-project>.
|
||||
* Copyright (C) 2020, 2021 wger Team
|
||||
* Copyright (c) 2026 wger Team
|
||||
*
|
||||
* wger Workout Manager is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* wger Workout Manager is distributed in the hope that it will be useful,
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
@@ -45,8 +45,7 @@ class MeasurementOverallChangeWidget extends StatelessWidget {
|
||||
|
||||
// ignore: prefer_interpolation_to_compose_strings
|
||||
return Text(
|
||||
AppLocalizations.of(context).overallChangeWeight +
|
||||
' $prefix${delta.abs().toStringAsFixed(1)} $_unit',
|
||||
'${AppLocalizations.of(context).overallChangeWeight} $prefix${delta.abs().toStringAsFixed(1)} $_unit',
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -124,7 +123,7 @@ class _MeasurementChartWidgetFlState extends State<MeasurementChartWidgetFl> {
|
||||
TextSpan(
|
||||
text: dateStr,
|
||||
style: TextStyle(
|
||||
color: isDarkMode ? Colors.grey.shade400 : Colors.grey.shade600,
|
||||
color: context.wgerLightGrey,
|
||||
fontWeight: FontWeight.normal,
|
||||
fontSize: 12,
|
||||
),
|
||||
@@ -513,7 +512,9 @@ int? getAverageDaysForTimeRange(ChartTimeRange? timeRange) {
|
||||
/// For each point, return the average of all points in the preceding [days] window.
|
||||
/// Returns null if [days] is null (no averaging).
|
||||
List<MeasurementChartEntry>? movingAverage(List<MeasurementChartEntry> vals, int? days) {
|
||||
if (days == null) return null;
|
||||
if (days == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var start = 0;
|
||||
var end = 0;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
* This file is part of wger Workout Manager <https://github.com/wger-project>.
|
||||
* Copyright (C) 2020, 2021 wger Team
|
||||
* Copyright (c) 2026 wger Team
|
||||
*
|
||||
* wger Workout Manager is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* wger Workout Manager is distributed in the hope that it will be useful,
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
@@ -277,7 +277,7 @@ class _EditEntryModalContentState extends State<_EditEntryModalContent> {
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: BorderSide(color: wgerAccentColor, width: 2),
|
||||
borderSide: const BorderSide(color: wgerAccentColor, width: 2),
|
||||
),
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
@@ -290,7 +290,7 @@ class _EditEntryModalContentState extends State<_EditEntryModalContent> {
|
||||
suffixIcon: suffixIcon != null ? Icon(suffixIcon, color: wgerAccentColor, size: 18) : null,
|
||||
suffixText: suffixText,
|
||||
suffixStyle: TextStyle(
|
||||
color: widget.isDarkMode ? Colors.grey.shade400 : Colors.grey.shade600,
|
||||
color: context.wgerLightGrey,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 13,
|
||||
),
|
||||
@@ -300,7 +300,9 @@ class _EditEntryModalContentState extends State<_EditEntryModalContent> {
|
||||
}
|
||||
|
||||
Future<void> _saveEntry() async {
|
||||
if (!_formKey.currentState!.validate()) return;
|
||||
if (!_formKey.currentState!.validate()) {
|
||||
return;
|
||||
}
|
||||
|
||||
setState(() => _isLoading = true);
|
||||
|
||||
@@ -543,7 +545,7 @@ class _EditCategoryModalContentState extends State<_EditCategoryModalContent> {
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: BorderSide(color: wgerAccentColor, width: 2),
|
||||
borderSide: const BorderSide(color: wgerAccentColor, width: 2),
|
||||
),
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
@@ -558,7 +560,9 @@ class _EditCategoryModalContentState extends State<_EditCategoryModalContent> {
|
||||
}
|
||||
|
||||
Future<void> _saveCategory() async {
|
||||
if (!_formKey.currentState!.validate()) return;
|
||||
if (!_formKey.currentState!.validate()) {
|
||||
return;
|
||||
}
|
||||
|
||||
setState(() => _isLoading = true);
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
* This file is part of wger Workout Manager <https://github.com/wger-project>.
|
||||
* Copyright (C) 2020, 2021 wger Team
|
||||
* Copyright (c) 2026 wger Team
|
||||
*
|
||||
* wger Workout Manager is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* wger Workout Manager is distributed in the hope that it will be useful,
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
@@ -78,7 +78,7 @@ void showEntriesModal(BuildContext context, MeasurementCategory category) {
|
||||
return Text(
|
||||
'${currentCategory.entries.length} ${AppLocalizations.of(context).entries}',
|
||||
style: TextStyle(
|
||||
color: isDarkMode ? Colors.grey.shade400 : Colors.grey.shade600,
|
||||
color: context.wgerLightGrey,
|
||||
fontSize: 14,
|
||||
),
|
||||
);
|
||||
@@ -101,8 +101,8 @@ void showEntriesModal(BuildContext context, MeasurementCategory category) {
|
||||
Navigator.pop(context);
|
||||
showEditCategoryModal(context, category);
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.all(10),
|
||||
child: Icon(
|
||||
Icons.edit_outlined,
|
||||
size: 20,
|
||||
@@ -172,7 +172,7 @@ void showEntriesModal(BuildContext context, MeasurementCategory category) {
|
||||
Text(
|
||||
AppLocalizations.of(context).noMeasurementEntries,
|
||||
style: TextStyle(
|
||||
color: isDarkMode ? Colors.grey.shade400 : Colors.grey.shade600,
|
||||
color: context.wgerLightGrey,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
@@ -206,8 +206,6 @@ void showEntriesModal(BuildContext context, MeasurementCategory category) {
|
||||
}
|
||||
|
||||
void _showDeleteCategoryDialog(BuildContext context, MeasurementCategory category) {
|
||||
final isDarkMode = Theme.of(context).brightness == Brightness.dark;
|
||||
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (dialogContext) => AlertDialog(
|
||||
@@ -219,7 +217,7 @@ void _showDeleteCategoryDialog(BuildContext context, MeasurementCategory categor
|
||||
onPressed: () => Navigator.pop(dialogContext),
|
||||
child: Text(
|
||||
MaterialLocalizations.of(context).cancelButtonLabel,
|
||||
style: TextStyle(color: isDarkMode ? Colors.grey.shade400 : Colors.grey.shade600),
|
||||
style: TextStyle(color: context.wgerLightGrey),
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
@@ -341,7 +339,7 @@ class _EntryTile extends StatelessWidget {
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 14,
|
||||
color: isDarkMode ? Colors.grey.shade400 : Colors.grey.shade600,
|
||||
color: context.wgerLightGrey,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -368,8 +366,8 @@ class _EntryTile extends StatelessWidget {
|
||||
child: InkWell(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
onTap: () => showEditEntryModal(context, category, entry),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.all(8),
|
||||
child: Icon(
|
||||
Icons.edit_outlined,
|
||||
size: 18,
|
||||
@@ -429,7 +427,7 @@ class _EntryTile extends StatelessWidget {
|
||||
onPressed: () => Navigator.pop(dialogContext),
|
||||
child: Text(
|
||||
MaterialLocalizations.of(context).cancelButtonLabel,
|
||||
style: TextStyle(color: isDarkMode ? Colors.grey.shade400 : Colors.grey.shade600),
|
||||
style: TextStyle(color: context.wgerLightGrey),
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
* This file is part of wger Workout Manager <https://github.com/wger-project>.
|
||||
* Copyright (C) 2020, 2021 wger Team
|
||||
* Copyright (c) 2026 wger Team
|
||||
*
|
||||
* wger Workout Manager is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* wger Workout Manager is distributed in the hope that it will be useful,
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
@@ -266,7 +266,7 @@ class _EditWeightModalContentState extends State<_EditWeightModalContent> {
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: BorderSide(color: wgerAccentColor, width: 2),
|
||||
borderSide: const BorderSide(color: wgerAccentColor, width: 2),
|
||||
),
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
@@ -315,7 +315,7 @@ class _EditWeightModalContentState extends State<_EditWeightModalContent> {
|
||||
decoration: InputDecoration(
|
||||
hintText: '0.0',
|
||||
hintStyle: TextStyle(
|
||||
color: widget.isDarkMode ? Colors.grey.shade600 : Colors.grey.shade400,
|
||||
color: context.wgerLightGrey,
|
||||
fontSize: 22,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
@@ -373,7 +373,7 @@ class _EditWeightModalContentState extends State<_EditWeightModalContent> {
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 8),
|
||||
child: Text(
|
||||
label,
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: wgerAccentColor,
|
||||
@@ -400,7 +400,9 @@ class _EditWeightModalContentState extends State<_EditWeightModalContent> {
|
||||
}
|
||||
|
||||
Future<void> _saveWeight() async {
|
||||
if (!_formKey.currentState!.validate()) return;
|
||||
if (!_formKey.currentState!.validate()) {
|
||||
return;
|
||||
}
|
||||
|
||||
setState(() => _isLoading = true);
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
* This file is part of wger Workout Manager <https://github.com/wger-project>.
|
||||
* Copyright (C) 2020, 2021 wger Team
|
||||
* Copyright (c) 2026 wger Team
|
||||
*
|
||||
* wger Workout Manager is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* wger Workout Manager is distributed in the hope that it will be useful,
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
@@ -99,14 +99,14 @@ Widget _buildEmptyState(BuildContext context, bool isDarkMode) {
|
||||
Icon(
|
||||
Icons.monitor_weight_outlined,
|
||||
size: 64,
|
||||
color: isDarkMode ? Colors.grey.shade600 : Colors.grey.shade400,
|
||||
color: context.wgerLightGrey,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
AppLocalizations.of(context).noWeightEntries,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: isDarkMode ? Colors.grey.shade400 : Colors.grey.shade600,
|
||||
color: context.wgerLightGrey,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
@@ -154,7 +154,7 @@ class _WeightEntriesHeader extends StatelessWidget {
|
||||
'$entryCount ${AppLocalizations.of(context).entries}',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: isDarkMode ? Colors.grey.shade400 : Colors.grey.shade600,
|
||||
color: context.wgerLightGrey,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -221,7 +221,7 @@ class _WeightEntryTile extends StatelessWidget {
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: isDarkMode ? Colors.grey.shade400 : Colors.grey.shade600,
|
||||
color: context.wgerLightGrey,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -231,7 +231,7 @@ class _WeightEntryTile extends StatelessWidget {
|
||||
'${dateFormat.format(entry.date)} ${timeFormat.format(entry.date)}',
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: isDarkMode ? Colors.grey.shade400 : Colors.grey.shade600,
|
||||
color: context.wgerLightGrey,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -312,7 +312,7 @@ class _WeightEntryTile extends StatelessWidget {
|
||||
onPressed: () => Navigator.pop(dialogContext),
|
||||
child: Text(
|
||||
MaterialLocalizations.of(context).cancelButtonLabel,
|
||||
style: TextStyle(color: isDarkMode ? Colors.grey.shade400 : Colors.grey.shade600),
|
||||
style: TextStyle(color: context.wgerLightGrey),
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
|
||||
Reference in New Issue
Block a user