From 3e0333f4a05ff4e6f378ca7cb4a8a5eec772e22e Mon Sep 17 00:00:00 2001 From: Erick Date: Sun, 19 May 2024 15:27:00 +0300 Subject: [PATCH] feat: displaying user physical ID --- assets/logos/du-logo.png | Bin 0 -> 7398 bytes lib/exports/barrel.dart | 1 + lib/pages/membership_pages.dart | 32 ++++++ lib/pages/profile_page.dart | 16 ++- lib/widgets/school_id_card_widget.dart | 145 +++++++++++++++++++++++++ lib/widgets/widgets.dart | 1 + pubspec.yaml | 1 + 7 files changed, 193 insertions(+), 3 deletions(-) create mode 100644 assets/logos/du-logo.png create mode 100644 lib/pages/membership_pages.dart create mode 100644 lib/widgets/school_id_card_widget.dart diff --git a/assets/logos/du-logo.png b/assets/logos/du-logo.png new file mode 100644 index 0000000000000000000000000000000000000000..02ba3404c81a7af2354dc39edc4e6d2bd82e6195 GIT binary patch literal 7398 zcmb7JcR1B=*gxm^;%k4c$ow8#_R7dOBP)AWMjR1YQIwEz95fJRj}R$Jgk+CnlTk)? zP9m!^BgE_X{{8;*Ue|Ly&-Hws`*T0*zMlKKpZkHisXh}u4?O~bU@|l~Z;3!qfd~YW z8>Bix2A`nQP8w%(V{6@$7E!nP|0>7F$MNHPnC|WFmBWqwBj3S4^V|PMe*b$-*+12~ zb*6ngd-`wP!okJ9ov@KzHzNY!WC|$2($osk5`kHV#D5P1fnsT1f-tge=d8OX!ZS)A8yX z)r#I!^YkHReSaU_2?$}{vnyC-A^v!MTKD}ng6~;PYIu!ijcrLb_d1_hoOj*FyySVE zE=DJxxJGPuXyf-KiF5c^+P5!EwZ7!B->6(@@1~h7qMCcjy^T^SQ39!iH>+}ux(Ro| zh4xpwdNKK*illsL8N%GHV>-}K|zV6a;RShC!eI9(%QBODeh8Z zmBd7W$P_*Rf8OX3q&8efttrhypbWqO4QDj$mmFdK_MsTMyvPQ5f};ayunHwudNNGY zIy`vuDTLBm{7;YOE_Ex<_Vo?uk`ea)w$fJ-(oPif+{ym)l|c6SUQ4I~BAsu3=!5IF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mr z^7Rdq5c;kFYR=H2E9m0mUU=q?aDY&kr70I6`;zXhqiWxSKjHK!uP0~XFc>AfGF7D zp*yDAmyT{!-a$6fQ1|OS0ObYhv0%m@*x~AwncwsDYJ#jv;`IukzyG0Df^@DJ5I=A- z)zrPe%DHdKJQ-2CQyu%1vK7Xa0BQXY*Gc*UwewbdYSXJ9qYzQ>mbOh$O|!pKj?2LuLp?sN0lU9rSte1)gpGKaxFe^o)x;}MQ7LL zb~#*?GBLh<_kN!)O*_w3Q(+c`@Zw{tz*?kpF$iWoEW152Akcct zDxmqY9^xwVVpzVdsoC+LN4qyComYjikk9iKV#`O>=px}Qmnzebf_X7(W6}LqSwm;v zJ^qTjpHV%o&bd0qq_tqk9kH+_Sy?*ZnUdM-)pkR5j51j$;!_&G$W!~id{&7^Hdf5e zYxilN9k0f;Ldz{anP7tdR$7B~iN^7*hyt9YtAUXE5JVb8j0nRcee7;gV4GLz+*77q zp+;uazBQ{+kaTrJr&;mxV_Cb#1sNq2^h=j0FE^1colq||=9=Xi$J%xIWZ+l^44?df z=RHXaMi5%pk9)X@LajoRf?~8~bVw2chd^Vp-2Vyz5DNUS8zD+UR3HK}N`CRV?6mxs Our$;)J^vQxO#C0r#0N+K literal 0 HcmV?d00001 diff --git a/lib/exports/barrel.dart b/lib/exports/barrel.dart index a850f37..80134df 100644 --- a/lib/exports/barrel.dart +++ b/lib/exports/barrel.dart @@ -1,4 +1,5 @@ export 'package:flutter/material.dart'; +export 'package:academia/widgets/widgets.dart'; export 'package:academia/constants/common.dart'; export 'package:ionicons/ionicons.dart'; export 'package:academia/widgets/academia_app_bar.dart'; diff --git a/lib/pages/membership_pages.dart b/lib/pages/membership_pages.dart new file mode 100644 index 0000000..4cc1491 --- /dev/null +++ b/lib/pages/membership_pages.dart @@ -0,0 +1,32 @@ +import 'package:academia/exports/barrel.dart'; +import 'package:get/get.dart'; + +class MembershipPage extends StatefulWidget { + const MembershipPage({super.key}); + + @override + State createState() => _MembershipPageState(); +} + +class _MembershipPageState extends State { + final UserController userController = Get.find(); + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: const Text("Your Memberships"), + ), + body: SafeArea( + minimum: const EdgeInsets.symmetric(horizontal: 8), + child: Center( + child: Hero( + tag: "membership", + child: SchoolIDCard( + user: userController.user.value!, + ), + ), + ), + ), + ); + } +} diff --git a/lib/pages/profile_page.dart b/lib/pages/profile_page.dart index aeab598..e9e6eac 100644 --- a/lib/pages/profile_page.dart +++ b/lib/pages/profile_page.dart @@ -1,4 +1,5 @@ import 'package:academia/exports/barrel.dart'; +import 'package:academia/pages/membership_pages.dart'; import 'package:get/get.dart'; import 'package:google_fonts/google_fonts.dart'; @@ -99,9 +100,18 @@ class ProfilePage extends StatelessWidget { ], ), const SizedBox(height: 16), - TextButton( - onPressed: () {}, - child: const Text("Preview school ID"), + Hero( + tag: "membership", + child: TextButton( + onPressed: () { + Navigator.of(context).push( + MaterialPageRoute( + builder: (context) => const MembershipPage(), + ), + ); + }, + child: const Text("Preview school ID"), + ), ), const SizedBox(height: 16), ], diff --git a/lib/widgets/school_id_card_widget.dart b/lib/widgets/school_id_card_widget.dart new file mode 100644 index 0000000..4803ee3 --- /dev/null +++ b/lib/widgets/school_id_card_widget.dart @@ -0,0 +1,145 @@ +import 'package:academia/exports/barrel.dart'; +import 'package:academia/models/user/user.dart'; +import 'package:google_fonts/google_fonts.dart'; + +class SchoolIDCard extends StatelessWidget { + const SchoolIDCard({super.key, required this.user}); + final User user; + + @override + Widget build(BuildContext context) { + return Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), + border: Border.all( + color: Theme.of(context).colorScheme.shadow, + ), + ), + padding: const EdgeInsets.all(16), + constraints: BoxConstraints( + maxWidth: MediaQuery.of(context).size.width, + maxHeight: 250, + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Row( + children: [ + Image.asset( + "assets/logos/du-logo.png", + width: 80, + ), + const Spacer(), + Text( + "STUDENT", + style: Theme.of(context).textTheme.titleLarge?.copyWith( + color: Colors.red, + fontWeight: FontWeight.w700, + ), + ) + ], + ), + const SizedBox(height: 4), + Text( + user.name!.toUpperCase(), + style: Theme.of(context).textTheme.titleMedium?.copyWith( + fontFamily: GoogleFonts.jetBrainsMono().fontFamily, + ), + textAlign: TextAlign.left, + ), + const SizedBox(height: 8), + Row( + children: [ + Flexible( + flex: 1, + child: ClipRRect( + borderRadius: BorderRadius.circular(200), + child: CircleAvatar( + radius: 60, + child: Image.memory( + Uint8List.fromList( + base64Decode(user.profile! + .replaceFirst("data:image/gif;base64,", "")), + ), + fit: BoxFit.contain, + ), + ), + ), + ), + const SizedBox(width: 12), + Flexible( + flex: 2, + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Row( + children: [ + Text( + "ID/ Passport: ", + style: + Theme.of(context).textTheme.bodySmall?.copyWith( + fontWeight: FontWeight.bold, + fontFamily: + GoogleFonts.jetBrainsMono().fontFamily, + ), + ), + Text( + user.idno!, + style: + Theme.of(context).textTheme.bodySmall?.copyWith( + fontFamily: + GoogleFonts.jetBrainsMono().fontFamily, + ), + ), + ], + ), + const SizedBox(height: 8), + Row( + children: [ + Text( + "Admission: ", + style: + Theme.of(context).textTheme.bodySmall?.copyWith( + fontWeight: FontWeight.bold, + fontFamily: + GoogleFonts.jetBrainsMono().fontFamily, + ), + ), + Text( + user.regno!, + style: + Theme.of(context).textTheme.bodySmall?.copyWith( + fontFamily: + GoogleFonts.jetBrainsMono().fontFamily, + ), + ), + ], + ), + const SizedBox(height: 8), + Text( + user.regno!, + textAlign: TextAlign.left, + style: Theme.of(context).textTheme.displayLarge?.copyWith( + fontWeight: FontWeight.bold, + fontFamily: + GoogleFonts.libreBarcode128().fontFamily, + ), + ), + ], + ), + ) + ], + ), + const Spacer(), + Text( + "*Note that this is a duplicate, data provided here is as is", + style: Theme.of(context) + .textTheme + .bodySmall + ?.copyWith(color: Colors.red), + ), + ], + ), + ); + } +} diff --git a/lib/widgets/widgets.dart b/lib/widgets/widgets.dart index 5893591..faac5c7 100644 --- a/lib/widgets/widgets.dart +++ b/lib/widgets/widgets.dart @@ -1 +1,2 @@ export 'package:academia/widgets/stat.dart'; +export 'school_id_card_widget.dart'; diff --git a/pubspec.yaml b/pubspec.yaml index f1bf947..bf4ba67 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -104,6 +104,7 @@ flutter: assets: - assets/icons/ - assets/images/ + - assets/logos/ - shorebird.yaml # - images/a_dot_ham.jpeg