Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #22

Merged
merged 6 commits into from
May 1, 2024
Merged

Dev #22

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 33 additions & 1 deletion assets/translations/en-US.json
Original file line number Diff line number Diff line change
@@ -1 +1,33 @@
{}
{
"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",
"studies_link": "Full List",
"all_tips": "All Tips",
"resource_is_empty": "Resource is empty"
}
33 changes: 33 additions & 0 deletions assets/translations/he-IL.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"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": "לא מוגדר",
"studies_link": "לינק למחקרים",
"all_tips": "כל הטיפים",
"resource_is_empty": "אין מקורות"
}
1 change: 1 addition & 0 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = B8Y5J572KK;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "Infinite Horizons";
Expand Down
25 changes: 15 additions & 10 deletions lib/domain/study_type_abstract.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@ abstract class StudyTypeAbstract {
}

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

const StudyType(this.previewName);

final String previewName;
}

Expand All @@ -46,15 +47,19 @@ 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);
const EnergyType(
this.previewName,
this.duration,
);

final Duration duration;
final String previewName;
}
20 changes: 17 additions & 3 deletions lib/domain/tip.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
class Tip {
Tip(this.id, this.text, {this.selected = false});
Tip(
this.id,
this.text, {
this.selected = false,
this.resourceLinks = const [],
});

int id;
String text;
bool selected;
final List<Uri> resourceLinks;
}

List<Tip> tipsList = [
Expand All @@ -12,8 +18,16 @@ List<Tip> tipsList = [
Tip(1, 'Screen/book is being hold in eye level'),

/// Analytical tips
Tip(2, 'Room with low ceiling or hat/hoody'),
Tip(
2,
'Room with low ceiling or hat/hoodie',
resourceLinks: [Uri.parse('https://assets.csom.umn.edu/assets/71190.pdf')],
),

// Creatively tips
Tip(3, 'Environment with high ceiling or outside'),
Tip(
3,
'Environment with high ceiling or outside',
resourceLinks: [Uri.parse('https://assets.csom.umn.edu/assets/71190.pdf')],
),
];
4 changes: 4 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ void main() async {
EasyLocalization(
supportedLocales: const [
Locale('en', 'US'),
Locale('he', 'IL'),
],
path: 'assets/translations',
fallbackLocale: const Locale('en', 'US'),
Expand All @@ -26,6 +27,9 @@ class MyApp extends StatelessWidget {
Widget build(BuildContext context) {
return MaterialApp(
title: 'Infinite Horizons',
localizationsDelegates: context.localizationDelegates,
supportedLocales: context.supportedLocales,
locale: context.locale,
theme: ThemeData(useMaterial3: true, colorScheme: lightColorScheme),
darkTheme: ThemeData(useMaterial3: true, colorScheme: darkColorScheme),
home: IntroPage(),
Expand Down
104 changes: 68 additions & 36 deletions lib/presentation/atoms/button_atom.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,70 +17,107 @@ class ButtonAtom extends StatelessWidget {
final VoidCallback onPressed;
final String? text;
final IconData? icon;
double get width => 250;

double get width => 150;

double get _height => 60;
final bool disabled;
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);
final TextTheme textTheme = themeData.textTheme;
final ColorScheme colorScheme = themeData.colorScheme;

if (variant == ButtonVariant.primary) {
return Container(
constraints: const BoxConstraints(
minWidth: 300,
),
height: _height,
if (icon == null) {
return buttonConstraints(
child: FilledButton(
onPressed: onPressed,
style: FilledButton.styleFrom().copyWith(
alignment: Alignment.center,
backgroundColor: disabled
? MaterialStateProperty.all(colorScheme.outline)
: null,
),
child: label(textTheme),
),
);
}
return buttonConstraints(
child: FilledButton.icon(
onPressed: onPressed,
style: FilledButton.styleFrom().copyWith(
alignment: Alignment.center,
backgroundColor: disabled
? MaterialStateProperty.all(colorScheme.outline)
: MaterialStateProperty.all(colorScheme.primaryContainer),
: null,
),
icon: Icon(icon),
label: TextAtom(
text ?? '',
translate: translate,
maxLines: 1,
style: textTheme.bodyLarge,
),
label: label(textTheme),
),
);
} else if (variant == ButtonVariant.secondary) {
return Container(
constraints: const BoxConstraints(
minWidth: 300,
),
height: _height,
if (icon == null) {
return buttonConstraints(
child: FilledButton.tonal(
onPressed: onPressed,
style: FilledButton.styleFrom().copyWith(
alignment: Alignment.center,
backgroundColor: disabled
? MaterialStateProperty.all(colorScheme.outline)
: null,
),
child: label(textTheme),
),
);
}
return buttonConstraints(
child: FilledButton.icon(
onPressed: onPressed,
style: FilledButton.styleFrom().copyWith(
alignment: Alignment.center,
backgroundColor: disabled
? MaterialStateProperty.all(colorScheme.outline)
: MaterialStateProperty.all(colorScheme.secondaryContainer),
: 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: const BoxConstraints(
minWidth: 300,
),
height: _height,
if (icon == null) {
return buttonConstraints(
child: FilledButton(
onPressed: onPressed,
style: FilledButton.styleFrom().copyWith(
alignment: Alignment.center,
backgroundColor: disabled
? MaterialStateProperty.all(colorScheme.outline)
: MaterialStateProperty.all(colorScheme.tertiaryContainer),
),
child: label(textTheme),
),
);
}
return buttonConstraints(
child: FilledButton.icon(
onPressed: onPressed,
style: FilledButton.styleFrom().copyWith(
Expand All @@ -90,12 +127,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
Loading
Loading