i18n and other cleanup

This commit is contained in:
Roland Geider
2026-01-16 17:09:05 +01:00
parent dce1b79683
commit ec153c51df
29 changed files with 330 additions and 114 deletions

View File

@@ -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.
@@ -22,10 +22,10 @@ import 'package:wger/theme/theme.dart';
class NothingFound extends StatelessWidget {
final String _title;
final String _titleForm;
final Widget _form;
final String? _titleForm;
final Widget? _form;
const NothingFound(this._title, this._titleForm, this._form);
const NothingFound(this._title, [this._titleForm, this._form]);
@override
Widget build(BuildContext context) {
@@ -35,21 +35,22 @@ class NothingFound extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(_title),
IconButton(
iconSize: 30,
icon: const Icon(Icons.add_box, color: wgerPrimaryButtonColor),
onPressed: () {
Navigator.pushNamed(
context,
FormScreen.routeName,
arguments: FormScreenArguments(
_titleForm,
hasListView: true,
_form,
),
);
},
),
if (_titleForm != null && _form != null)
IconButton(
iconSize: 30,
icon: const Icon(Icons.add_box, color: wgerPrimaryButtonColor),
onPressed: () {
Navigator.pushNamed(
context,
FormScreen.routeName,
arguments: FormScreenArguments(
_titleForm,
hasListView: true,
_form,
),
);
},
),
],
),
);

View File

@@ -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.
@@ -58,7 +58,7 @@ class _DashboardRoutineWidgetState extends State<DashboardRoutineWidget> {
),
subtitle: Text(
_hasContent
? '${dateFormat.format(routine!.start)} - ${dateFormat.format(routine!.end)}'
? '${dateFormat.format(routine!.start)} - ${dateFormat.format(routine.end)}'
: '',
),
leading: Icon(

View File

@@ -18,6 +18,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:wger/l10n/generated/app_localizations.dart';
import 'package:wger/models/trophies/trophy.dart';
import 'package:wger/providers/trophies.dart';
import 'package:wger/screens/trophy_screen.dart';
@@ -28,6 +29,7 @@ class DashboardTrophiesWidget extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final trophiesState = ref.read(trophyStateProvider);
final i18n = AppLocalizations.of(context);
return Card(
color: Colors.transparent,
@@ -36,9 +38,25 @@ class DashboardTrophiesWidget extends ConsumerWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (trophiesState.nonPrTrophies.isEmpty)
Padding(
padding: const EdgeInsets.all(16.0),
child: Text('No trophies yet', style: Theme.of(context).textTheme.bodyMedium),
Card(
child: Column(
children: [
ListTile(
title: Text(
i18n.trophies,
style: Theme.of(context).textTheme.headlineSmall,
),
// leading: Icon(Icons.widgets_outlined),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
i18n.noTrophies,
style: Theme.of(context).textTheme.bodyMedium,
),
),
],
),
)
else
SizedBox(

View File

@@ -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.
@@ -42,7 +42,7 @@ class DashboardWeightWidget extends StatelessWidget {
);
return Consumer<BodyWeightProvider>(
builder: (context, _, __) => Card(
builder: (context, _, _) => Card(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [

View File

@@ -18,7 +18,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:logging/logging.dart';
import 'package:wger/helpers/date.dart';
import 'package:wger/helpers/errors.dart';
import 'package:wger/l10n/generated/app_localizations.dart';
@@ -33,9 +32,8 @@ import 'session_info.dart';
class DayLogWidget extends ConsumerWidget {
final DateTime _date;
final Routine _routine;
final _logger = Logger('DayLogWidget');
DayLogWidget(this._date, this._routine);
const DayLogWidget(this._date, this._routine);
@override
Widget build(BuildContext context, WidgetRef ref) {
@@ -53,9 +51,6 @@ class DayLogWidget extends ConsumerWidget {
.where((t) => t.contextData?.sessionId == sessionApi.session.id)
.toList();
_logger.info(trophyState.prTrophies);
_logger.info(prTrophies);
return Column(
spacing: 10,
children: [

View File

@@ -1,6 +1,6 @@
/*
* This file is part of wger Workout Manager <https://github.com/wger-project>.
* Copyright (c) 2020 - 2025 wger Team
* Copyright (c) 2020 - 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
@@ -74,6 +74,7 @@ class _ExerciseExpansionTile extends StatelessWidget {
Widget build(BuildContext context) {
final languageCode = Localizations.localeOf(context).languageCode;
final theme = Theme.of(context);
final i18n = AppLocalizations.of(context);
final topSet = logs.isEmpty
? null
@@ -85,7 +86,7 @@ class _ExerciseExpansionTile extends StatelessWidget {
return ExpansionTile(
// leading: const Icon(Icons.fitness_center),
title: Text(exercise.getTranslation(languageCode).name, style: theme.textTheme.titleMedium),
subtitle: Text('Top set: $topSetWeight $topSetWeightUnit'),
subtitle: Text(i18n.topSet('$topSetWeight $topSetWeightUnit')),
children: logs.map((log) => _SetDataRow(log: log, userPrTrophies: userPrTrophies)).toList(),
);
}

View File

@@ -19,6 +19,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:wger/helpers/material.dart';
import 'package:wger/l10n/generated/app_localizations.dart';
import 'package:wger/models/trophies/user_trophy_progression.dart';
import 'package:wger/providers/trophies.dart';
@@ -28,6 +29,7 @@ class TrophiesOverview extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final trophyState = ref.watch(trophyStateProvider);
final i18n = AppLocalizations.of(context);
// Responsive grid: determine columns based on screen width
final width = MediaQuery.widthOf(context);
@@ -48,7 +50,7 @@ class TrophiesOverview extends ConsumerWidget {
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Text(
'No trophies yet',
i18n.noTrophies,
style: Theme.of(context).textTheme.bodyLarge,
textAlign: TextAlign.center,
),