Skip to content

Commit

Permalink
ci: fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
simonoppowa committed Jan 12, 2025
1 parent aed804c commit 45f7e54
Show file tree
Hide file tree
Showing 30 changed files with 91 additions and 101 deletions.
4 changes: 1 addition & 3 deletions lib/core/data/dbo/app_theme_dbo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ enum AppThemeDBO {
case AppThemeEntity.system:
dbo = AppThemeDBO.system;
break;
default:
return AppThemeDBO.system;
}
}
return dbo;
}
}
4 changes: 1 addition & 3 deletions lib/core/domain/entity/app_theme_entity.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ enum AppThemeEntity {
case AppThemeDBO.system:
entity = AppThemeEntity.system;
break;
default:
return AppThemeEntity.system;
}
}
return entity;
}

Expand Down
7 changes: 3 additions & 4 deletions lib/core/presentation/widgets/activity_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class ActivityCard extends StatelessWidget {
color: Theme.of(context)
.colorScheme
.tertiaryContainer
.withOpacity(0.8),
.withValues(alpha: 0.8),
borderRadius: BorderRadius.circular(12)),
child: Text(
"🔥${activityEntity.burnedKcal.toInt()} kcal",
Expand Down Expand Up @@ -75,7 +75,7 @@ class ActivityCard extends StatelessWidget {
child: Text(
activityEntity.physicalActivityEntity.getName(context),
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
color: Theme.of(context).colorScheme.onBackground),
color: Theme.of(context).colorScheme.onSurface),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
Expand All @@ -87,8 +87,7 @@ class ActivityCard extends StatelessWidget {
style: Theme.of(context).textTheme.bodySmall?.copyWith(
color: Theme.of(context)
.colorScheme
.onBackground
.withOpacity(0.8)),
.onSurface.withValues(alpha: 0.8)),
maxLines: 1,
))
],
Expand Down
4 changes: 2 additions & 2 deletions lib/core/presentation/widgets/activity_vertial_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ class ActivityVerticalList extends StatelessWidget {
child: Row(
children: [
Icon(UserActivityEntity.getIconData(),
size: 24, color: Theme.of(context).colorScheme.onBackground),
size: 24, color: Theme.of(context).colorScheme.onSurface),
const SizedBox(width: 4.0),
Text(
title,
style: Theme.of(context).textTheme.titleLarge?.copyWith(
color: Theme.of(context).colorScheme.onBackground),
color: Theme.of(context).colorScheme.onSurface),
),
],
),
Expand Down
10 changes: 5 additions & 5 deletions lib/core/presentation/widgets/add_item_bottom_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class AddItemBottomSheet extends StatelessWidget {
S.of(context).activityExample,
style: Theme.of(context).textTheme.titleMedium?.copyWith(
color:
Theme.of(context).colorScheme.onSurface.withOpacity(0.7)),
Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.7)),
),
// ignore: sized_box_for_whitespace
leading: Container(
Expand All @@ -65,7 +65,7 @@ class AddItemBottomSheet extends StatelessWidget {
S.of(context).breakfastExample,
style: Theme.of(context).textTheme.titleMedium?.copyWith(
color:
Theme.of(context).colorScheme.onSurface.withOpacity(0.7)),
Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.7)),
),
// ignore: sized_box_for_whitespace
leading: Container(
Expand All @@ -87,7 +87,7 @@ class AddItemBottomSheet extends StatelessWidget {
S.of(context).lunchExample,
style: Theme.of(context).textTheme.titleMedium?.copyWith(
color:
Theme.of(context).colorScheme.onSurface.withOpacity(0.7)),
Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.7)),
),
// ignore: sized_box_for_whitespace
leading: Container(
Expand All @@ -109,7 +109,7 @@ class AddItemBottomSheet extends StatelessWidget {
S.of(context).dinnerExample,
style: Theme.of(context).textTheme.titleMedium?.copyWith(
color:
Theme.of(context).colorScheme.onSurface.withOpacity(0.7)),
Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.7)),
),
// ignore: sized_box_for_whitespace
leading: Container(
Expand All @@ -131,7 +131,7 @@ class AddItemBottomSheet extends StatelessWidget {
S.of(context).snackExample,
style: Theme.of(context).textTheme.titleMedium?.copyWith(
color:
Theme.of(context).colorScheme.onSurface.withOpacity(0.7)),
Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.7)),
),
// ignore: sized_box_for_whitespace
leading: Container(
Expand Down
4 changes: 2 additions & 2 deletions lib/core/presentation/widgets/app_banner_version.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ class AppBannerVersion extends StatelessWidget {
const SizedBox(height: 70, child: DynamicOntLogo()),
Text(S.of(context).appTitle,
style: Theme.of(context).textTheme.headlineSmall?.copyWith(
color: Theme.of(context).colorScheme.onBackground,
color: Theme.of(context).colorScheme.onSurface,
fontWeight: FontWeight.w600)),
Text(
S.of(context).appVersionName(versionNumber),
style: Theme.of(context).textTheme.titleMedium?.copyWith(
color:
Theme.of(context).colorScheme.onBackground.withOpacity(0.7)),
Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.7)),
)
],
);
Expand Down
2 changes: 1 addition & 1 deletion lib/core/presentation/widgets/dynamic_ont_logo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class DynamicOntLogo extends StatelessWidget {
svgString = svgString.replaceAll(_circleColor,
Theme.of(context).colorScheme.primaryContainer.toHex());
svgString = svgString.replaceAll(
_spoonColor, Theme.of(context).colorScheme.onBackground.toHex());
_spoonColor, Theme.of(context).colorScheme.onSurface.toHex());
return SvgPicture.string(svgString);
} else if (snapshot.connectionState == ConnectionState.waiting) {
return const SizedBox();
Expand Down
6 changes: 3 additions & 3 deletions lib/core/presentation/widgets/home_appbar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ class HomeAppbar extends StatelessWidget implements PreferredSizeWidget {
text: TextSpan(
text: S.of(context).appTitle,
style: Theme.of(context).textTheme.titleLarge?.copyWith(
color: Theme.of(context).colorScheme.onBackground),
color: Theme.of(context).colorScheme.onSurface),
children: <TextSpan>[
TextSpan(
text: ' ${S.of(context).betaVersionName}',
style: TextStyle(
fontWeight: FontWeight.w500,
color: Theme.of(context).colorScheme.onBackground)),
color: Theme.of(context).colorScheme.onSurface)),
],
),
maxLines: 1,
Expand All @@ -35,7 +35,7 @@ class HomeAppbar extends StatelessWidget implements PreferredSizeWidget {
actions: [
IconButton(
icon: Icon(Icons.settings_outlined,
color: Theme.of(context).colorScheme.onBackground),
color: Theme.of(context).colorScheme.onSurface),
tooltip: S.of(context).settingsLabel,
onPressed: () {
Navigator.of(context).pushNamed(NavigationOptions.settingsRoute);
Expand Down
10 changes: 4 additions & 6 deletions lib/core/presentation/widgets/intake_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ class IntakeCard extends StatelessWidget {
decoration: BoxDecoration(
color: Theme.of(context)
.colorScheme
.secondaryContainer
.withOpacity(0.5),
.secondaryContainer.withValues(alpha: 0.5),
),
),
Container(
Expand All @@ -75,8 +74,7 @@ class IntakeCard extends StatelessWidget {
decoration: BoxDecoration(
color: Theme.of(context)
.colorScheme
.tertiaryContainer
.withOpacity(0.8),
.tertiaryContainer.withValues(alpha: 0.8),
borderRadius: BorderRadius.circular(20)),
child: Text(
'${intake.totalKcal.toInt()} kcal',
Expand Down Expand Up @@ -116,8 +114,8 @@ class IntakeCard extends StatelessWidget {
?.copyWith(
color: Theme.of(context)
.colorScheme
.onSecondaryContainer
.withOpacity(0.7)),
.onSecondaryContainer.withValues(
alpha: 0.7)),
),
],
))
Expand Down
3 changes: 1 addition & 2 deletions lib/core/presentation/widgets/placeholder_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ class PlaceholderCard extends StatelessWidget {
size: 36,
color: Theme.of(context)
.colorScheme
.onSurface
.withOpacity(0.5)),
.onSurface.withValues(alpha: 0.5)),
),
),
),
Expand Down
8 changes: 2 additions & 6 deletions lib/core/styles/color_schemes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@ const lightColorScheme = ColorScheme(
errorContainer: Color(0xFFFFDAD6),
onError: Color(0xFFFFFFFF),
onErrorContainer: Color(0xFF410002),
background: Color(0xFFFCFDF7),
onBackground: Color(0xFF1A1C19),
surface: Color(0xFFFCFDF7),
onSurface: Color(0xFF1A1C19),
surfaceVariant: Color(0xFFDDE5D9),
surfaceContainerHighest: Color(0xFFDDE5D9),
onSurfaceVariant: Color(0xFF424940),
outline: Color(0xFF727970),
onInverseSurface: Color(0xFFF0F1EB),
Expand Down Expand Up @@ -56,11 +54,9 @@ const darkColorScheme = ColorScheme(
errorContainer: Color(0xFF93000A),
onError: Color(0xFF690005),
onErrorContainer: Color(0xFFFFDAD6),
background: Color(0xFF1A1C19),
onBackground: Color(0xFFE2E3DD),
surface: Color(0xFF1A1C19),
onSurface: Color(0xFFE2E3DD),
surfaceVariant: Color(0xFF424940),
surfaceContainerHighest: Color(0xFF424940),
onSurfaceVariant: Color(0xFFC1C9BE),
outline: Color(0xFF8B9389),
onInverseSurface: Color(0xFF1A1C19),
Expand Down
9 changes: 5 additions & 4 deletions lib/core/utils/extensions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,10 @@ extension FormatString on DateTime {
extension ColorExtension on Color {
/// Converts the color to a hexadecimal string.
String toHex() {
return '#${red.toRadixString(16).padLeft(2, '0')}'
'${green.toRadixString(16).padLeft(2, '0')}'
'${blue.toRadixString(16).padLeft(2, '0')}'
'${alpha.toRadixString(16).padLeft(2, '0')}'; // Includes the alpha channel
final red = (r * 255).toInt().toRadixString(16).padLeft(2, '0');
final green = (g * 255).toInt().toRadixString(16).padLeft(2, '0');
final blue = (b * 255).toInt().toRadixString(16).padLeft(2, '0');

return '#' '$red$green$blue'.toUpperCase();
}
}
2 changes: 1 addition & 1 deletion lib/features/activity_detail/activity_detail_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class _ActivityDetailScreenState extends State<ActivityDetailScreen> {
?.copyWith(
color: Theme.of(context)
.colorScheme
.onBackground))
.onSurface))
: const SizedBox(),
),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ActivityTitleExpanded extends StatelessWidget {
TextSpan(
text: activity.getName(context),
style: Theme.of(context).textTheme.displaySmall?.copyWith(
color: Theme.of(context).colorScheme.onBackground),
color: Theme.of(context).colorScheme.onSurface),
children: [
TextSpan(
text: ' ${activity.getDescription(context)} ',
Expand All @@ -31,8 +31,7 @@ class ActivityTitleExpanded extends StatelessWidget {
?.copyWith(
color: Theme.of(context)
.colorScheme
.onBackground
.withOpacity(0.7)),
.onSurface.withValues(alpha: 0.7)),
)
]),
textAlign: TextAlign.center,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ class ActivityItemCard extends StatelessWidget {
title: AutoSizeText(
physicalActivityEntity.getName(context),
style: Theme.of(context).textTheme.titleLarge?.copyWith(
color: Theme.of(context).colorScheme.onBackground),
color: Theme.of(context).colorScheme.onSurface),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
subtitle: AutoSizeText(
physicalActivityEntity.getDescription(context),
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
color: Theme.of(context).colorScheme.onBackground),
color: Theme.of(context).colorScheme.onSurface),
maxLines: 3,
overflow: TextOverflow.ellipsis,
),
Expand Down
4 changes: 1 addition & 3 deletions lib/features/add_meal/data/dto/fdc_sp/sp_const.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ class SPConst {
return fdcFoodDescriptionEn;
case SupportedLanguage.de:
return fdcFoodDescriptionDe;
default:
return fdcFoodDescriptionEn;
}
}
}

}
4 changes: 1 addition & 3 deletions lib/features/add_meal/data/dto/fdc_sp/sp_fdc_food_dto.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ class SpFdcFoodDTO {
return descriptionEn;
case SupportedLanguage.de:
return descriptionDe;
default:
return descriptionEn;
}
}
}

get servingSize => portions
Expand Down
4 changes: 1 addition & 3 deletions lib/features/add_meal/data/dto/off/off_product_dto.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ class OFFProductDTO {
case SupportedLanguage.de:
localeName = product_name_de;
break;
default:
return product_name_en;
}
}

// If local language is not available, return available language
if (localeName == null || localeName.isEmpty) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:opennutritracker/core/utils/navigation_options.dart';
import 'package:opennutritracker/features/add_meal/domain/entity/meal_entity.dart';
import 'package:opennutritracker/features/add_meal/presentation/add_meal_type.dart';
import 'package:opennutritracker/features/meal_detail/meal_detail_screen.dart';

class MealItemCard extends StatelessWidget {
final DateTime day;
final AddMealType addMealType;
Expand Down Expand Up @@ -56,7 +57,7 @@ class MealItemCard extends StatelessWidget {
TextSpan(
text: mealEntity.name ?? "?",
style: Theme.of(context).textTheme.titleLarge?.copyWith(
color: Theme.of(context).colorScheme.onBackground),
color: Theme.of(context).colorScheme.onSurface),
children: [
TextSpan(
text: ' ${mealEntity.brands ?? ""}',
Expand All @@ -66,8 +67,8 @@ class MealItemCard extends StatelessWidget {
?.copyWith(
color: Theme.of(context)
.colorScheme
.onBackground
.withOpacity(0.8)))
.onSurface
.withValues(alpha: 0.8))),
]),
style: Theme.of(context).textTheme.titleLarge,
maxLines: 2,
Expand Down
6 changes: 2 additions & 4 deletions lib/features/diary/presentation/widgets/day_info_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ class DayInfoWidget extends StatelessWidget {
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
color: Theme.of(context)
.colorScheme
.onBackground
.withOpacity(0.7))),
.onSurface.withValues(alpha: 0.7))),
)
: const SizedBox(),
trackedDay != null
Expand Down Expand Up @@ -110,8 +109,7 @@ class DayInfoWidget extends StatelessWidget {
?.copyWith(
color: Theme.of(context)
.colorScheme
.onBackground
.withOpacity(0.7)))
.onSurface.withValues(alpha: 0.7))),
],
),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class _DiaryTableCalendarState extends State<DiaryTableCalendar> {
Theme.of(context).textTheme.bodyMedium ?? const TextStyle(),
todayDecoration: BoxDecoration(
border: Border.all(
color: Theme.of(context).colorScheme.onBackground,
color: Theme.of(context).colorScheme.onSurface,
width: 2.0),
shape: BoxShape.circle),
selectedTextStyle: Theme.of(context)
Expand Down
4 changes: 0 additions & 4 deletions lib/features/edit_meal/presentation/edit_meal_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -276,10 +276,6 @@ class _EditMealScreenState extends State<EditMealScreen> {
? _convertToMetric(
_mealQuantityTextController.text, _mealEntity.mealUnit ?? "0")
: _mealQuantityTextController.text;
final servingQuantity = usesImperialUnits
? _convertToMetric(
_servingQuantityTextController.text, _mealEntity.mealUnit ?? "0")
: _servingQuantityTextController.text;

final newMealEntity = _editMealBloc.createNewMealEntity(
_mealEntity,
Expand Down
3 changes: 2 additions & 1 deletion lib/features/home/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
visible: _isDragging,
child: Container(
height: 70,
color: Theme.of(context).colorScheme.error.withOpacity(0.3),
color: Theme.of(context).colorScheme.error
..withValues(alpha: 0.3),
child: DragTarget<IntakeEntity>(
onAcceptWithDetails: (data) {
_confirmDelete(context, data.data);
Expand Down
Loading

0 comments on commit 45f7e54

Please sign in to comment.