Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
analyzer:
exclude:
- build/**
- android/**
- ios/**

formatter:
page_width: 120
Expand Down
17 changes: 12 additions & 5 deletions lib/core/services/student_id.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import 'dart:typed_data';
import 'dart:ui' as ui;
import 'package:campus_mobile_experimental/app_networking.dart';
import 'package:campus_mobile_experimental/core/models/student_id_name.dart';
import 'package:campus_mobile_experimental/core/models/student_id_photo.dart';
import 'package:campus_mobile_experimental/core/models/student_id_profile.dart';
import 'package:flutter/foundation.dart';
import 'package:dio/dio.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';

Expand All @@ -17,10 +17,17 @@ class StudentIdService {
await NetworkHelper.authorizedFetch('${dotenv.get('MY_STUDENT_CONTACT_API_ENDPOINT')}/photo', headers),
);

Future<StudentIdProfileModel> fetchStudentIdProfile(Map<String, String> headers) async =>
studentIdProfileModelFromJson(
await NetworkHelper.authorizedFetch('${dotenv.get('MY_STUDENT_PROFILE_API_ENDPOINT')}/profile', headers),
);
// TODO(prisha): temporary debug logging to inspect raw profile JSON; remove before committing.
Future<StudentIdProfileModel> fetchStudentIdProfile(Map<String, String> headers) async {
final rawResponse = await NetworkHelper.authorizedFetch(
'${dotenv.get('MY_STUDENT_PROFILE_API_ENDPOINT')}/profile',
headers,
);
if (kDebugMode) {
debugPrint('STUDENT PROFILE RAW: $rawResponse');
}
return studentIdProfileModelFromJson(rawResponse);
}

/// Load even while CardContainer hides its body. Fresh GETs bypass image caches
/// so retrying an unchanged URL starts a new download and decoding attempt.
Expand Down
40 changes: 40 additions & 0 deletions lib/ui/student_id/student_id_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,21 @@ import 'package:campus_mobile_experimental/ui/common/card_container.dart';
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:flip_card/flip_card.dart';

class StudentIdCard extends StatefulWidget {
@override
_StudentIdCardState createState() => _StudentIdCardState();
}
class _ImportantNumbers {
final String agencyName;
final String number;
const _ImportantNumbers(this.agencyName, this.number);
}

class _StudentIdCardState extends State<StudentIdCard> {
static const CARD_ID = "student_id";
bool showBack = false;

/// Pop up barcode
createAlertDialog(BuildContext context) {
Expand Down Expand Up @@ -184,7 +191,40 @@ class _StudentIdCardState extends State<StudentIdCard> {
);
}
}
Widget _buildBackContent(BuildContext context){
const importantNums = [_ImportantNumbers('Emergency', '911'),
_ImportantNumbers('UC San Diego Police', '858-534-4357'),
_ImportantNumbers('Campus Emergency Status', '888-308-8273'),
_ImportantNumbers('Community Svc. Off. Escort', '858-534-9255'),
_ImportantNumbers('Counseling and Psychological Svcs', '858-249-0030'),
_ImportantNumbers('Sexual Assault Resource Center', '858-534-5793'),
_ImportantNumbers('Trevor Project LGBTQ+ Crisis Lifeline', 'Call: 1-866-488-7386, Text: START to 678-678')
];
return Column(
children:[
for (final entry in importantNums)
Padding(
padding: const EdgeInsets.only(bottom: 8),
child: Text.rich(
TextSpan(
style: Theme.of(context).textTheme.bodySmall?.copyWith(height: 1.3),
children: [
TextSpan(
text: entry.agencyName,
style: const TextStyle(fontWeight: FontWeight.w700),
),
const TextSpan(text: '\n'),
TextSpan(text: entry.number),
],
),
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
),
]

);
}
Widget _sectionLoading(String label) => Semantics(
label: label,
child: Align(
Expand Down
24 changes: 16 additions & 8 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.1.1"
flip_card:
dependency: "direct main"
description:
name: flip_card
sha256: ac079be6474e7005c1ea770a168194d207d5a24c88a463a0eb9fe838846fc517
url: "https://pub.dev"
source: hosted
version: "0.6.0"
flutter:
dependency: "direct main"
description: flutter
Expand Down Expand Up @@ -845,10 +853,10 @@ packages:
dependency: transitive
description:
name: matcher
sha256: dc0b7dc7651697ea4ff3e69ef44b0407ea32c487a39fff6a4004fa585e901861
sha256: "31bd099b47c10cd1aeb55146a2d46ce0277630ecef3f7dae54ad7873f36696cd"
url: "https://pub.dev"
source: hosted
version: "0.12.19"
version: "0.12.20"
material_color_utilities:
dependency: transitive
description:
Expand All @@ -869,10 +877,10 @@ packages:
dependency: transitive
description:
name: meta
sha256: "1741988757a65eb6b36abe716829688cf01910bbf91c34354ff7ec1c3de2b349"
sha256: "307249ce4ff29d58a18e97f6345f539382eb9c9c29ecda628900f31de0443dd9"
url: "https://pub.dev"
source: hosted
version: "1.18.0"
version: "1.19.0"
mime:
dependency: transitive
description:
Expand Down Expand Up @@ -1218,10 +1226,10 @@ packages:
dependency: transitive
description:
name: test_api
sha256: "949a932224383300f01be9221c39180316445ecb8e7547f70a41a35bf421fb9e"
sha256: "2a122cbe059f8b610d3a5415f42e255b6c17b1f21eee1d960f31080237fb4f11"
url: "https://pub.dev"
source: hosted
version: "0.7.11"
version: "0.7.12"
timezone:
dependency: transitive
description:
Expand Down Expand Up @@ -1354,10 +1362,10 @@ packages:
dependency: transitive
description:
name: vector_math
sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b
sha256: fa49e1674cb84acb900141714e6c6e1f9ae099827c24d141430ff6819db4e1bc
url: "https://pub.dev"
source: hosted
version: "2.2.0"
version: "2.4.4"
visibility_detector:
dependency: "direct main"
description:
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ dependencies:
url_launcher: ^6.3.1
visibility_detector: ^0.4.0+2
webview_flutter: ^4.4.2
flip_card: ^0.6.0
wifi_connection:
git:
url: https://github.com/UCSD/wifi_connection.git
Expand Down
Loading