Skip to content

Commit

Permalink
Added translations #21
Browse files Browse the repository at this point in the history
  • Loading branch information
guyluz11 committed Apr 29, 2024
1 parent c55432c commit 00f1586
Show file tree
Hide file tree
Showing 13 changed files with 149 additions and 145 deletions.
29 changes: 28 additions & 1 deletion assets/translations/en-US.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
{
"start_with": "Tip: start with thinking about your last session"
"start_with": "Tip: start with thinking about your last session",
"study_efficiently": "Let’s Study Efficiently",
"study_type": "Study Type",
"efficient_tips": "Efficient {} Tips",
"energy": "Energy",
"lets_start": "Let’s Start",
"recommended_morning": "Recommended in the morning",
"recommended_evening": "Recommended in the evening",
"very_low": "Very Low",
"low": "Low",
"medium": "Medium",
"high": "High",
"very_high": "Very High",
"max": "Max",
"minutes_single": "m",
"classic_pomodoro": "Classic Pomodoro:",
"custom": "Custom:",
"study_timer": "Study Timer",
"ready_for_break": "Get ready for a break",
"take_break": "Take a break",
"ready_study": "Get ready to study",
"study_efficiency": "Maximize Study Efficiency",
"continue": "Continue",
"pause": "Pause",
"start": "Start",
"analytically": "Analytically",
"creatively": "Creatively",
"undefined": "Undefined"
}
29 changes: 28 additions & 1 deletion assets/translations/he-IL.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
{
"start_with": "טיפ: מומלץ להתחיל בחשיבה על הסאשן האחרון"
"start_with": "טיפ: מומלץ להתחיל בחשיבה על הסאשן האחרון",
"study_efficiently": "בוא נלמד ביעילות",
"study_type": "סוג לימודים",
"efficient_tips": "טיפים {} יעילים",
"energy": "אנרגיה",
"lets_start": "בוא נתחיל",
"recommended_morning": "מומלץ בבוקר",
"recommended_evening": "ממולץ בערב",
"very_low": "נמוך מאוד",
"low": "נמוך",
"medium": "בינוני",
"high": "גבוה",
"very_high": "גבוה מאוד",
"max": "מקסימום",
"minutes_single": "ד",
"classic_pomodoro": "פומדורו קלאסי:",
"custom": "מותאם אישית:",
"study_timer": "זמן לימוד",
"ready_for_break": "התכונן להפסקה",
"take_break": "קח הפסקה",
"ready_study": "התכונן לימוד",
"study_efficiency": "מקסם יעילות למידה",
"continue": "המשך",
"pause": "הפסק",
"start": "התחל",
"analytically": "אנליטי",
"creatively": "יצירתי",
"undefined": "לא מוגדר"
}
18 changes: 9 additions & 9 deletions lib/domain/study_type_abstract.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ abstract class StudyTypeAbstract {
}

enum StudyType {
undefined('Undefined'),
analytically('Analytically'),
creatively('Creatively'),
undefined('undefined'),
analytically('analytically'),
creatively('creatively'),
;

const StudyType(this.previewName);
Expand All @@ -46,12 +46,12 @@ extension StudyTypeExtension on StudyType {

enum EnergyType {
undefined('undefined', Duration.zero),
veryLow('Very Low', Duration(minutes: 5)),
low('Low', Duration(minutes: 10)),
medium('Medium', Duration(minutes: 25)),
high('High', Duration(minutes: 40)),
veryHigh('Very High', Duration(minutes: 60)),
max('Max', Duration(minutes: 90)),
veryLow('very_low', Duration(minutes: 5)),
low('low', Duration(minutes: 10)),
medium('medium', Duration(minutes: 25)),
high('high', Duration(minutes: 40)),
veryHigh('very_high', Duration(minutes: 60)),
max('max', Duration(minutes: 90)),
;

const EnergyType(this.previewName, this.duration);
Expand Down
80 changes: 25 additions & 55 deletions lib/presentation/atoms/button_atom.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,21 @@ class ButtonAtom extends StatelessWidget {
final bool translate;
final bool disableActionType;

Widget buttonConstraints({required Widget child}) => Container(
constraints: BoxConstraints(
minWidth: width,
),
height: _height,
child: child,
);

Widget label(TextTheme textTheme) => TextAtom(
text ?? '',
translate: translate,
maxLines: 1,
style: textTheme.bodyLarge,
);

@override
Widget build(BuildContext context) {
final ThemeData themeData = Theme.of(context);
Expand All @@ -31,11 +46,7 @@ class ButtonAtom extends StatelessWidget {

if (variant == ButtonVariant.primary) {
if (icon == null) {
return Container(
constraints: BoxConstraints(
minWidth: width,
),
height: _height,
return buttonConstraints(
child: FilledButton(
onPressed: onPressed,
style: FilledButton.styleFrom().copyWith(
Expand All @@ -44,20 +55,11 @@ class ButtonAtom extends StatelessWidget {
? MaterialStateProperty.all(colorScheme.outline)
: null,
),
child: TextAtom(
text ?? '',
translate: translate,
maxLines: 1,
style: textTheme.bodyLarge,
),
child: label(textTheme),
),
);
}
return Container(
constraints: BoxConstraints(
minWidth: width,
),
height: _height,
return buttonConstraints(
child: FilledButton.icon(
onPressed: onPressed,
style: FilledButton.styleFrom().copyWith(
Expand All @@ -67,21 +69,12 @@ class ButtonAtom extends StatelessWidget {
: null,
),
icon: Icon(icon),
label: TextAtom(
text ?? '',
translate: translate,
maxLines: 1,
style: textTheme.bodyLarge,
),
label: label(textTheme),
),
);
} else if (variant == ButtonVariant.secondary) {
if (icon == null) {
return Container(
constraints: BoxConstraints(
minWidth: width,
),
height: _height,
return buttonConstraints(
child: FilledButton.tonal(
onPressed: onPressed,
style: FilledButton.styleFrom().copyWith(
Expand All @@ -90,20 +83,11 @@ class ButtonAtom extends StatelessWidget {
? MaterialStateProperty.all(colorScheme.outline)
: null,
),
child: TextAtom(
text ?? '',
translate: translate,
maxLines: 1,
style: textTheme.bodyLarge,
),
child: label(textTheme),
),
);
}
return Container(
constraints: BoxConstraints(
minWidth: width,
),
height: _height,
return buttonConstraints(
child: FilledButton.icon(
onPressed: onPressed,
style: FilledButton.styleFrom().copyWith(
Expand All @@ -113,20 +97,11 @@ class ButtonAtom extends StatelessWidget {
: null,
),
icon: Icon(icon),
label: TextAtom(
text ?? '',
translate: translate,
maxLines: 1,
style: textTheme.bodyLarge,
),
label: label(textTheme),
),
);
} else if (variant == ButtonVariant.tertiary) {
return Container(
constraints: BoxConstraints(
minWidth: width,
),
height: _height,
return buttonConstraints(
child: FilledButton.icon(
onPressed: onPressed,
style: FilledButton.styleFrom().copyWith(
Expand All @@ -136,12 +111,7 @@ class ButtonAtom extends StatelessWidget {
: MaterialStateProperty.all(colorScheme.tertiaryContainer),
),
icon: Icon(icon),
label: TextAtom(
text ?? '',
translate: translate,
maxLines: 1,
style: textTheme.bodyLarge,
),
label: label(textTheme),
),
);
}
Expand Down
16 changes: 13 additions & 3 deletions lib/presentation/atoms/list_tile_atom.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,27 @@ import 'package:flutter/material.dart';
import 'package:infinite_horizons/presentation/atoms/atoms.dart';

class ListTileAtom extends StatelessWidget {
const ListTileAtom(this.title, this.leading, {this.subtitle});
const ListTileAtom(
this.title,
this.leading, {
this.subtitle,
this.translateTitle = true,
this.translateSubtitle = true,
});

final String title;
final String? subtitle;
final Widget leading;
final bool translateTitle;
final bool translateSubtitle;

@override
Widget build(BuildContext context) {
return ListTile(
title: TextAtom(title),
subtitle: subtitle == null ? null : TextAtom(subtitle!),
title: TextAtom(title, translate: translateTitle),
subtitle: subtitle == null
? null
: TextAtom(subtitle!, translate: translateSubtitle),
leading: leading,
);
}
Expand Down
1 change: 0 additions & 1 deletion lib/presentation/atoms/progress_indicator_atom.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import 'package:flutter/material.dart';
class ProgressIndicatorAtom extends StatefulWidget {
const ProgressIndicatorAtom(this.totalDuration, this.callback);

/// In Seconds
final Duration totalDuration;
final VoidCallback callback;

Expand Down
12 changes: 6 additions & 6 deletions lib/presentation/atoms/separator_atom.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ class SeparatorAtom extends StatelessWidget {
Widget build(BuildContext context) {
double spacing;
switch (variant) {
case SeparatorVariant.extenstionOfElement:
case SeparatorVariant.extensionOfElement:
spacing = 2;
case SeparatorVariant.reletedElements:
case SeparatorVariant.relatedElements:
spacing = 5;
case SeparatorVariant.closeWidgets:
spacing = 10;
case SeparatorVariant.generalSpacing:
spacing = AppThemeData.generalSpacing;
case SeparatorVariant.farAppart:
case SeparatorVariant.farApart:
spacing = 45;
}
return SizedBox(
Expand All @@ -29,10 +29,10 @@ class SeparatorAtom extends StatelessWidget {
}

enum SeparatorVariant {
extenstionOfElement,
reletedElements,
extensionOfElement,
relatedElements,
closeWidgets,
generalSpacing,
farAppart,
farApart,
;
}
Loading

0 comments on commit 00f1586

Please sign in to comment.