Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added assets/icons/measuring-tape.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 8 additions & 14 deletions integration_test/6_weight.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,14 @@ import 'package:mockito/mockito.dart';
import 'package:provider/provider.dart';
import 'package:wger/l10n/generated/app_localizations.dart';
import 'package:wger/providers/body_weight.dart';
import 'package:wger/providers/nutrition.dart';
import 'package:wger/providers/user.dart';
import 'package:wger/screens/form_screen.dart';
import 'package:wger/screens/weight_screen.dart';
import 'package:wger/theme/theme.dart';
import 'package:wger/widgets/dashboard/widgets/weight.dart';

import '../test/utils.dart';
import '../test/weight/weight_screen_test.mocks.dart';
import '../test/weight/weight_entries_modal_test.mocks.dart';
import '../test/weight/weight_provider_test.mocks.dart';
import '../test_data/body_weight.dart';
import '../test_data/nutritional_plans.dart';
import '../test_data/profile.dart';

Widget createWeightScreen({Locale? locale}) {
Expand All @@ -41,10 +39,6 @@ Widget createWeightScreen({Locale? locale}) {
final mockUserProvider = MockUserProvider();
when(mockUserProvider.profile).thenReturn(tProfile1);

final mockNutritionPlansProvider = MockNutritionPlansProvider();
when(mockNutritionPlansProvider.currentPlan).thenReturn(null);
when(mockNutritionPlansProvider.items).thenReturn([getNutritionalPlan()]);

return MediaQuery(
data: MediaQueryData.fromView(WidgetsBinding.instance.platformDispatcher.views.first).copyWith(
padding: EdgeInsets.zero,
Expand All @@ -59,18 +53,18 @@ Widget createWeightScreen({Locale? locale}) {
ChangeNotifierProvider<BodyWeightProvider>(
create: (context) => weightProvider,
),
ChangeNotifierProvider<NutritionPlansProvider>(
create: (context) => mockNutritionPlansProvider,
),
],
child: MaterialApp(
locale: locale,
debugShowCheckedModeBanner: false,
localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: AppLocalizations.supportedLocales,
theme: wgerLightTheme,
home: const WeightScreen(),
routes: {FormScreen.routeName: (ctx) => const FormScreen()},
home: const Scaffold(
body: SingleChildScrollView(
child: DashboardWeightWidget(),
),
),
),
),
);
Expand Down
15 changes: 15 additions & 0 deletions lib/l10n/app_de.arb
Original file line number Diff line number Diff line change
Expand Up @@ -968,6 +968,21 @@
}
},
"superset": "Superset",
"@superset": {},
"entries": "Einträge",
"@entries": {},
"week": "Woche",
"@week": {},
"month": "Monat",
"@month": {},
"sixMonths": "6 Monate",
"@sixMonths": {},
"year": "Jahr",
"@year": {},
"recentEntries": "Letzte Einträge",
"@recentEntries": {},
"seeAll": "Alle anzeigen",
"@seeAll": {},
"isVegan": "Vegan",
"@isVegan": {},
"isVegetarian": "Vegetarisch",
Expand Down
28 changes: 28 additions & 0 deletions lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,10 @@
"@measurementCategoriesHelpText": {},
"measurementEntriesHelpText": "The unit used to measure the category such as 'cm' or '%'",
"@measurementEntriesHelpText": {},
"entries": "entries",
"@entries": {
"description": "Plural form of entry, used to show count of measurement entries"
},
"date": "Date",
"@date": {
"description": "The date of a workout log or body weight entry"
Expand Down Expand Up @@ -1160,6 +1164,30 @@
"darkMode": "Always dark mode",
"lightMode": "Always light mode",
"systemMode": "System settings",
"week": "Week",
"@week": {
"description": "Time range option for one week"
},
"month": "Month",
"@month": {
"description": "Time range option for one month"
},
"sixMonths": "6M",
"@sixMonths": {
"description": "Time range option for six months"
},
"year": "Year",
"@year": {
"description": "Time range option for one year"
},
"all": "All",
"@all": {
"description": "Time range option for all-time data"
},
"recentEntries": "Recent entries",
"@recentEntries": {},
"seeAll": "See all",
"@seeAll": {},
"productNotFoundOpenFoodFacts": "You can add this product to Open Food Facts to help the community!",
"@productNotFoundOpenFoodFacts": {
"description": "Label shown when product is not found to encourage users to go on Open Food Facts and add it themselves"
Expand Down
14 changes: 14 additions & 0 deletions lib/l10n/app_es.arb
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,20 @@
}
}
},
"entries": "entradas",
"@entries": {},
"week": "Semana",
"@week": {},
"month": "Mes",
"@month": {},
"sixMonths": "6 Meses",
"@sixMonths": {},
"year": "Año",
"@year": {},
"recentEntries": "Entradas recientes",
"@recentEntries": {},
"seeAll": "Ver todos",
"@seeAll": {},
"dayTypeCustom": "Personalizado",
"dayTypeAmrap": "Tantas rondas como sea posible",
"dayTypeHiit": "Entrenamiento en intervalos de alta intensidad",
Expand Down
15 changes: 15 additions & 0 deletions lib/l10n/app_fr.arb
Original file line number Diff line number Diff line change
Expand Up @@ -965,6 +965,21 @@
}
},
"superset": "Superset",
"@superset": {},
"entries": "entrées",
"@entries": {},
"week": "Semaine",
"@week": {},
"month": "Mois",
"@month": {},
"sixMonths": "6 Mois",
"@sixMonths": {},
"year": "Année",
"@year": {},
"recentEntries": "Entrées récentes",
"@recentEntries": {},
"seeAll": "Voir tout",
"@seeAll": {},
"personalRecords": "Enregistrements personnels",
"noTrophies": "Vous n'avez pas encore de trophées",
"serverUpdateTitle": "Mise à jour du serveur requise",
Expand Down
15 changes: 15 additions & 0 deletions lib/l10n/app_pl.arb
Original file line number Diff line number Diff line change
Expand Up @@ -834,6 +834,21 @@
"lightMode": "Zawsze używaj trybu jasnego",
"systemMode": "Ustawienia systemu",
"fitInWeek": "Dopasuj w tygodniu",
"@fitInWeek": {},
"entries": "wpisy",
"@entries": {},
"week": "Tydzień",
"@week": {},
"month": "Miesiąc",
"@month": {},
"sixMonths": "6 miesięcy",
"@sixMonths": {},
"year": "Rok",
"@year": {},
"recentEntries": "Ostatnie wpisy",
"@recentEntries": {},
"seeAll": "Zobacz wszystkie",
"@seeAll": {},
"dayTypeAmrap": "Tak dużo rund jak to możliwe",
"trophies": "Trofea",
"dashboardWidgets": "Kokpit widgetów",
Expand Down
15 changes: 15 additions & 0 deletions lib/l10n/app_pt.arb
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,21 @@
"checkInformationBeforeSubmitting": "Por favor, verifica que a informação introduzida está correta antes de submeter o exercício",
"identicalExercisePleaseDiscard": "Se encontrares um exercício igual ao que estás a introduzir, por favor descarta o teu rascunho e edita antes esse exercício.",
"overview": "Panorama",
"@overview": {},
"entries": "entradas",
"@entries": {},
"week": "Semana",
"@week": {},
"month": "Mês",
"@month": {},
"sixMonths": "6 Meses",
"@sixMonths": {},
"year": "Ano",
"@year": {},
"recentEntries": "Entradas recentes",
"@recentEntries": {},
"seeAll": "Ver todos",
"@seeAll": {},
"dashboardWidgets": "Widgets do Painel de Controle",
"dayTypeCustom": "Personalizado",
"dayTypeEnom": "A cada minuto, pontualmente",
Expand Down
4 changes: 0 additions & 4 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ import 'package:wger/screens/home_tabs_screen.dart';
import 'package:wger/screens/log_meal_screen.dart';
import 'package:wger/screens/log_meals_screen.dart';
import 'package:wger/screens/measurement_categories_screen.dart';
import 'package:wger/screens/measurement_entries_screen.dart';
import 'package:wger/screens/nutritional_diary_screen.dart';
import 'package:wger/screens/nutritional_plan_screen.dart';
import 'package:wger/screens/nutritional_plans_screen.dart';
Expand All @@ -62,7 +61,6 @@ import 'package:wger/screens/splash_screen.dart';
import 'package:wger/screens/trophy_screen.dart';
import 'package:wger/screens/update_app_screen.dart';
import 'package:wger/screens/update_server_screen.dart';
import 'package:wger/screens/weight_screen.dart';
import 'package:wger/theme/theme.dart';
import 'package:wger/widgets/core/about.dart';
import 'package:wger/widgets/core/log_overview.dart';
Expand Down Expand Up @@ -257,13 +255,11 @@ class MainApp extends StatelessWidget {
HomeTabsScreen.routeName: (ctx) => HomeTabsScreen(),
MeasurementCategoriesScreen.routeName: (ctx) =>
const MeasurementCategoriesScreen(),
MeasurementEntriesScreen.routeName: (ctx) => const MeasurementEntriesScreen(),
NutritionalPlansScreen.routeName: (ctx) => const NutritionalPlansScreen(),
NutritionalDiaryScreen.routeName: (ctx) => const NutritionalDiaryScreen(),
NutritionalPlanScreen.routeName: (ctx) => const NutritionalPlanScreen(),
LogMealsScreen.routeName: (ctx) => const LogMealsScreen(),
LogMealScreen.routeName: (ctx) => const LogMealScreen(),
WeightScreen.routeName: (ctx) => const WeightScreen(),
RoutineScreen.routeName: (ctx) => const RoutineScreen(),
RoutineEditScreen.routeName: (ctx) => const RoutineEditScreen(),
WorkoutLogsScreen.routeName: (ctx) => const WorkoutLogsScreen(),
Expand Down
7 changes: 0 additions & 7 deletions lib/screens/home_tabs_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:logging/logging.dart';
import 'package:provider/provider.dart';
import 'package:rive/rive.dart';
Expand All @@ -37,7 +36,6 @@ import 'package:wger/screens/dashboard.dart';
import 'package:wger/screens/gallery_screen.dart';
import 'package:wger/screens/nutritional_plans_screen.dart';
import 'package:wger/screens/routine_list_screen.dart';
import 'package:wger/screens/weight_screen.dart';

class HomeTabsScreen extends ConsumerStatefulWidget {
final _logger = Logger('HomeTabsScreen');
Expand Down Expand Up @@ -76,7 +74,6 @@ class _HomeTabsScreenState extends ConsumerState<HomeTabsScreen>
const DashboardScreen(),
const RoutineListScreen(),
const NutritionalPlansScreen(),
const WeightScreen(),
const GalleryScreen(),
];

Expand Down Expand Up @@ -164,10 +161,6 @@ class _HomeTabsScreenState extends ConsumerState<HomeTabsScreen>
icon: const Icon(Icons.restaurant),
label: AppLocalizations.of(context).labelBottomNavNutrition,
),
NavigationDestination(
icon: const FaIcon(FontAwesomeIcons.weightScale, size: 20),
label: AppLocalizations.of(context).weight,
),
NavigationDestination(
icon: const Icon(Icons.photo_library),
label: AppLocalizations.of(context).gallery,
Expand Down
42 changes: 28 additions & 14 deletions lib/screens/measurement_categories_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,35 +21,49 @@ import 'package:provider/provider.dart';
import 'package:wger/core/wide_screen_wrapper.dart';
import 'package:wger/l10n/generated/app_localizations.dart';
import 'package:wger/providers/measurement.dart';
import 'package:wger/screens/form_screen.dart';
import 'package:wger/widgets/core/time_range_tab_bar.dart';
import 'package:wger/widgets/measurements/categories.dart';
import 'package:wger/widgets/measurements/forms.dart';
import 'package:wger/widgets/measurements/charts.dart';
import 'package:wger/widgets/measurements/edit_modals.dart';

class MeasurementCategoriesScreen extends StatelessWidget {
class MeasurementCategoriesScreen extends StatefulWidget {
const MeasurementCategoriesScreen();

static const routeName = '/measurement-categories';

@override
State<MeasurementCategoriesScreen> createState() => _MeasurementCategoriesScreenState();
}

class _MeasurementCategoriesScreenState extends State<MeasurementCategoriesScreen> {
ChartTimeRange _selectedRange = ChartTimeRange.month;

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text(AppLocalizations.of(context).measurements)),
floatingActionButton: FloatingActionButton(
child: const Icon(Icons.add, color: Colors.white),
onPressed: () {
Navigator.pushNamed(
context,
FormScreen.routeName,
arguments: FormScreenArguments(
AppLocalizations.of(context).newEntry,
MeasurementCategoryForm(),
),
);
},
onPressed: () => showEditCategoryModal(context, null),
),
body: WidescreenWrapper(
child: Consumer<MeasurementProvider>(
builder: (context, provider, child) => const CategoriesList(),
builder: (context, provider, child) => Column(
children: [
// Time range tabs
Padding(
padding: const EdgeInsets.fromLTRB(16, 12, 16, 8),
child: TimeRangeTabBar(
selectedRange: _selectedRange,
onRangeChanged: (range) => setState(() => _selectedRange = range),
),
),
// Categories list
Expanded(
child: CategoriesList(timeRange: _selectedRange),
),
],
),
),
),
);
Expand Down
Loading