-
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.
- Loading branch information
1 parent
324e189
commit 53a5e3f
Showing
4 changed files
with
222 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:intl/intl.dart'; | ||
import 'package:uneconly/common/utils/string_utils.dart'; | ||
import 'package:uneconly/feature/schedule/model/day_schedule.dart'; | ||
import 'package:uneconly/feature/schedule/widget/lesson_big_tile.dart'; | ||
|
||
/// {@template day_schedule_widget} | ||
/// DayScheduleWidget widget | ||
/// {@endtemplate} | ||
class DaySchedulePage extends StatelessWidget { | ||
final DaySchedule daySchedule; | ||
|
||
/// {@macro day_schedule_widget} | ||
const DaySchedulePage({super.key, required this.daySchedule}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
appBar: AppBar( | ||
title: Text( | ||
capitalize( | ||
DateFormat('EEEE, d MMMM', 'ru').format( | ||
daySchedule.day, | ||
), | ||
), | ||
), | ||
), | ||
body: ListView.builder( | ||
itemCount: daySchedule.lessons.length, | ||
itemBuilder: (context, index) { | ||
return LessonBigTile( | ||
lesson: daySchedule.lessons[index], | ||
); | ||
}, | ||
), | ||
); | ||
} | ||
} |
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,108 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:intl/intl.dart'; | ||
import 'package:uneconly/common/utils/string_utils.dart'; | ||
import 'package:uneconly/feature/schedule/model/lesson.dart'; | ||
import 'package:uneconly/feature/schedule/widget/lesson_property.dart'; | ||
|
||
/// {@template lesson_big_tile} | ||
/// LessonBigTile widget | ||
/// {@endtemplate} | ||
class LessonBigTile extends StatelessWidget { | ||
final Lesson lesson; | ||
|
||
/// {@macro lesson_big_tile} | ||
const LessonBigTile({ | ||
super.key, | ||
required this.lesson, | ||
}); | ||
|
||
Widget _buildLessonProperty( | ||
BuildContext context, | ||
IconData icon, | ||
String text, | ||
) { | ||
return LessonProperty( | ||
icon: icon, | ||
text: text, | ||
); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final professor = lesson.professor; | ||
|
||
return Container( | ||
padding: const EdgeInsets.all(8), | ||
child: Row( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: [ | ||
Container( | ||
padding: const EdgeInsets.only(right: 8), | ||
child: Column( | ||
crossAxisAlignment: CrossAxisAlignment.end, | ||
children: [ | ||
Text( | ||
DateFormat('HH:mm').format( | ||
lesson.start, | ||
), | ||
style: const TextStyle( | ||
fontWeight: FontWeight.bold, | ||
fontSize: 18, | ||
), | ||
), | ||
RichText( | ||
text: TextSpan(children: [ | ||
const TextSpan( | ||
text: 'A', | ||
style: TextStyle( | ||
fontWeight: FontWeight.bold, | ||
fontSize: 18, | ||
), | ||
), | ||
TextSpan( | ||
text: DateFormat('HH:mm').format( | ||
lesson.end, | ||
), | ||
style: const TextStyle( | ||
color: Colors.black, | ||
), | ||
), | ||
]), | ||
), | ||
], | ||
), | ||
), | ||
Expanded( | ||
child: Column( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: [ | ||
Text( | ||
lesson.name, | ||
style: const TextStyle( | ||
fontWeight: FontWeight.bold, | ||
fontSize: 18, | ||
), | ||
), | ||
const SizedBox( | ||
height: 4, | ||
), | ||
_buildLessonProperty( | ||
context, | ||
Icons.location_on, | ||
trimSeparators(lesson.location), | ||
), | ||
if (professor != null) | ||
_buildLessonProperty( | ||
context, | ||
Icons.person, | ||
professor, | ||
), | ||
const Divider(), | ||
], | ||
), | ||
), | ||
], | ||
), | ||
); | ||
} | ||
} // LessonBigTile |
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,44 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class LessonProperty extends StatelessWidget { | ||
final IconData icon; | ||
final String text; | ||
|
||
const LessonProperty({ | ||
super.key, | ||
required this.icon, | ||
required this.text, | ||
}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Container( | ||
margin: const EdgeInsets.only(top: 2), | ||
padding: const EdgeInsets.all(2), | ||
decoration: BoxDecoration( | ||
// color: Theme.of(context).colorScheme.secondary, | ||
// rounded corners | ||
borderRadius: BorderRadius.circular(4), | ||
), | ||
child: Row( | ||
mainAxisSize: MainAxisSize.min, | ||
children: [ | ||
Icon( | ||
icon, | ||
size: 14, | ||
// color: Colors.white, | ||
), | ||
const SizedBox( | ||
width: 4, | ||
), | ||
Text( | ||
text, | ||
style: const TextStyle( | ||
// color: Theme.of(context).colorScheme.onPrimary, | ||
), | ||
), | ||
], | ||
), | ||
); | ||
} | ||
} // DayScheduleWidget |
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