Skip to content

Commit

Permalink
Fix warrning #127
Browse files Browse the repository at this point in the history
  • Loading branch information
guyluz11 committed Jun 26, 2024
1 parent a8d1dec commit af37856
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
11 changes: 6 additions & 5 deletions lib/presentation/molecules/energy_selection_molecule.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,17 @@ class _EnergySelectionMoleculeState extends State<EnergySelectionMolecule> {

Widget energyWidget(EnergyType type) {
final EnergyLevel timerStatesTemp = EnergyLevel.fromEnergyType(type);
String subtitle = '';
final StringBuffer subtitleBuffer = StringBuffer();

final TimerSession firstTimerState = timerStatesTemp.sessions.first;

for (final TimerSession timerState in timerStatesTemp.sessions) {
if (timerState != firstTimerState) {
subtitle += ' -> ';
subtitleBuffer.write(' -> ');
}
subtitle =
'$subtitle${timerState.study.inMinutes}m study -> ${timerState.breakDuration.inMinutes}m break';
subtitleBuffer.write(
'${timerState.study.inMinutes}m study -> ${timerState.breakDuration.inMinutes}m break',
);
}

final bool showTipButton = timerStatesTemp.type.tipsId != null &&
Expand All @@ -61,7 +62,7 @@ class _EnergySelectionMoleculeState extends State<EnergySelectionMolecule> {
},
child: ListTileAtom(
'${type.previewName.tr()} - ${type.duration.inMinutes}${'minutes_single'.tr()}',
subtitle: subtitle,
subtitle: subtitleBuffer.toString(),
leading: Radio<EnergyType>(
value: type,
groupValue: timerStates.type,
Expand Down
9 changes: 6 additions & 3 deletions lib/presentation/pages/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
super.initState();
WidgetsBinding.instance.addObserver(this);
PlayerController.instance.setIsSound(
PreferencesController.instance.getBool(PreferenceKeys.isSound.name) ??
true);
PreferencesController.instance.getBool(PreferenceKeys.isSound.name) ??
true,
);
PlayerController.instance.play('start_session.wav');
VibrationController.instance.vibrate(VibrationType.heavy);
TimerStateManager.iterateOverTimerStates();
Expand Down Expand Up @@ -93,7 +94,9 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
PreferencesController.instance
.setDateTime(PreferenceKeys.pausedTime.name, DateTime.now());
PreferencesController.instance.setString(
PreferenceKeys.timerState.name, TimerStateManager.state.name);
PreferenceKeys.timerState.name,
TimerStateManager.state.name,
);
PreferencesController.instance.setDuration(
PreferenceKeys.remainingTimerTime.name,
TimerStateManager.remainingTime ?? Duration.zero,
Expand Down

0 comments on commit af37856

Please sign in to comment.