-
Notifications
You must be signed in to change notification settings - Fork 18
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
Showing
6 changed files
with
256 additions
and
99 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,8 @@ | ||
import 'package:uni/model/providers/startup/session_provider.dart'; | ||
|
||
int getStudentNumber(SessionProvider sessionProvider) { | ||
return int.tryParse( | ||
sessionProvider.state!.username.replaceAll(RegExp(r'\D'), ''), | ||
) ?? | ||
0; | ||
} |
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
67 changes: 0 additions & 67 deletions
67
packages/uni_app/lib/view/course_unit_info/widgets/course_unit_student_row.dart
This file was deleted.
Oops, something went wrong.
86 changes: 86 additions & 0 deletions
86
packages/uni_app/lib/view/course_unit_info/widgets/course_unit_student_tile.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,86 @@ | ||
import 'package:figma_squircle/figma_squircle.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:uni/model/entities/course_units/course_unit_class.dart'; | ||
import 'package:uni/model/providers/startup/profile_provider.dart'; | ||
import 'package:uni/session/flows/base/session.dart'; | ||
import 'package:uni_ui/theme.dart'; | ||
|
||
class CourseUnitStudentTile extends StatelessWidget { | ||
const CourseUnitStudentTile(this.student, this.session, {super.key}); | ||
|
||
final CourseUnitStudent student; | ||
final Session session; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final userImage = ProfileProvider.fetchOrGetCachedProfilePicture( | ||
session, | ||
studentNumber: student.number, | ||
); | ||
return FutureBuilder( | ||
builder: (context, snapshot) { | ||
final names = student.name.split(RegExp(r'\s+')); | ||
final firstName = names.first; | ||
final lastName = names.last; | ||
|
||
return Column( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: [ | ||
Container( | ||
decoration: ShapeDecoration( | ||
shape: SmoothRectangleBorder( | ||
borderRadius: SmoothBorderRadius( | ||
cornerRadius: 25, | ||
cornerSmoothing: 1, | ||
), | ||
), | ||
image: DecorationImage( | ||
fit: BoxFit.cover, | ||
image: snapshot.hasData && snapshot.data!.lengthSync() > 0 | ||
? FileImage(snapshot.data!) as ImageProvider | ||
: const AssetImage( | ||
'assets/images/profile_placeholder.png', | ||
), | ||
), | ||
), | ||
child: AspectRatio( | ||
aspectRatio: 1, | ||
child: Container(), | ||
), | ||
), | ||
const SizedBox(height: 8), | ||
LayoutBuilder( | ||
builder: (context, constraints) { | ||
return Container( | ||
width: constraints.maxWidth, | ||
padding: const EdgeInsets.symmetric(horizontal: 4), | ||
child: Column( | ||
children: [ | ||
Text( | ||
firstName, | ||
overflow: TextOverflow.fade, | ||
style: lightTheme.textTheme.titleLarge?.copyWith( | ||
color: grayText, | ||
), | ||
textAlign: TextAlign.center, | ||
), | ||
Text( | ||
lastName, | ||
overflow: TextOverflow.ellipsis, | ||
style: lightTheme.textTheme.titleLarge?.copyWith( | ||
color: grayText, | ||
), | ||
textAlign: TextAlign.center, | ||
), | ||
], | ||
), | ||
); | ||
}, | ||
), | ||
], | ||
); | ||
}, | ||
future: userImage, | ||
); | ||
} | ||
} |
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