Skip to content

Commit

Permalink
Automatic linting
Browse files Browse the repository at this point in the history
  • Loading branch information
Github-actions committed Jan 10, 2024
1 parent 7887f7f commit 0bc5e8e
Show file tree
Hide file tree
Showing 8 changed files with 104 additions and 124 deletions.
3 changes: 1 addition & 2 deletions lib/providers/gallery.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ class GalleryProvider extends WgerBaseProvider with ChangeNotifier {

List<gallery.Image> images = [];

GalleryProvider(super.auth, List<gallery.Image> entries, [super.client])
: images = entries;
GalleryProvider(super.auth, List<gallery.Image> entries, [super.client]) : images = entries;

/// Clears all lists
void clear() {
Expand Down
60 changes: 29 additions & 31 deletions lib/widgets/add_exercise/preview_images.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,41 +18,39 @@ class PreviewExerciseImages extends StatelessWidget with ExerciseImagePickerMixi
return SizedBox(
height: 300,
child: ListView(scrollDirection: Axis.horizontal, children: [
...selectedImages
.map(
(file) => SizedBox(
height: 200,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Stack(
children: [
Image.file(file),
Positioned(
bottom: 0,
right: 0,
child: Padding(
padding: const EdgeInsets.all(3.0),
child: Container(
decoration: BoxDecoration(
color: Colors.grey.withOpacity(0.5),
borderRadius: const BorderRadius.all(Radius.circular(20)),
),
child: IconButton(
iconSize: 20,
onPressed: () =>
context.read<AddExerciseProvider>().removeExercise(file.path),
color: Colors.white,
icon: const Icon(Icons.delete),
),
),
...selectedImages.map(
(file) => SizedBox(
height: 200,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Stack(
children: [
Image.file(file),
Positioned(
bottom: 0,
right: 0,
child: Padding(
padding: const EdgeInsets.all(3.0),
child: Container(
decoration: BoxDecoration(
color: Colors.grey.withOpacity(0.5),
borderRadius: const BorderRadius.all(Radius.circular(20)),
),
child: IconButton(
iconSize: 20,
onPressed: () =>
context.read<AddExerciseProvider>().removeExercise(file.path),
color: Colors.white,
icon: const Icon(Icons.delete),
),
),
],
),
),
),
],
),
)
,
),
),
),
const SizedBox(
width: 10,
),
Expand Down
66 changes: 29 additions & 37 deletions lib/widgets/add_exercise/steps/step2variations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,44 +28,37 @@ class Step2Variations extends StatelessWidget {
child: Column(
children: [
// Exercise bases with variations
...exerciseProvider.exerciseBasesByVariation.keys
.map(
(key) => Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Flexible(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
//mainAxisSize: MainAxisSize.max,
children: [
...exerciseProvider.exerciseBasesByVariation[key]!
.map(
(base) => Text(
base
.getExercise(
Localizations.localeOf(context).languageCode)
.name,
overflow: TextOverflow.ellipsis,
),
)
,
const SizedBox(height: 20),
],
...exerciseProvider.exerciseBasesByVariation.keys.map(
(key) => Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Flexible(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
//mainAxisSize: MainAxisSize.max,
children: [
...exerciseProvider.exerciseBasesByVariation[key]!.map(
(base) => Text(
base
.getExercise(Localizations.localeOf(context).languageCode)
.name,
overflow: TextOverflow.ellipsis,
),
),
),
Consumer<AddExerciseProvider>(
builder: (ctx, provider, __) => Switch(
value: provider.variationId == key,
onChanged: (state) => provider.variationId = key),
),
],
const SizedBox(height: 20),
],
),
),
Consumer<AddExerciseProvider>(
builder: (ctx, provider, __) => Switch(
value: provider.variationId == key,
onChanged: (state) => provider.variationId = key),
),
)
,
],
),
),
// Exercise bases without variations
...exerciseProvider.bases
.where((b) => b.variationId == null)
.map(
...exerciseProvider.bases.where((b) => b.variationId == null).map(
(base) => Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expand All @@ -92,8 +85,7 @@ class Step2Variations extends StatelessWidget {
),
],
),
)
,
),
],
),
),
Expand Down
40 changes: 19 additions & 21 deletions lib/widgets/dashboard/calendar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -250,27 +250,25 @@ class _DashboardCalendarWidgetState extends State<DashboardCalendarWidget>
valueListenable: _selectedEvents,
builder: (context, value, _) => Column(
children: [
...value
.map((event) => ListTile(
title: Text((() {
switch (event.type) {
case EventType.caloriesDiary:
return AppLocalizations.of(context).nutritionalDiary;

case EventType.session:
return AppLocalizations.of(context).workoutSession;

case EventType.weight:
return AppLocalizations.of(context).weight;

case EventType.measurement:
return AppLocalizations.of(context).measurement;
}
})()),
subtitle: Text(event.description),
//onTap: () => print('$event tapped!'),
))

...value.map((event) => ListTile(
title: Text((() {
switch (event.type) {
case EventType.caloriesDiary:
return AppLocalizations.of(context).nutritionalDiary;

case EventType.session:
return AppLocalizations.of(context).workoutSession;

case EventType.weight:
return AppLocalizations.of(context).weight;

case EventType.measurement:
return AppLocalizations.of(context).measurement;
}
})()),
subtitle: Text(event.description),
//onTap: () => print('$event tapped!'),
))
],
),
),
Expand Down
7 changes: 2 additions & 5 deletions lib/widgets/exercises/exercises.dart
Original file line number Diff line number Diff line change
Expand Up @@ -341,12 +341,9 @@ class MuscleWidget extends StatelessWidget {
return Stack(
children: [
SvgPicture.asset('assets/images/muscles/$background.svg'),
...muscles
.map((m) => SvgPicture.asset('assets/images/muscles/main/muscle-${m.id}.svg'))
,
...muscles.map((m) => SvgPicture.asset('assets/images/muscles/main/muscle-${m.id}.svg')),
...musclesSecondary
.map((m) => SvgPicture.asset('assets/images/muscles/secondary/muscle-${m.id}.svg'))
,
.map((m) => SvgPicture.asset('assets/images/muscles/secondary/muscle-${m.id}.svg')),
],
);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/widgets/nutrition/charts.dart
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ class NutritionalDiaryChartWidgetFl extends StatefulWidget {
const NutritionalDiaryChartWidgetFl({
super.key,
required NutritionalPlan nutritionalPlan,
}) : _nutritionalPlan = nutritionalPlan;
}) : _nutritionalPlan = nutritionalPlan;

final NutritionalPlan _nutritionalPlan;

Expand Down Expand Up @@ -397,7 +397,7 @@ class FlNutritionalDiaryChartWidget extends StatefulWidget {
const FlNutritionalDiaryChartWidget({
super.key,
required NutritionalPlan nutritionalPlan,
}) : _nutritionalPlan = nutritionalPlan;
}) : _nutritionalPlan = nutritionalPlan;

final Color barColor = Colors.red;
final Color touchedBarColor = Colors.deepOrange;
Expand Down
18 changes: 8 additions & 10 deletions lib/widgets/workouts/day.dart
Original file line number Diff line number Diff line change
Expand Up @@ -131,16 +131,14 @@ class _WorkoutDayWidgetState extends State<WorkoutDayWidget> {
child: Column(
children: [
if (set.comment != '') MutedText(set.comment),
...set.settingsFiltered
.map(
(setting) => SettingWidget(
set: set,
setting: setting,
expanded: _expanded,
toggle: _toggleExpanded,
),
)
,
...set.settingsFiltered.map(
(setting) => SettingWidget(
set: set,
setting: setting,
expanded: _expanded,
toggle: _toggleExpanded,
),
),
const Divider(),
],
),
Expand Down
30 changes: 14 additions & 16 deletions lib/widgets/workouts/log.dart
Original file line number Diff line number Diff line change
Expand Up @@ -124,23 +124,21 @@ class _DayLogWidgetState extends State<DayLogWidget> {
)
else
Container(),
...widget._exerciseData[base]!
.map(
(log) => Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(log.singleLogRepTextNoNl),
IconButton(
icon: const Icon(Icons.delete),
onPressed: () async {
showDeleteDialog(
context, exercise.name, log, exercise, widget._exerciseData);
},
),
],
...widget._exerciseData[base]!.map(
(log) => Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(log.singleLogRepTextNoNl),
IconButton(
icon: const Icon(Icons.delete),
onPressed: () async {
showDeleteDialog(
context, exercise.name, log, exercise, widget._exerciseData);
},
),
)
,
],
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 15),
child: ExerciseLogChart(base, widget._date),
Expand Down

0 comments on commit 0bc5e8e

Please sign in to comment.