• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

wger-project / flutter / 30854254088

03 Aug 2026 09:21PM UTC coverage: 40.895% (-15.0%) from 55.93%
30854254088

Pull #1260

github

web-flow
Merge d93794de5 into e3affdd4f
Pull Request #1260: WIP: health sync

9980 of 24404 relevant lines covered (40.89%)

1.72 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/lib/features/routines/widgets/routine_edit.dart
1
/*
2
 * This file is part of wger Workout Manager <https://github.com/wger-project>.
3
 * Copyright (C) 2020, 2021 wger Team
4
 *
5
 * wger Workout Manager is free software: you can redistribute it and/or modify
6
 * it under the terms of the GNU Affero General Public License as published by
7
 * the Free Software Foundation, either version 3 of the License, or
8
 * (at your option) any later version.
9
 *
10
 * wger Workout Manager is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU Affero General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU Affero General Public License
16
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
 */
18

19
import 'package:collection/collection.dart';
20
import 'package:flutter/material.dart';
21
import 'package:wger/features/routines/models/day.dart';
22
import 'package:wger/features/routines/models/routine.dart';
23
import 'package:wger/features/routines/widgets/forms/day.dart';
24
import 'package:wger/features/routines/widgets/forms/routine.dart';
25
import 'package:wger/features/routines/widgets/routine_detail.dart';
26
import 'package:wger/l10n/generated/app_localizations.dart';
27

28
class RoutineEdit extends StatefulWidget {
29
  final Routine _routine;
30

31
  const RoutineEdit(this._routine);
×
32

33
  @override
×
34
  State<RoutineEdit> createState() => _RoutineEditState();
×
35
}
36

37
class _RoutineEditState extends State<RoutineEdit> {
38
  int? selectedDayId;
39

40
  @override
×
41
  Widget build(BuildContext context) {
42
    final i18n = AppLocalizations.of(context);
×
43

44
    Day? selectedDay;
45
    if (selectedDayId != null) {
×
46
      selectedDay = widget._routine.days.firstWhereOrNull((day) => day.id == selectedDayId);
×
47
    }
48

49
    return Padding(
×
50
      padding: const EdgeInsets.all(8),
51
      child: SingleChildScrollView(
×
52
        child: Column(
×
53
          children: [
×
54
            RoutineForm(widget._routine, useListView: false),
×
55
            Container(height: 10),
×
56
            Text(i18n.routineDays, style: Theme.of(context).textTheme.titleLarge),
×
57
            ReorderableDaysList(
×
58
              routineId: widget._routine.id!,
×
59
              days: widget._routine.days.where((day) => day.id != null).toList(),
×
60
              selectedDayId: selectedDayId,
×
61
              onDaySelected: (id) {
×
62
                setState(() {
×
63
                  if (selectedDayId == id) {
×
64
                    selectedDayId = null;
×
65
                  } else {
66
                    selectedDayId = id;
×
67
                  }
68
                });
69
              },
70
            ),
71
            if (selectedDay != null) DayFormWidget(key: ValueKey(selectedDayId), day: selectedDay),
×
72
            const SizedBox(height: 25),
×
73
            Text(i18n.resultingRoutine, style: Theme.of(context).textTheme.titleLarge),
×
74
            const Divider(),
×
75
            RoutineDetail(widget._routine, viewMode: true),
×
76
          ],
77
        ),
78
      ),
79
    );
80
  }
81
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc