• 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/exercises/models/image.dart
1
/*
2
 * This file is part of wger Workout Manager <https://github.com/wger-project>.
3
 * Copyright (c)  2026 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
 * This program 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
/// Art style of an [ExerciseImage].
20
///
21
/// The wire values mirror Django's `ExerciseImage.STYLE` choices (`CharField`
22
/// with `'1'`–`'5'`), so the same string round-trips through PowerSync
23
/// without any extra mapping on the connector.
24
enum ExerciseImageStyle {
25
  lineArt('1'),
26
  threeD('2'),
27
  lowPoly('3'),
28
  photo('4'),
29
  other('5');
30

31
  final String wireValue;
32
  const ExerciseImageStyle(this.wireValue);
33

34
  /// Looks up an enum case by its Django wire value.
35
  static ExerciseImageStyle fromWire(String value) =>
×
36
      ExerciseImageStyle.values.firstWhere((e) => e.wireValue == value);
×
37
}
38

39
class ExerciseImage {
40
  final int id;
41
  final String uuid;
42
  final int exerciseId;
43

44
  /// Relative path of the image on the server (Django `ImageField`),
45
  /// e.g. `exercise-images/91/foo.png`
46
  final String image;
47

48
  final bool isMain;
49
  final bool isAiGenerated;
50
  final ExerciseImageStyle style;
51

52
  final int? width;
53
  final int? height;
54
  final DateTime created;
55
  final DateTime lastUpdate;
56

57
  /// FK to the `License` row.
58
  final int licenseId;
59
  final String licenseTitle;
60
  final String licenseObjectUrl;
61

62
  /// Author may be null on the server (`TextField(null=True)`).
63
  final String? licenseAuthor;
64
  final String licenseAuthorUrl;
65
  final String licenseDerivativeSourceUrl;
66

67
  const ExerciseImage({
×
68
    required this.id,
69
    required this.uuid,
70
    required this.exerciseId,
71
    required this.image,
72
    required this.isMain,
73
    required this.isAiGenerated,
74
    required this.style,
75
    required this.width,
76
    required this.height,
77
    required this.created,
78
    required this.lastUpdate,
79
    required this.licenseId,
80
    required this.licenseTitle,
81
    required this.licenseObjectUrl,
82
    required this.licenseAuthor,
83
    required this.licenseAuthorUrl,
84
    required this.licenseDerivativeSourceUrl,
85
  });
86

87
  @override
×
88
  String toString() {
89
    return 'Image $id: $image';
×
90
  }
91
}
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