diff --git a/lib/providers/gallery.dart b/lib/providers/gallery.dart index f843e0443..f55a81191 100644 --- a/lib/providers/gallery.dart +++ b/lib/providers/gallery.dart @@ -31,8 +31,7 @@ class GalleryProvider extends WgerBaseProvider with ChangeNotifier { List images = []; - GalleryProvider(super.auth, List entries, [super.client]) - : images = entries; + GalleryProvider(super.auth, List entries, [super.client]) : images = entries; /// Clears all lists void clear() { diff --git a/lib/widgets/add_exercise/preview_images.dart b/lib/widgets/add_exercise/preview_images.dart index 65a465670..7b4efc2fe 100644 --- a/lib/widgets/add_exercise/preview_images.dart +++ b/lib/widgets/add_exercise/preview_images.dart @@ -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().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().removeExercise(file.path), + color: Colors.white, + icon: const Icon(Icons.delete), ), ), - ], + ), ), - ), + ], ), - ) - , + ), + ), + ), const SizedBox( width: 10, ), diff --git a/lib/widgets/add_exercise/steps/step2variations.dart b/lib/widgets/add_exercise/steps/step2variations.dart index ce25185ea..5e30c0a35 100644 --- a/lib/widgets/add_exercise/steps/step2variations.dart +++ b/lib/widgets/add_exercise/steps/step2variations.dart @@ -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( - builder: (ctx, provider, __) => Switch( - value: provider.variationId == key, - onChanged: (state) => provider.variationId = key), - ), - ], + const SizedBox(height: 20), + ], + ), + ), + Consumer( + 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: [ @@ -92,8 +85,7 @@ class Step2Variations extends StatelessWidget { ), ], ), - ) - , + ), ], ), ), diff --git a/lib/widgets/dashboard/calendar.dart b/lib/widgets/dashboard/calendar.dart index f7ba8ba60..60f30c45b 100644 --- a/lib/widgets/dashboard/calendar.dart +++ b/lib/widgets/dashboard/calendar.dart @@ -250,27 +250,25 @@ class _DashboardCalendarWidgetState extends State 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!'), + )) ], ), ), diff --git a/lib/widgets/exercises/exercises.dart b/lib/widgets/exercises/exercises.dart index a60e10bef..607bd2238 100644 --- a/lib/widgets/exercises/exercises.dart +++ b/lib/widgets/exercises/exercises.dart @@ -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')), ], ); } diff --git a/lib/widgets/nutrition/charts.dart b/lib/widgets/nutrition/charts.dart index e4ec2dd28..b7f9b2571 100644 --- a/lib/widgets/nutrition/charts.dart +++ b/lib/widgets/nutrition/charts.dart @@ -158,7 +158,7 @@ class NutritionalDiaryChartWidgetFl extends StatefulWidget { const NutritionalDiaryChartWidgetFl({ super.key, required NutritionalPlan nutritionalPlan, - }) : _nutritionalPlan = nutritionalPlan; + }) : _nutritionalPlan = nutritionalPlan; final NutritionalPlan _nutritionalPlan; @@ -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; diff --git a/lib/widgets/workouts/day.dart b/lib/widgets/workouts/day.dart index dbd923dcc..1a50098d7 100644 --- a/lib/widgets/workouts/day.dart +++ b/lib/widgets/workouts/day.dart @@ -131,16 +131,14 @@ class _WorkoutDayWidgetState extends State { 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(), ], ), diff --git a/lib/widgets/workouts/log.dart b/lib/widgets/workouts/log.dart index 1909b2565..d6ab15624 100644 --- a/lib/widgets/workouts/log.dart +++ b/lib/widgets/workouts/log.dart @@ -124,23 +124,21 @@ class _DayLogWidgetState extends State { ) 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),