-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
754772b
commit e531c5b
Showing
12 changed files
with
104 additions
and
71 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
59 changes: 59 additions & 0 deletions
59
...e_page/features/lesson_card/ui/widgets/info_panel/lesson_card_info_panel_time_to_end.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,59 @@ | ||
part of 'package:cube_system/features/timetable_page/features/lesson_card/ui/lesson_card.dart'; | ||
|
||
class LessonCardInfoPanelTimeToEnd extends ConsumerWidget { | ||
const LessonCardInfoPanelTimeToEnd({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context, WidgetRef ref) { | ||
final lesson = ref.watch(_lessonInLessonCard); | ||
|
||
final currentLesson = ref.watch(currentLessonStateHolder); | ||
|
||
final manager = ref.read(timetableLessonsManager); | ||
|
||
final isActiveLessons = manager.isEquelLessons(lesson, currentLesson); | ||
|
||
if (!isActiveLessons) return const SizedBox(); | ||
|
||
return Consumer( | ||
builder: (context, ref, _) { | ||
ref.watch( | ||
currentLessonTimeToEndProvider | ||
.select((value) => value?.format().length), | ||
); | ||
|
||
final hasHours = | ||
(ref.read(currentLessonTimeToEndProvider)?.hours ?? 0) > 0; | ||
|
||
return hasHours | ||
? const LessonCardInfoPanelChip( | ||
minWidth: 66, | ||
text: _LessonCardInfoPanelTimeToEndText(), | ||
) | ||
: const LessonCardInfoPanelChip( | ||
minWidth: 46, | ||
text: _LessonCardInfoPanelTimeToEndText(), | ||
); | ||
}, | ||
); | ||
} | ||
} | ||
|
||
class _LessonCardInfoPanelTimeToEndText extends ConsumerWidget { | ||
const _LessonCardInfoPanelTimeToEndText({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context, WidgetRef ref) { | ||
return Consumer( | ||
builder: (context, ref, _) { | ||
final timeToEnd = ref.watch(currentLessonTimeToEndProvider); | ||
final timeToEndStr = timeToEnd?.format() ?? '00:00'; | ||
return Text( | ||
timeToEndStr, | ||
style: context.textStyles.chipLabel | ||
.copyWith(color: context.colors.white), | ||
); | ||
}, | ||
); | ||
} | ||
} |
25 changes: 0 additions & 25 deletions
25
lib/features/timetable_page/features/lesson_card/ui/widgets/lesson_card_time_left.dart
This file was deleted.
Oops, something went wrong.
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
5 changes: 4 additions & 1 deletion
5
lib/features/timetable_page/state_holders/lessons/current_lesson.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 |
---|---|---|
@@ -1,6 +1,9 @@ | ||
import 'package:cube_system/models/lesson/lesson.dart'; | ||
import 'package:flutter_riverpod/flutter_riverpod.dart'; | ||
|
||
final currentLesson = StateProvider<Lesson?>((ref) { | ||
// TODO: Объеденить current, next, last в один stateHolder | ||
// TODO: Возможно, стоит хранить не Lesson, a LessonDateTimings и LessonTimings | ||
|
||
final currentLessonStateHolder = StateProvider<Lesson?>((ref) { | ||
return null; | ||
}); |
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