Skip to content

Commit

Permalink
fix: student id not showing actual student id image but rather the cu…
Browse files Browse the repository at this point in the history
…stomized image
  • Loading branch information
IamMuuo committed Sep 19, 2024
1 parent 8800628 commit c993784
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 9 deletions.
8 changes: 7 additions & 1 deletion lib/models/core/user/user_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class User {
DateTime dateOfBirth;
String campus;
String profileUrl;
String schoolProfile;
String password;
bool active;
int vibePoints;
Expand All @@ -40,6 +41,7 @@ class User {
required this.active,
required this.vibePoints,
required this.pointTransactions,
required this.schoolProfile,
this.dateCreated,
this.dateUpdated,
});
Expand All @@ -58,6 +60,7 @@ class User {
dateOfBirth: DateTime.parse(json['date_of_birth']),
campus: json['campus'],
profileUrl: json['profile_url'],
schoolProfile: json['school_profile'],
password: json['password'],
active: json["active"] is int
? json["active"] == 1
Expand Down Expand Up @@ -111,7 +114,8 @@ class User {
dateOfBirth: dateOfBirth,
campus: campus,
active: active,
profileUrl: profileUrl,
profileUrl: "",
schoolProfile: profileUrl,
pointTransactions: null,
vibePoints: 0,
password: password,
Expand All @@ -136,6 +140,7 @@ class User {
),
'campus': campus,
'profile_url': profileUrl,
'school_profile': schoolProfile,
'password': password,
'active': active == true ? 1 : 0,
'vibe_points': vibePoints,
Expand Down Expand Up @@ -164,6 +169,7 @@ class User {
),
'campus': campus,
'profile_url': profileUrl,
'school_profile': schoolProfile,
'password': password,
'active': active,
'vibe_points': vibePoints,
Expand Down
1 change: 1 addition & 0 deletions lib/storage/schemas.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const schemas = <String, String>{
date_of_birth TEXT,
campus TEXT,
profile_url TEXT,
school_profile TEXT,
password TEXT,
active INTEGER,
vibe_points INTEGER,
Expand Down
2 changes: 1 addition & 1 deletion lib/tools/chirp/models/services/chirp_service.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class ChirpService {
static const urlPrefix = "http://127.0.0.1:8080";
static const urlPrefix = "http://192.168.2.115:8080";
// static const urlPrefix = "http://62.169.16.219:84";
}
2 changes: 1 addition & 1 deletion lib/widgets/profile_picture.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class ProfilePictureWidget extends StatelessWidget {
: Image.memory(
Uint8List.fromList(
base64Decode(
userController.user.value!.profileUrl
userController.user.value!.schoolProfile
.replaceFirst("data:image/gif;base64,", ""),
),
),
Expand Down
25 changes: 19 additions & 6 deletions lib/widgets/school_id_card_widget.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:academia/exports/barrel.dart';
import 'package:academia/models/models.dart';
import 'package:get/get.dart';
import 'package:google_fonts/google_fonts.dart';

class SchoolIDCard extends StatelessWidget {
Expand All @@ -8,6 +9,7 @@ class SchoolIDCard extends StatelessWidget {

@override
Widget build(BuildContext context) {
final UserController userController = Get.find<UserController>();
return Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
Expand Down Expand Up @@ -50,12 +52,23 @@ class SchoolIDCard extends StatelessWidget {
const SizedBox(height: 8),
Row(
children: [
const Flexible(
flex: 1,
child: ProfilePictureWidget(
profileSize: 60,
),
),
Flexible(
flex: 1,
child: CircleAvatar(
radius: 60,
child: ClipRRect(
borderRadius: BorderRadius.circular(800),
child: Image.memory(
Uint8List.fromList(
base64Decode(
userController.user.value!.schoolProfile
.replaceFirst("data:image/gif;base64,", ""),
),
),
fit: BoxFit.cover,
),
),
)),
const SizedBox(width: 12),
Flexible(
flex: 2,
Expand Down

0 comments on commit c993784

Please sign in to comment.