From 654f97f2bd44d1fe08ec0e8083b891416d27264b Mon Sep 17 00:00:00 2001 From: Guy Luz Date: Sat, 27 Apr 2024 19:55:15 +0300 Subject: [PATCH 1/6] Added tip to home page getReadyForStudy state --- assets/translations/en-US.json | 4 +- assets/translations/he-IL.json | 3 + lib/main.dart | 4 ++ lib/presentation/atoms/button_atom.dart | 64 ++++++++++++++++--- .../atoms/progress_indicator_atom.dart | 3 - .../organisms/timer_molecule.dart | 3 +- lib/presentation/pages/home_page.dart | 4 +- 7 files changed, 70 insertions(+), 15 deletions(-) create mode 100644 assets/translations/he-IL.json diff --git a/assets/translations/en-US.json b/assets/translations/en-US.json index 9e26dfe..23b7264 100644 --- a/assets/translations/en-US.json +++ b/assets/translations/en-US.json @@ -1 +1,3 @@ -{} \ No newline at end of file +{ + "start_with": "Tip: start with thinking about your last session" +} \ No newline at end of file diff --git a/assets/translations/he-IL.json b/assets/translations/he-IL.json new file mode 100644 index 0000000..0ca52a4 --- /dev/null +++ b/assets/translations/he-IL.json @@ -0,0 +1,3 @@ +{ + "start_with": "טיפ: מומלץ להתחיל בחשיבה על הסאשן האחרון" +} \ No newline at end of file diff --git a/lib/main.dart b/lib/main.dart index 7402643..e936ea7 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -11,6 +11,7 @@ void main() async { EasyLocalization( supportedLocales: const [ Locale('en', 'US'), + Locale('he', 'IL'), ], path: 'assets/translations', fallbackLocale: const Locale('en', 'US'), @@ -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(), diff --git a/lib/presentation/atoms/button_atom.dart b/lib/presentation/atoms/button_atom.dart index 39d7c88..6c6ddc5 100644 --- a/lib/presentation/atoms/button_atom.dart +++ b/lib/presentation/atoms/button_atom.dart @@ -17,7 +17,7 @@ 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; @@ -30,9 +30,32 @@ class ButtonAtom extends StatelessWidget { final ColorScheme colorScheme = themeData.colorScheme; if (variant == ButtonVariant.primary) { + if (icon == null) { + return Container( + constraints: BoxConstraints( + minWidth: width, + ), + height: _height, + child: FilledButton( + onPressed: onPressed, + style: FilledButton.styleFrom().copyWith( + alignment: Alignment.center, + backgroundColor: disabled + ? MaterialStateProperty.all(colorScheme.outline) + : null, + ), + child: TextAtom( + text ?? '', + translate: translate, + maxLines: 1, + style: textTheme.bodyLarge, + ), + ), + ); + } return Container( - constraints: const BoxConstraints( - minWidth: 300, + constraints: BoxConstraints( + minWidth: width, ), height: _height, child: FilledButton.icon( @@ -41,7 +64,7 @@ class ButtonAtom extends StatelessWidget { alignment: Alignment.center, backgroundColor: disabled ? MaterialStateProperty.all(colorScheme.outline) - : MaterialStateProperty.all(colorScheme.primaryContainer), + : null, ), icon: Icon(icon), label: TextAtom( @@ -53,9 +76,32 @@ class ButtonAtom extends StatelessWidget { ), ); } else if (variant == ButtonVariant.secondary) { + if (icon == null) { + return Container( + constraints: BoxConstraints( + minWidth: width, + ), + height: _height, + child: FilledButton.tonal( + onPressed: onPressed, + style: FilledButton.styleFrom().copyWith( + alignment: Alignment.center, + backgroundColor: disabled + ? MaterialStateProperty.all(colorScheme.outline) + : null, + ), + child: TextAtom( + text ?? '', + translate: translate, + maxLines: 1, + style: textTheme.bodyLarge, + ), + ), + ); + } return Container( - constraints: const BoxConstraints( - minWidth: 300, + constraints: BoxConstraints( + minWidth: width, ), height: _height, child: FilledButton.icon( @@ -64,7 +110,7 @@ class ButtonAtom extends StatelessWidget { alignment: Alignment.center, backgroundColor: disabled ? MaterialStateProperty.all(colorScheme.outline) - : MaterialStateProperty.all(colorScheme.secondaryContainer), + : null, ), icon: Icon(icon), label: TextAtom( @@ -77,8 +123,8 @@ class ButtonAtom extends StatelessWidget { ); } else if (variant == ButtonVariant.tertiary) { return Container( - constraints: const BoxConstraints( - minWidth: 300, + constraints: BoxConstraints( + minWidth: width, ), height: _height, child: FilledButton.icon( diff --git a/lib/presentation/atoms/progress_indicator_atom.dart b/lib/presentation/atoms/progress_indicator_atom.dart index 1b7bb7a..b98b0b8 100644 --- a/lib/presentation/atoms/progress_indicator_atom.dart +++ b/lib/presentation/atoms/progress_indicator_atom.dart @@ -26,9 +26,6 @@ class _ProgressIndicatorAtomState extends State vsync: this, duration: widget.totalDuration, ); - controller.addListener(() { - setState(() {}); - }); controller.addStatusListener((status) { if (status == AnimationStatus.completed) { widget.callback(); diff --git a/lib/presentation/organisms/timer_molecule.dart b/lib/presentation/organisms/timer_molecule.dart index 43aa567..7c5e606 100644 --- a/lib/presentation/organisms/timer_molecule.dart +++ b/lib/presentation/organisms/timer_molecule.dart @@ -23,7 +23,8 @@ class TimerMolecule extends StatelessWidget { ), ), const SeparatorAtom(), - Column( + Row( + mainAxisAlignment: MainAxisAlignment.center, children: [ ButtonAtom( variant: ButtonVariant.primary, diff --git a/lib/presentation/pages/home_page.dart b/lib/presentation/pages/home_page.dart index 5c8b071..af677bf 100644 --- a/lib/presentation/pages/home_page.dart +++ b/lib/presentation/pages/home_page.dart @@ -9,7 +9,7 @@ class HomePage extends StatefulWidget { } class _HomePageState extends State { - HomeState state = HomeState.study; + HomeState state = HomeState.getReadyForStudy; final Duration getReadyDuration = const Duration(seconds: 10); final int breakTimeRatio = 5; @@ -75,6 +75,8 @@ class _HomePageState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ const TextAtom('Get ready to study'), + const SeparatorAtom(variant: SeparatorVariant.farAppart), + const TextAtom('start_with'), ProgressIndicatorAtom(getReadyDuration, onTimerComplete), ], ); From a570cdee7e597199dd41bb3a98b827f277998cb0 Mon Sep 17 00:00:00 2001 From: Guy Luz Date: Sat, 27 Apr 2024 19:57:18 +0300 Subject: [PATCH 2/6] Fix progress indicator --- lib/presentation/atoms/progress_indicator_atom.dart | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/presentation/atoms/progress_indicator_atom.dart b/lib/presentation/atoms/progress_indicator_atom.dart index b98b0b8..1b7bb7a 100644 --- a/lib/presentation/atoms/progress_indicator_atom.dart +++ b/lib/presentation/atoms/progress_indicator_atom.dart @@ -26,6 +26,9 @@ class _ProgressIndicatorAtomState extends State vsync: this, duration: widget.totalDuration, ); + controller.addListener(() { + setState(() {}); + }); controller.addStatusListener((status) { if (status == AnimationStatus.completed) { widget.callback(); From e80565db9bf48ff2274291edc175629ab7a0baec Mon Sep 17 00:00:00 2001 From: guyluz11 Date: Mon, 29 Apr 2024 14:57:50 +0300 Subject: [PATCH 3/6] Prevent the screen from sleeping in home page #15 --- lib/presentation/pages/home_page.dart | 15 +++++++++++++++ pubspec.yaml | 1 + 2 files changed, 16 insertions(+) diff --git a/lib/presentation/pages/home_page.dart b/lib/presentation/pages/home_page.dart index af677bf..c7a7ae1 100644 --- a/lib/presentation/pages/home_page.dart +++ b/lib/presentation/pages/home_page.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:infinite_horizons/domain/study_type_abstract.dart'; import 'package:infinite_horizons/presentation/atoms/atoms.dart'; import 'package:infinite_horizons/presentation/organisms/organisms.dart'; +import 'package:wakelock/wakelock.dart'; class HomePage extends StatefulWidget { @override @@ -13,6 +14,20 @@ class _HomePageState extends State { final Duration getReadyDuration = const Duration(seconds: 10); final int breakTimeRatio = 5; + @override + void initState() { + super.initState(); + Wakelock.enable(); + } + + + @override + void dispose() { + Wakelock.disable(); + super.dispose(); + } + + void onTimerComplete() { HomeState nextState; switch (state) { diff --git a/pubspec.yaml b/pubspec.yaml index b81b410..2586dc8 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -18,6 +18,7 @@ dependencies: introduction_screen: ^3.1.14 # Small, easy to use and extensible logger which prints beautiful logs. logger: ^2.0.2+1 + wakelock: ^0.6.2 dev_dependencies: flutter_test: From c55432cb46285d63fb15c3f192fd8b99bf1af48e Mon Sep 17 00:00:00 2001 From: guyluz11 Date: Mon, 29 Apr 2024 15:05:06 +0300 Subject: [PATCH 4/6] Convert timer time to minutes #9 --- lib/presentation/atoms/timer_atom.dart | 3 ++- lib/presentation/pages/home_page.dart | 12 ++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/presentation/atoms/timer_atom.dart b/lib/presentation/atoms/timer_atom.dart index 32e0952..fc3913f 100644 --- a/lib/presentation/atoms/timer_atom.dart +++ b/lib/presentation/atoms/timer_atom.dart @@ -32,10 +32,11 @@ class TimerAtom extends StatelessWidget { color: colorScheme.onBackground, fontWeight: FontWeight.bold, ), - textFormat: CountdownTextFormat.S, + textFormat: CountdownTextFormat.MM_SS, isReverseAnimation: true, isReverse: true, onComplete: onComplete, + ); } } diff --git a/lib/presentation/pages/home_page.dart b/lib/presentation/pages/home_page.dart index c7a7ae1..2ca86e1 100644 --- a/lib/presentation/pages/home_page.dart +++ b/lib/presentation/pages/home_page.dart @@ -1,3 +1,5 @@ +import 'dart:io'; + import 'package:flutter/material.dart'; import 'package:infinite_horizons/domain/study_type_abstract.dart'; import 'package:infinite_horizons/presentation/atoms/atoms.dart'; @@ -17,17 +19,19 @@ class _HomePageState extends State { @override void initState() { super.initState(); - Wakelock.enable(); + if (!Platform.isLinux) { + Wakelock.enable(); + } } - @override void dispose() { - Wakelock.disable(); + if (!Platform.isLinux) { + Wakelock.disable(); + } super.dispose(); } - void onTimerComplete() { HomeState nextState; switch (state) { From 00f1586d151d4410e16b25cb9f653264bbc6f3d7 Mon Sep 17 00:00:00 2001 From: guyluz11 Date: Mon, 29 Apr 2024 15:58:11 +0300 Subject: [PATCH 5/6] Added translations #21 --- assets/translations/en-US.json | 29 ++++++- assets/translations/he-IL.json | 29 ++++++- lib/domain/study_type_abstract.dart | 18 ++--- lib/presentation/atoms/button_atom.dart | 80 ++++++------------- lib/presentation/atoms/list_tile_atom.dart | 16 +++- .../atoms/progress_indicator_atom.dart | 1 - lib/presentation/atoms/separator_atom.dart | 12 +-- .../molecules/energy_selection_molecule.dart | 73 +++++------------ .../study_type_selection_molecule.dart | 4 +- .../organisms/intro/motivation_organism.dart | 5 +- .../organisms/timer_molecule.dart | 4 +- lib/presentation/pages/home_page.dart | 12 +-- lib/presentation/pages/intro_page.dart | 11 +-- 13 files changed, 149 insertions(+), 145 deletions(-) diff --git a/assets/translations/en-US.json b/assets/translations/en-US.json index 23b7264..2b79e06 100644 --- a/assets/translations/en-US.json +++ b/assets/translations/en-US.json @@ -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" } \ No newline at end of file diff --git a/assets/translations/he-IL.json b/assets/translations/he-IL.json index 0ca52a4..b501869 100644 --- a/assets/translations/he-IL.json +++ b/assets/translations/he-IL.json @@ -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": "לא מוגדר" } \ No newline at end of file diff --git a/lib/domain/study_type_abstract.dart b/lib/domain/study_type_abstract.dart index f959de0..8a81d2c 100644 --- a/lib/domain/study_type_abstract.dart +++ b/lib/domain/study_type_abstract.dart @@ -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); @@ -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); diff --git a/lib/presentation/atoms/button_atom.dart b/lib/presentation/atoms/button_atom.dart index 6c6ddc5..9a61706 100644 --- a/lib/presentation/atoms/button_atom.dart +++ b/lib/presentation/atoms/button_atom.dart @@ -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); @@ -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( @@ -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( @@ -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( @@ -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( @@ -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( @@ -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), ), ); } diff --git a/lib/presentation/atoms/list_tile_atom.dart b/lib/presentation/atoms/list_tile_atom.dart index 4ec4cc7..beb557a 100644 --- a/lib/presentation/atoms/list_tile_atom.dart +++ b/lib/presentation/atoms/list_tile_atom.dart @@ -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, ); } diff --git a/lib/presentation/atoms/progress_indicator_atom.dart b/lib/presentation/atoms/progress_indicator_atom.dart index 1b7bb7a..c1fbf64 100644 --- a/lib/presentation/atoms/progress_indicator_atom.dart +++ b/lib/presentation/atoms/progress_indicator_atom.dart @@ -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; diff --git a/lib/presentation/atoms/separator_atom.dart b/lib/presentation/atoms/separator_atom.dart index b828707..7ee16a2 100644 --- a/lib/presentation/atoms/separator_atom.dart +++ b/lib/presentation/atoms/separator_atom.dart @@ -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( @@ -29,10 +29,10 @@ class SeparatorAtom extends StatelessWidget { } enum SeparatorVariant { - extenstionOfElement, - reletedElements, + extensionOfElement, + relatedElements, closeWidgets, generalSpacing, - farAppart, + farApart, ; } diff --git a/lib/presentation/molecules/energy_selection_molecule.dart b/lib/presentation/molecules/energy_selection_molecule.dart index 7300a77..f8f7b22 100644 --- a/lib/presentation/molecules/energy_selection_molecule.dart +++ b/lib/presentation/molecules/energy_selection_molecule.dart @@ -1,3 +1,4 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:infinite_horizons/domain/study_type_abstract.dart'; import 'package:infinite_horizons/presentation/atoms/atoms.dart'; @@ -29,66 +30,36 @@ class _EnergySelectionMoleculeState extends State { widget.callback(); } + Widget energyWidget(EnergyType type) { + return ListTileAtom( + '${type.previewName.tr()} - ${type.duration.inMinutes}${'minutes_single'.tr()}', + Radio( + value: type, + groupValue: energy, + onChanged: onChanged, + ), + translateTitle: false, + ); + } + @override Widget build(BuildContext context) { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - const TextAtom('Classic Pomodoro:'), + const TextAtom('classic_pomodoro'), const SeparatorAtom(), - ListTileAtom( - '${EnergyType.medium.previewName} - ${EnergyType.medium.duration.inMinutes}m', - Radio( - value: EnergyType.medium, - groupValue: energy, - onChanged: onChanged, - ), - ), - const SeparatorAtom(variant: SeparatorVariant.farAppart), - const TextAtom('Custom:'), + energyWidget(EnergyType.medium), + const SeparatorAtom(variant: SeparatorVariant.farApart), + const TextAtom('custom'), const SeparatorAtom(), Column( children: [ - ListTileAtom( - '${EnergyType.max.previewName} - ${EnergyType.max.duration.inMinutes}m', - Radio( - value: EnergyType.max, - groupValue: energy, - onChanged: onChanged, - ), - ), - ListTileAtom( - '${EnergyType.veryHigh.previewName} - ${EnergyType.veryHigh.duration.inMinutes}m', - Radio( - value: EnergyType.veryHigh, - groupValue: energy, - onChanged: onChanged, - ), - ), - ListTileAtom( - '${EnergyType.high.previewName} - ${EnergyType.high.duration.inMinutes}m', - Radio( - value: EnergyType.high, - groupValue: energy, - onChanged: onChanged, - ), - ), - ListTileAtom( - '${EnergyType.low.previewName} - ${EnergyType.low.duration.inMinutes}m', - Radio( - value: EnergyType.low, - groupValue: energy, - onChanged: onChanged, - ), - ), - ListTileAtom( - '${EnergyType.veryLow.previewName} - ${EnergyType.veryLow.duration.inMinutes}m', - Radio( - value: EnergyType.veryLow, - groupValue: energy, - onChanged: onChanged, - ), - ), + energyWidget(EnergyType.max), + energyWidget(EnergyType.veryHigh), + energyWidget(EnergyType.high), + energyWidget(EnergyType.low), + energyWidget(EnergyType.veryLow), ], ), ], diff --git a/lib/presentation/molecules/study_type_selection_molecule.dart b/lib/presentation/molecules/study_type_selection_molecule.dart index b149ae3..0f1f8d6 100644 --- a/lib/presentation/molecules/study_type_selection_molecule.dart +++ b/lib/presentation/molecules/study_type_selection_molecule.dart @@ -47,7 +47,7 @@ class _StudyTypeSelectionMoleculeState groupValue: selectedType, onChanged: onChanged, ), - subtitle: 'Recommended in the morning', + subtitle: 'recommended_morning', ), ListTileAtom( StudyType.creatively.previewName, @@ -56,7 +56,7 @@ class _StudyTypeSelectionMoleculeState groupValue: selectedType, onChanged: onChanged, ), - subtitle: 'Recommended in the evening', + subtitle: 'recommended_evening', ), ], ); diff --git a/lib/presentation/organisms/intro/motivation_organism.dart b/lib/presentation/organisms/intro/motivation_organism.dart index 122902e..22a8797 100644 --- a/lib/presentation/organisms/intro/motivation_organism.dart +++ b/lib/presentation/organisms/intro/motivation_organism.dart @@ -28,16 +28,15 @@ class MotivationOrganism extends StatelessWidget { case EnergyType.max: text = "So much energy 🔋⚡🔋⚡🔋⚡🔋\nLet's begin"; } - // TODO: Center the elements on the page return Column( mainAxisAlignment: MainAxisAlignment.center, children: [ TextAtom(text), - const SeparatorAtom(variant: SeparatorVariant.farAppart), + const SeparatorAtom(variant: SeparatorVariant.farApart), ButtonAtom( variant: ButtonVariant.primary, onPressed: callback, - text: 'Start', + text: 'start', ), ], ); diff --git a/lib/presentation/organisms/timer_molecule.dart b/lib/presentation/organisms/timer_molecule.dart index 7c5e606..0e4c69c 100644 --- a/lib/presentation/organisms/timer_molecule.dart +++ b/lib/presentation/organisms/timer_molecule.dart @@ -29,13 +29,13 @@ class TimerMolecule extends StatelessWidget { ButtonAtom( variant: ButtonVariant.primary, onPressed: controller.resume, - text: 'Continue', + text: 'continue', ), const SeparatorAtom(), ButtonAtom( variant: ButtonVariant.secondary, onPressed: controller.pause, - text: 'Pause', + text: 'pause', ), ], ), diff --git a/lib/presentation/pages/home_page.dart b/lib/presentation/pages/home_page.dart index 2ca86e1..7a70a4f 100644 --- a/lib/presentation/pages/home_page.dart +++ b/lib/presentation/pages/home_page.dart @@ -57,7 +57,7 @@ class _HomePageState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ const TextAtom( - 'Study Timer', + 'study_timer', variant: TextVariant.smallTitle, ), TimerMolecule( @@ -70,7 +70,7 @@ class _HomePageState extends State { return Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - const TextAtom('Get ready for a break'), + const TextAtom('ready_for_break'), ProgressIndicatorAtom(getReadyDuration, onTimerComplete), ], ); @@ -78,7 +78,7 @@ class _HomePageState extends State { return Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - const TextAtom('Take a break'), + const TextAtom('take_break'), TimerMolecule( onTimerComplete, Duration( @@ -93,8 +93,8 @@ class _HomePageState extends State { return Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - const TextAtom('Get ready to study'), - const SeparatorAtom(variant: SeparatorVariant.farAppart), + const TextAtom('ready_study'), + const SeparatorAtom(variant: SeparatorVariant.farApart), const TextAtom('start_with'), ProgressIndicatorAtom(getReadyDuration, onTimerComplete), ], @@ -110,7 +110,7 @@ class _HomePageState extends State { mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ const TextAtom( - 'Maximize Study Efficiency', + 'study_efficiency', variant: TextVariant.title, ), Expanded( diff --git a/lib/presentation/pages/intro_page.dart b/lib/presentation/pages/intro_page.dart index 94437c0..dfc2a12 100644 --- a/lib/presentation/pages/intro_page.dart +++ b/lib/presentation/pages/intro_page.dart @@ -1,3 +1,4 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:infinite_horizons/domain/study_type_abstract.dart'; import 'package:infinite_horizons/presentation/core/theme_data.dart'; @@ -35,11 +36,11 @@ class _IntroPageState extends State { key: _introKey, pages: [ PageViewModel( - title: 'Let’s Study Efficiently', + title: 'study_efficiently'.tr(), bodyWidget: WelcomeOrganism(), ), PageViewModel( - title: 'Study Type', + title: 'study_type'.tr(), bodyWidget: StudyTypeSelectionMolecule(() { setState(() { studyType = StudyTypeAbstract.instance!.studyType.previewName; @@ -48,15 +49,15 @@ class _IntroPageState extends State { }), ), PageViewModel( - title: 'Efficient $studyType Tips', + title: 'efficient_tips'.tr(args: [studyType.tr()]), bodyWidget: TipsOrganism(), ), PageViewModel( - title: 'Energy', + title: 'energy'.tr(), bodyWidget: EnergySelectionMolecule(nextPage), ), PageViewModel( - title: 'Let’s Start', + title: 'lets_start'.tr(), bodyWidget: MotivationOrganism(() => onDone(context)), ), ], From 1fdcab55dce04805a5728ca90e8326e42952a934 Mon Sep 17 00:00:00 2001 From: Guy Luz Date: Wed, 1 May 2024 15:43:07 +0300 Subject: [PATCH 6/6] Add studies link #12 --- assets/translations/en-US.json | 5 +- assets/translations/he-IL.json | 5 +- ios/Runner.xcodeproj/project.pbxproj | 1 + lib/domain/study_type_abstract.dart | 7 +- lib/domain/tip.dart | 20 ++- lib/presentation/atoms/button_atom.dart | 16 +++ .../organisms/intro/tips_organism.dart | 21 +-- lib/presentation/organisms/organisms.dart | 1 + .../organisms/top_bar_molecule.dart | 135 ++++++++++++++++++ lib/presentation/pages/all_tips.dart | 60 ++++++++ lib/presentation/pages/home_page.dart | 13 +- lib/presentation/pages/tip_information.dart | 42 ++++++ linux/flutter/generated_plugin_registrant.cc | 4 + linux/flutter/generated_plugins.cmake | 1 + pubspec.yaml | 8 +- .../flutter/generated_plugin_registrant.cc | 3 + windows/flutter/generated_plugins.cmake | 1 + 17 files changed, 318 insertions(+), 25 deletions(-) create mode 100644 lib/presentation/organisms/top_bar_molecule.dart create mode 100644 lib/presentation/pages/all_tips.dart create mode 100644 lib/presentation/pages/tip_information.dart diff --git a/assets/translations/en-US.json b/assets/translations/en-US.json index 2b79e06..74fcc58 100644 --- a/assets/translations/en-US.json +++ b/assets/translations/en-US.json @@ -26,5 +26,8 @@ "start": "Start", "analytically": "Analytically", "creatively": "Creatively", - "undefined": "Undefined" + "undefined": "Undefined", + "studies_link": "Full List", + "all_tips": "All Tips", + "resource_is_empty": "Resource is empty" } \ No newline at end of file diff --git a/assets/translations/he-IL.json b/assets/translations/he-IL.json index b501869..c6761c4 100644 --- a/assets/translations/he-IL.json +++ b/assets/translations/he-IL.json @@ -26,5 +26,8 @@ "start": "התחל", "analytically": "אנליטי", "creatively": "יצירתי", - "undefined": "לא מוגדר" + "undefined": "לא מוגדר", + "studies_link": "לינק למחקרים", + "all_tips": "כל הטיפים", + "resource_is_empty": "אין מקורות" } \ No newline at end of file diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 9c8b4f7..15a462d 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -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"; diff --git a/lib/domain/study_type_abstract.dart b/lib/domain/study_type_abstract.dart index 8a81d2c..be0864f 100644 --- a/lib/domain/study_type_abstract.dart +++ b/lib/domain/study_type_abstract.dart @@ -32,6 +32,7 @@ enum StudyType { ; const StudyType(this.previewName); + final String previewName; } @@ -54,7 +55,11 @@ enum EnergyType { max('max', Duration(minutes: 90)), ; - const EnergyType(this.previewName, this.duration); + const EnergyType( + this.previewName, + this.duration, + ); + final Duration duration; final String previewName; } diff --git a/lib/domain/tip.dart b/lib/domain/tip.dart index a3f9e7e..d05431c 100644 --- a/lib/domain/tip.dart +++ b/lib/domain/tip.dart @@ -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 resourceLinks; } List tipsList = [ @@ -12,8 +18,16 @@ List 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')], + ), ]; diff --git a/lib/presentation/atoms/button_atom.dart b/lib/presentation/atoms/button_atom.dart index 9a61706..abea488 100644 --- a/lib/presentation/atoms/button_atom.dart +++ b/lib/presentation/atoms/button_atom.dart @@ -17,7 +17,9 @@ class ButtonAtom extends StatelessWidget { final VoidCallback onPressed; final String? text; final IconData? icon; + double get width => 150; + double get _height => 60; final bool disabled; final bool translate; @@ -101,6 +103,20 @@ class ButtonAtom extends StatelessWidget { ), ); } else if (variant == ButtonVariant.tertiary) { + 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, diff --git a/lib/presentation/organisms/intro/tips_organism.dart b/lib/presentation/organisms/intro/tips_organism.dart index b4e3320..619c3f6 100644 --- a/lib/presentation/organisms/intro/tips_organism.dart +++ b/lib/presentation/organisms/intro/tips_organism.dart @@ -1,8 +1,8 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:infinite_horizons/domain/study_type_abstract.dart'; import 'package:infinite_horizons/domain/tip.dart'; import 'package:infinite_horizons/presentation/atoms/atoms.dart'; +import 'package:infinite_horizons/presentation/pages/all_tips.dart'; class TipsOrganism extends StatelessWidget { void onCheckBox(int id, bool value) => @@ -25,13 +25,18 @@ class TipsOrganism extends StatelessWidget { }, itemCount: StudyTypeAbstract.instance!.getTips().length, ), - // TODO: Add full list page - // const Row( - // mainAxisAlignment: MainAxisAlignment.end, - // children: [ - // TextAtom('Full list'), - // ], - // ), + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + ButtonAtom( + variant: ButtonVariant.tertiary, + onPressed: () => Navigator.of(context).push( + MaterialPageRoute(builder: (context) => AllTips()), + ), + text: 'studies_link', + ), + ], + ), ], ); } diff --git a/lib/presentation/organisms/organisms.dart b/lib/presentation/organisms/organisms.dart index 47ab48f..23aa461 100644 --- a/lib/presentation/organisms/organisms.dart +++ b/lib/presentation/organisms/organisms.dart @@ -2,3 +2,4 @@ export 'package:infinite_horizons/presentation/organisms/intro/motivation_organi export 'package:infinite_horizons/presentation/organisms/intro/tips_organism.dart'; export 'package:infinite_horizons/presentation/organisms/intro/welcome_organism.dart'; export 'package:infinite_horizons/presentation/organisms/timer_molecule.dart'; +export 'package:infinite_horizons/presentation/organisms/top_bar_molecule.dart'; diff --git a/lib/presentation/organisms/top_bar_molecule.dart b/lib/presentation/organisms/top_bar_molecule.dart new file mode 100644 index 0000000..796c15b --- /dev/null +++ b/lib/presentation/organisms/top_bar_molecule.dart @@ -0,0 +1,135 @@ +import 'package:flutter/material.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import 'package:infinite_horizons/presentation/atoms/atoms.dart'; +import 'package:infinite_horizons/presentation/core/theme_data.dart'; + +/// Top part of the pages, will show page name and settings logo, +/// and sometimes will have back button. +class TopBarMolecule extends StatelessWidget { + const TopBarMolecule({ + required this.pageName, + this.rightIcon, + this.rightIconFunction, + this.leftIcon, + this.leftIconFunction, + this.rightSecondIcon, + this.rightSecondFunction, + this.backgroundColor, + }); + + /// Page name to show in the left side of the navigation bar + final String? pageName; + + /// Icon to show in the right side of the bar + final IconData? rightIcon; + + /// Icon to show in the right side of the bar left to the first icon + /// from the right + final IconData? rightSecondIcon; + + /// Icon to show in the left side of the bar + final IconData? leftIcon; + + /// Function to execute when pressing the icon in the right side + final Function(BuildContext)? rightIconFunction; + + /// What to execute if second right icon was pressed + final Function(BuildContext)? rightSecondFunction; + + /// What to execute if back button was pressed + final Function(BuildContext)? leftIconFunction; + + final Color? backgroundColor; + + @override + Widget build(BuildContext context) { + final ThemeData themeData = Theme.of(context); + final ColorScheme colorScheme = themeData.colorScheme; + final TextTheme textTheme = themeData.textTheme; + + final TextStyle style = textTheme.bodyLarge!; + + return SafeArea( + child: ColoredBox( + color: backgroundColor != null + ? backgroundColor!.withOpacity(0.72) + : colorScheme.background, + child: Container( + margin: const EdgeInsets.fromLTRB( + 9, + AppThemeData.generalSpacing, + 9, + AppThemeData.generalSpacing, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + if (leftIcon != null) + Container( + alignment: Alignment.centerLeft, + child: IconButton( + icon: FaIcon( + leftIcon, + size: style.fontSize, + color: colorScheme.tertiary, + ), + onPressed: () => leftIconFunction!(context), + ), + ) + else + const SizedBox(), + TextAtom( + pageName!, + style: style.copyWith(color: colorScheme.tertiary), + ), + ], + ), + if (rightIcon != null) + Row( + children: [ + if (rightSecondIcon != null) + SizedBox( + width: 70, + child: TextButton( + style: ButtonStyle( + padding: MaterialStateProperty.all( + EdgeInsets.zero, + ), + ), + onPressed: () => rightSecondFunction!(context), + child: FaIcon( + rightSecondIcon, + size: style.fontSize, + color: style.color, + ), + ), + ), + SizedBox( + width: 25, + child: TextButton( + style: ButtonStyle( + padding: MaterialStateProperty.all( + EdgeInsets.zero, + ), + ), + onPressed: () => rightIconFunction!(context), + child: Icon( + rightIcon, + size: style.fontSize! + 5, + color: style.color, + ), + ), + ), + ], + ) + else + const SizedBox(), + ], + ), + ), + ), + ); + } +} diff --git a/lib/presentation/pages/all_tips.dart b/lib/presentation/pages/all_tips.dart new file mode 100644 index 0000000..cfb27eb --- /dev/null +++ b/lib/presentation/pages/all_tips.dart @@ -0,0 +1,60 @@ +import 'package:flutter/material.dart'; +import 'package:infinite_horizons/domain/tip.dart'; +import 'package:infinite_horizons/presentation/atoms/atoms.dart'; +import 'package:infinite_horizons/presentation/organisms/organisms.dart'; +import 'package:infinite_horizons/presentation/pages/tip_information.dart'; + +class AllTips extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold( + body: Column( + children: [ + TopBarMolecule( + pageName: 'all_tips', + leftIcon: Icons.arrow_back, + leftIconFunction: (c) => Navigator.of(c).pop(), + ), + ListView.separated( + shrinkWrap: true, + itemBuilder: (context, n) { + final Tip tip = tipsList[n]; + + return UnconstrainedBox( + child: ButtonAtom( + variant: ButtonVariant.tertiary, + onPressed: () => Navigator.of(context).push( + MaterialPageRoute( + builder: (context) => TipInformation(tip), + ), + ), + text: tip.text, + ), + ); + }, + separatorBuilder: (context, i) => const SeparatorAtom(), + itemCount: tipsList.length, + ), + ], + ), + ); + } +} + +// ListView.separated( +// shrinkWrap: true, +// physics: const NeverScrollableScrollPhysics(), +// scrollDirection: Axis.horizontal, +// itemBuilder: (context, r) { +// final Uri resource = tip.resourceLinks[r]; +// +// return ButtonAtom( +// variant: ButtonVariant.tertiary, +// onPressed: () => launchUrl(resource), +// // TODO: Add to translation +// text: 'Link $r', +// ); +// }, +// separatorBuilder: (context, r) => const SeparatorAtom(), +// itemCount: tip.resourceLinks.length, +// ), diff --git a/lib/presentation/pages/home_page.dart b/lib/presentation/pages/home_page.dart index 7a70a4f..4f5a62a 100644 --- a/lib/presentation/pages/home_page.dart +++ b/lib/presentation/pages/home_page.dart @@ -1,10 +1,8 @@ -import 'dart:io'; - import 'package:flutter/material.dart'; import 'package:infinite_horizons/domain/study_type_abstract.dart'; import 'package:infinite_horizons/presentation/atoms/atoms.dart'; import 'package:infinite_horizons/presentation/organisms/organisms.dart'; -import 'package:wakelock/wakelock.dart'; +import 'package:wakelock_plus/wakelock_plus.dart'; class HomePage extends StatefulWidget { @override @@ -19,16 +17,13 @@ class _HomePageState extends State { @override void initState() { super.initState(); - if (!Platform.isLinux) { - Wakelock.enable(); - } + WakelockPlus.enable(); } @override void dispose() { - if (!Platform.isLinux) { - Wakelock.disable(); - } + WakelockPlus.disable(); + super.dispose(); } diff --git a/lib/presentation/pages/tip_information.dart b/lib/presentation/pages/tip_information.dart new file mode 100644 index 0000000..4c94ee2 --- /dev/null +++ b/lib/presentation/pages/tip_information.dart @@ -0,0 +1,42 @@ +import 'package:flutter/material.dart'; +import 'package:infinite_horizons/domain/tip.dart'; +import 'package:infinite_horizons/presentation/atoms/atoms.dart'; +import 'package:infinite_horizons/presentation/organisms/organisms.dart'; +import 'package:url_launcher/url_launcher.dart'; + +class TipInformation extends StatelessWidget { + const TipInformation(this.tip); + + final Tip tip; + + @override + Widget build(BuildContext context) { + return Scaffold( + body: Column( + children: [ + TopBarMolecule( + pageName: tip.text, + leftIcon: Icons.arrow_back, + leftIconFunction: (c) => Navigator.of(c).pop(), + ), + if (tip.resourceLinks.isEmpty) const TextAtom('resource_is_empty'), + Expanded( + child: ListView.separated( + itemBuilder: (context, r) { + final Uri link = tip.resourceLinks[r]; + + return ButtonAtom( + variant: ButtonVariant.tertiary, + onPressed: () => launchUrl(link), + text: 'Resource ${r + 1}', + ); + }, + separatorBuilder: (context, r) => const SeparatorAtom(), + itemCount: tip.resourceLinks.length, + ), + ), + ], + ), + ); + } +} diff --git a/linux/flutter/generated_plugin_registrant.cc b/linux/flutter/generated_plugin_registrant.cc index e71a16d..f6f23bf 100644 --- a/linux/flutter/generated_plugin_registrant.cc +++ b/linux/flutter/generated_plugin_registrant.cc @@ -6,6 +6,10 @@ #include "generated_plugin_registrant.h" +#include void fl_register_plugins(FlPluginRegistry* registry) { + g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar = + fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin"); + url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar); } diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake index 2e1de87..f16b4c3 100644 --- a/linux/flutter/generated_plugins.cmake +++ b/linux/flutter/generated_plugins.cmake @@ -3,6 +3,7 @@ # list(APPEND FLUTTER_PLUGIN_LIST + url_launcher_linux ) list(APPEND FLUTTER_FFI_PLUGIN_LIST diff --git a/pubspec.yaml b/pubspec.yaml index 2586dc8..6c0bdfa 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: infinite_horizons description: "A new Flutter project." publish_to: 'none' -version: 1.0.0+1 +version: 1.0.1+2 environment: sdk: '>=3.3.0 <4.0.0' @@ -15,10 +15,14 @@ dependencies: easy_localization: ^3.0.3 flutter: sdk: flutter + # Font Awesome Icon pack available as Flutter Icons. + font_awesome_flutter: ^10.6.0 introduction_screen: ^3.1.14 # Small, easy to use and extensible logger which prints beautiful logs. logger: ^2.0.2+1 - wakelock: ^0.6.2 + url_launcher: ^6.2.6 + wakelock_plus: ^1.2.4 + dev_dependencies: flutter_test: diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index 8b6d468..4f78848 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -6,6 +6,9 @@ #include "generated_plugin_registrant.h" +#include void RegisterPlugins(flutter::PluginRegistry* registry) { + UrlLauncherWindowsRegisterWithRegistrar( + registry->GetRegistrarForPlugin("UrlLauncherWindows")); } diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index b93c4c3..88b22e5 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -3,6 +3,7 @@ # list(APPEND FLUTTER_PLUGIN_LIST + url_launcher_windows ) list(APPEND FLUTTER_FFI_PLUGIN_LIST