diff --git a/analysis_options.yaml b/analysis_options.yaml index 49186ac53..f01b49788 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,6 +1,8 @@ analyzer: exclude: - build/** + - android/** + - ios/** formatter: page_width: 120 diff --git a/lib/core/services/student_id.dart b/lib/core/services/student_id.dart index 644ff4204..fa5de67b8 100644 --- a/lib/core/services/student_id.dart +++ b/lib/core/services/student_id.dart @@ -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'; @@ -17,10 +17,17 @@ class StudentIdService { await NetworkHelper.authorizedFetch('${dotenv.get('MY_STUDENT_CONTACT_API_ENDPOINT')}/photo', headers), ); - Future fetchStudentIdProfile(Map 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 fetchStudentIdProfile(Map 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. diff --git a/lib/ui/student_id/student_id_card.dart b/lib/ui/student_id/student_id_card.dart index 6ab7b28ba..65291ad54 100644 --- a/lib/ui/student_id/student_id_card.dart +++ b/lib/ui/student_id/student_id_card.dart @@ -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 { static const CARD_ID = "student_id"; +bool showBack = false; /// Pop up barcode createAlertDialog(BuildContext context) { @@ -184,7 +191,40 @@ class _StudentIdCardState extends State { ); } } + 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( diff --git a/pubspec.lock b/pubspec.lock index cea49646f..0b31f0c6d 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -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 @@ -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: @@ -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: @@ -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: @@ -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: diff --git a/pubspec.yaml b/pubspec.yaml index 40778f107..c814c9a2e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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