-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: change default subject duration
- Loading branch information
Showing
9 changed files
with
119 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
lib/components/widgets/bottom_sheets/subject_duration_modal_bottom_sheet.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import 'package:easy_localization/easy_localization.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:timetable/components/widgets/bottom_sheets/subject_data_bottom_sheet.dart'; | ||
import 'package:timetable/constants/durations.dart'; | ||
|
||
/// Bottom Sheet Modal Widget used to select the default subject duration. | ||
class SubjectDurationModalBottomSheet extends StatelessWidget { | ||
final ValueNotifier<Duration> duration; | ||
|
||
const SubjectDurationModalBottomSheet({ | ||
super.key, | ||
required this.duration, | ||
}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return SubjectDataBottomSheet( | ||
title: "choose_duration".tr(), | ||
children: List.generate( | ||
durations.length, | ||
(i) { | ||
final d = durations[i]; | ||
bool isSelected = (d == duration.value); | ||
|
||
return ListTile( | ||
title: Row( | ||
children: [ | ||
// writing minutes directly here will only work for now lol | ||
Text( | ||
"${durations[i].inMinutes} minutes", | ||
).tr(), | ||
const Spacer(), | ||
Visibility( | ||
visible: isSelected, | ||
child: const Icon( | ||
Icons.check, | ||
), | ||
), | ||
], | ||
), | ||
visualDensity: VisualDensity.compact, | ||
onTap: () { | ||
duration.value = d; | ||
Navigator.pop(context); | ||
}, | ||
); | ||
}, | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
const List<Duration> durations = [ | ||
Duration(minutes: 60), | ||
Duration(minutes: 120), | ||
Duration(minutes: 180), | ||
Duration(minutes: 240), | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters