From cfda40e3653b6f32929ae9291f983b0c79294e0a Mon Sep 17 00:00:00 2001 From: DavidTarrab Date: Thu, 23 Mar 2023 11:24:55 -0400 Subject: [PATCH 1/5] Made schedule search UI not crappy --- lib/src/pages/clubs.dart | 36 ++++++++++++++ lib/src/pages/schedule.dart | 97 ++++++++++++++++++------------------- 2 files changed, 84 insertions(+), 49 deletions(-) create mode 100644 lib/src/pages/clubs.dart diff --git a/lib/src/pages/clubs.dart b/lib/src/pages/clubs.dart new file mode 100644 index 000000000..e33f13d3e --- /dev/null +++ b/lib/src/pages/clubs.dart @@ -0,0 +1,36 @@ +import "package:flutter/material.dart"; + +import "package:ramaz/models.dart"; +import "package:ramaz/widgets.dart"; +import "drawer.dart"; + +/// Clubs page +class ClubsPage extends StatelessWidget { + @override + Widget build(BuildContext context) => ProviderConsumer( + create: DashboardModel.new, + builder: (model, child) => ResponsiveScaffold( + enableNavigation: true, + drawer: const RamlifeDrawer(), + appBar: AppBar(title: const Text("Clubs"), actions: [ + ResponsiveBuilder( + builder: (_, LayoutInfo layout, __) => + !layout.hasStandardSideSheet && model.schedule.hasSchool + ? Builder( + builder: (BuildContext context) => IconButton( + onPressed: () => + Scaffold.of(context).openEndDrawer(), + icon: const Icon(Icons.schedule, + color: Colors.white), + )) + : const SizedBox.shrink()) + ]), + sideSheet: !model.schedule.hasSchool + ? null + : Drawer(child: ClassList.fromSchedule(model.schedule)), + body: ListView( + padding: + const EdgeInsets.symmetric(horizontal: 12, vertical: 20), + children: const [Text("hi")])), + ); +} diff --git a/lib/src/pages/schedule.dart b/lib/src/pages/schedule.dart index d7ab6194c..17580b5a8 100644 --- a/lib/src/pages/schedule.dart +++ b/lib/src/pages/schedule.dart @@ -9,7 +9,7 @@ import "package:ramaz/widgets.dart"; import "drawer.dart"; /// Allows users to explore their schedule. -/// +/// /// Users can use the calendar button to check the schedule for a given date /// or create a custom [Day] from the drop-down menus. class SchedulePage extends StatelessWidget { @@ -32,15 +32,15 @@ class SchedulePage extends StatelessWidget { ScaffoldMessenger.of(context).showSnackBar( const SnackBar ( content: Text ("There is no school on this day"), - ), + ) ); } } - /// Lets the user know that they chose an invalid schedule combination. - void handleInvalidSchedule(BuildContext context) => ScaffoldMessenger - .of(context) - .showSnackBar(const SnackBar(content: Text("Invalid schedule"))); + /// Lets the user know that they chose an invalid schedule combination. + void handleInvalidSchedule(BuildContext context) => + ScaffoldMessenger.of(context) + .showSnackBar(const SnackBar(content: Text("Invalid schedule"))); @override Widget build(BuildContext context) => ProviderConsumer( @@ -119,14 +119,14 @@ class CustomSearchDelegate extends SearchDelegate { /// This model handles the searching logic. final ScheduleSearchModel model = ScheduleSearchModel(); - /// A constructor that constructs the search bar. - CustomSearchDelegate({ - required String hintText, - }) : super( - searchFieldLabel: hintText, - keyboardType: TextInputType.text, - textInputAction: TextInputAction.search, - ); + /// A constructor that constructs the search bar. + CustomSearchDelegate({ + required String hintText, + }) : super( + searchFieldLabel: hintText, + keyboardType: TextInputType.text, + textInputAction: TextInputAction.search, + ); @override Widget buildLeading(BuildContext context) => ElevatedButton( @@ -134,9 +134,8 @@ class CustomSearchDelegate extends SearchDelegate { child: const Icon(Icons.arrow_back), ); - @override - Widget buildSuggestions(BuildContext context) { - + @override + Widget buildSuggestions(BuildContext context) { final subjects = model.getMatchingClasses(query.toLowerCase()); return ListView( @@ -162,9 +161,8 @@ class CustomSearchDelegate extends SearchDelegate { ); } - @override - Widget buildResults(BuildContext context) { - + @override + Widget buildResults(BuildContext context) { final subjects = model.getMatchingClasses(query.toLowerCase()); return ListView( @@ -199,12 +197,11 @@ class CustomSearchDelegate extends SearchDelegate { /// A class that creates each individual suggestion. class SuggestionWidget extends StatelessWidget { + /// The function to be run when the suggestion is clicked. + final VoidCallback onTap; - /// The function to be run when the suggestion is clicked. - final VoidCallback onTap; - - /// The Subject given to the widget. - final Subject suggestion; + /// The Subject given to the widget. + final Subject suggestion; /// A constructor that defines what a suggestion should have. const SuggestionWidget({ @@ -226,43 +223,45 @@ class SuggestionWidget extends StatelessWidget { children: [ Text( suggestion.name, - style: Theme.of(context).textTheme.headlineMedium, + style: Theme.of(context).textTheme.titleMedium ), const SizedBox(height: 5), Text( "${suggestion.teacher} ${suggestion.id}", - style: Theme.of(context).textTheme.titleLarge, + style: Theme.of(context).textTheme.bodySmall, ), const SizedBox(height: 10), if (suggestion.virtualLink != null) LinkText( "Link: ${suggestion.virtualLink}", shouldTrimParams: true, - linkStyle: const TextStyle(color: Colors.blue), - ), - ], - ), - ), - ), - ],), + textStyle: Theme.of(context).textTheme.bodySmall, + linkStyle: Theme.of(context).textTheme.bodySmall?.merge( + const TextStyle(color: Colors.blue), + ), + ) + ] + ) + ) + ) + ]) ), const Divider( height: 20, indent: 40, - endIndent: 40, - ), - ], + endIndent: 40 + ) + ] ); } /// A class that creates each individual result. class ResultWidget extends StatelessWidget { + /// The PeriodData given to the widget. + final PeriodData period; - /// The PeriodData given to the widget. - final PeriodData period; - - /// A constructor that defines what a result should have. - const ResultWidget(this.period); + /// A constructor that defines what a result should have. + const ResultWidget(this.period); @override Widget build(BuildContext context) => Column( @@ -270,15 +269,15 @@ class ResultWidget extends StatelessWidget { children: [ ListTile( title: Text( - period.dayName, - style: Theme.of(context).textTheme.headlineMedium, + "${period.dayName} Period ${period.name}", + style: Theme.of(context).textTheme.titleMedium ), subtitle: Text( - "Period ${period.name} Room ${period.room}", - style: Theme.of(context).textTheme.titleLarge, - ), + "Room ${period.room}", + style: Theme.of(context).textTheme.bodySmall, + ) ), - for (final int reminder in Models.instance.reminders.getReminders( + for (final reminder in Models.instance.reminders.getReminders( dayName: period.dayName, period: period.name, subject: Models.instance.user.subjects[period.id]?.name, @@ -297,6 +296,6 @@ class ResultWidget extends StatelessWidget { ), ), const Divider(height: 20), - ], + ] ); } From 34600ad72bc6d6149212dc11464f761e70b03afa Mon Sep 17 00:00:00 2001 From: DavidTarrab <71798870+DavidTarrab@users.noreply.github.com> Date: Thu, 23 Mar 2023 12:10:46 -0400 Subject: [PATCH 2/5] Cleaned up accidental changes --- lib/src/pages/clubs.dart | 36 ------------------------------------ 1 file changed, 36 deletions(-) delete mode 100644 lib/src/pages/clubs.dart diff --git a/lib/src/pages/clubs.dart b/lib/src/pages/clubs.dart deleted file mode 100644 index e33f13d3e..000000000 --- a/lib/src/pages/clubs.dart +++ /dev/null @@ -1,36 +0,0 @@ -import "package:flutter/material.dart"; - -import "package:ramaz/models.dart"; -import "package:ramaz/widgets.dart"; -import "drawer.dart"; - -/// Clubs page -class ClubsPage extends StatelessWidget { - @override - Widget build(BuildContext context) => ProviderConsumer( - create: DashboardModel.new, - builder: (model, child) => ResponsiveScaffold( - enableNavigation: true, - drawer: const RamlifeDrawer(), - appBar: AppBar(title: const Text("Clubs"), actions: [ - ResponsiveBuilder( - builder: (_, LayoutInfo layout, __) => - !layout.hasStandardSideSheet && model.schedule.hasSchool - ? Builder( - builder: (BuildContext context) => IconButton( - onPressed: () => - Scaffold.of(context).openEndDrawer(), - icon: const Icon(Icons.schedule, - color: Colors.white), - )) - : const SizedBox.shrink()) - ]), - sideSheet: !model.schedule.hasSchool - ? null - : Drawer(child: ClassList.fromSchedule(model.schedule)), - body: ListView( - padding: - const EdgeInsets.symmetric(horizontal: 12, vertical: 20), - children: const [Text("hi")])), - ); -} From 81271ca607a562128c28ae517a116f7e94cd9c8a Mon Sep 17 00:00:00 2001 From: Levi Lesches Date: Wed, 25 Oct 2023 02:06:18 -0400 Subject: [PATCH 3/5] Added trailing commas --- lib/src/pages/schedule.dart | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/src/pages/schedule.dart b/lib/src/pages/schedule.dart index 17580b5a8..3ac22e948 100644 --- a/lib/src/pages/schedule.dart +++ b/lib/src/pages/schedule.dart @@ -32,7 +32,7 @@ class SchedulePage extends StatelessWidget { ScaffoldMessenger.of(context).showSnackBar( const SnackBar ( content: Text ("There is no school on this day"), - ) + ), ); } } @@ -223,7 +223,7 @@ class SuggestionWidget extends StatelessWidget { children: [ Text( suggestion.name, - style: Theme.of(context).textTheme.titleMedium + style: Theme.of(context).textTheme.titleMedium, ), const SizedBox(height: 5), Text( @@ -239,19 +239,19 @@ class SuggestionWidget extends StatelessWidget { linkStyle: Theme.of(context).textTheme.bodySmall?.merge( const TextStyle(color: Colors.blue), ), - ) - ] - ) - ) - ) - ]) + ), + ], + ), + ), + ), + ],), ), const Divider( height: 20, indent: 40, - endIndent: 40 - ) - ] + endIndent: 40, + ), + ], ); } @@ -270,12 +270,12 @@ class ResultWidget extends StatelessWidget { ListTile( title: Text( "${period.dayName} Period ${period.name}", - style: Theme.of(context).textTheme.titleMedium + style: Theme.of(context).textTheme.titleMedium, ), subtitle: Text( "Room ${period.room}", style: Theme.of(context).textTheme.bodySmall, - ) + ), ), for (final reminder in Models.instance.reminders.getReminders( dayName: period.dayName, @@ -296,6 +296,6 @@ class ResultWidget extends StatelessWidget { ), ), const Divider(height: 20), - ] + ], ); } From 7e415903727cf8d5cba1c6254fa39085ce6991be Mon Sep 17 00:00:00 2001 From: Levi Lesches Date: Wed, 25 Oct 2023 02:18:31 -0400 Subject: [PATCH 4/5] Updated Firebase config --- analysis_options.yaml | 2 +- android/app/google-services.json | 12 ++++++++++-- android/build.gradle | 2 +- ios/firebase_app_id_file.json | 7 +++++++ lib/firebase_options.dart | 21 +++++++++++++++------ lib/src/pages/schedule.dart | 13 ++++--------- 6 files changed, 38 insertions(+), 19 deletions(-) create mode 100644 ios/firebase_app_id_file.json diff --git a/analysis_options.yaml b/analysis_options.yaml index fa1fd827c..d8ff3f72a 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -51,4 +51,4 @@ linter: cascade_invocations: false # this often looks uglier # Temporarily disabled until we are ready to document - public_member_api_docs: false + # public_member_api_docs: false diff --git a/android/app/google-services.json b/android/app/google-services.json index 1dbcedc8a..0e9e010dd 100644 --- a/android/app/google-services.json +++ b/android/app/google-services.json @@ -22,6 +22,14 @@ "certificate_hash": "8de6f0b2cdbf4552c39a0210e58d30da7fddfac3" } }, + { + "client_id": "267381428578-ondug0tlvefmbb9r68754p1vasu896vi.apps.googleusercontent.com", + "client_type": 1, + "android_info": { + "package_name": "com.ramaz.student_life", + "certificate_hash": "e3d8e54917b767218be4bd3cc33b6f754e57d52a" + } + }, { "client_id": "267381428578-s9bsc6bqvfebqimv3th6cjp7qildrpsc.apps.googleusercontent.com", "client_type": 3 @@ -40,10 +48,10 @@ "client_type": 3 }, { - "client_id": "267381428578-cpk8lv86lc3dcq62iegfc98dr3c0tt3u.apps.googleusercontent.com", + "client_id": "267381428578-7a8kkf45mdkepv1vr4j39gmlclcgob1u.apps.googleusercontent.com", "client_type": 2, "ios_info": { - "bundle_id": "com.example.authTest" + "bundle_id": "com.ramaz.ramaz.student-life" } } ] diff --git a/android/build.gradle b/android/build.gradle index ed21df175..139e036e0 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -42,6 +42,6 @@ subprojects { } } -task clean(type: Delete) { +tasks.register("clean", Delete) { delete rootProject.buildDir } diff --git a/ios/firebase_app_id_file.json b/ios/firebase_app_id_file.json new file mode 100644 index 000000000..c1cebebd1 --- /dev/null +++ b/ios/firebase_app_id_file.json @@ -0,0 +1,7 @@ +{ + "file_generated_by": "FlutterFire CLI", + "purpose": "FirebaseAppID & ProjectID for this Firebase app in this directory", + "GOOGLE_APP_ID": "1:267381428578:ios:196e12b81f2bcae22c5c3b", + "FIREBASE_PROJECT_ID": "ramaz-go", + "GCM_SENDER_ID": "267381428578" +} \ No newline at end of file diff --git a/lib/firebase_options.dart b/lib/firebase_options.dart index 6acafb320..87a967b40 100644 --- a/lib/firebase_options.dart +++ b/lib/firebase_options.dart @@ -1,5 +1,5 @@ // File generated by FlutterFire CLI. -// ignore_for_file: lines_longer_than_80_chars +// ignore_for_file: lines_longer_than_80_chars, avoid_classes_with_only_static_members import 'package:firebase_core/firebase_core.dart' show FirebaseOptions; import 'package:flutter/foundation.dart' show defaultTargetPlatform, kIsWeb, TargetPlatform; @@ -19,7 +19,6 @@ class DefaultFirebaseOptions { if (kIsWeb) { return web; } - // ignore: missing_enum_constant_in_switch switch (defaultTargetPlatform) { case TargetPlatform.android: return android; @@ -30,11 +29,21 @@ class DefaultFirebaseOptions { 'DefaultFirebaseOptions have not been configured for macos - ' 'you can reconfigure this by running the FlutterFire CLI again.', ); + case TargetPlatform.windows: + throw UnsupportedError( + 'DefaultFirebaseOptions have not been configured for windows - ' + 'you can reconfigure this by running the FlutterFire CLI again.', + ); + case TargetPlatform.linux: + throw UnsupportedError( + 'DefaultFirebaseOptions have not been configured for linux - ' + 'you can reconfigure this by running the FlutterFire CLI again.', + ); + default: + throw UnsupportedError( + 'DefaultFirebaseOptions are not supported for this platform.', + ); } - - throw UnsupportedError( - 'DefaultFirebaseOptions are not supported for this platform.', - ); } static const FirebaseOptions web = FirebaseOptions( diff --git a/lib/src/pages/schedule.dart b/lib/src/pages/schedule.dart index 3ac22e948..0a33fb481 100644 --- a/lib/src/pages/schedule.dart +++ b/lib/src/pages/schedule.dart @@ -1,6 +1,5 @@ import "package:flutter/material.dart"; - -import "package:link_text/link_text.dart"; +import "package:url_launcher/url_launcher_string.dart"; import "package:ramaz/data.dart"; import "package:ramaz/models.dart"; @@ -232,13 +231,9 @@ class SuggestionWidget extends StatelessWidget { ), const SizedBox(height: 10), if (suggestion.virtualLink != null) - LinkText( - "Link: ${suggestion.virtualLink}", - shouldTrimParams: true, - textStyle: Theme.of(context).textTheme.bodySmall, - linkStyle: Theme.of(context).textTheme.bodySmall?.merge( - const TextStyle(color: Colors.blue), - ), + TextButton( + child: Text(suggestion.virtualLink!), + onPressed: () => launchUrlString(suggestion.virtualLink!), ), ], ), From 77b7b1f71db19825e8fd7c8004192b38feab0ba1 Mon Sep 17 00:00:00 2001 From: Levi Lesches Date: Wed, 25 Oct 2023 02:47:50 -0400 Subject: [PATCH 5/5] Removed LinkText package --- lib/src/data/types.dart | 1 + lib/src/services/auth.dart | 6 +++--- lib/src/widgets/atomic/info_card.dart | 7 +------ lib/src/widgets/generic/class_list.dart | 7 +------ pubspec.lock | 8 -------- pubspec.yaml | 1 - 6 files changed, 6 insertions(+), 24 deletions(-) diff --git a/lib/src/data/types.dart b/lib/src/data/types.dart index 17cfb1c01..8b1b36ba0 100644 --- a/lib/src/data/types.dart +++ b/lib/src/data/types.dart @@ -1 +1,2 @@ +/// An alias for a JSON map. typedef Json = Map; diff --git a/lib/src/services/auth.dart b/lib/src/services/auth.dart index 4ae620056..3a1b3f61d 100644 --- a/lib/src/services/auth.dart +++ b/lib/src/services/auth.dart @@ -65,10 +65,10 @@ class Auth { /// /// Returns null if the user is not an admin (ie, [isAdmin] returns false). static Future?> get adminScopes async { - final Iterable? customClaims = (await claims)?["scopes"]; + final Iterable? customClaims = (await claims)?["scopes"]; return customClaims == null ? null : [ - for (final String scope in customClaims) - scope, + for (final scope in customClaims) + scope as String, ]; } diff --git a/lib/src/widgets/atomic/info_card.dart b/lib/src/widgets/atomic/info_card.dart index 42bf71aaf..4123bbb2d 100644 --- a/lib/src/widgets/atomic/info_card.dart +++ b/lib/src/widgets/atomic/info_card.dart @@ -1,5 +1,4 @@ import "package:flutter/material.dart"; -import "package:link_text/link_text.dart"; /// A tile to represent some info. /// @@ -45,11 +44,7 @@ class InfoCard extends StatelessWidget { ...[ for (final String text in children!) ...[ const SizedBox(height: 2.5), - LinkText( - text, - shouldTrimParams: true, - linkStyle: const TextStyle(color: Color(0xff0000EE)), - ), + Text(text), const SizedBox(height: 2.5), ], ], diff --git a/lib/src/widgets/generic/class_list.dart b/lib/src/widgets/generic/class_list.dart index 85f1f599f..60cad2008 100644 --- a/lib/src/widgets/generic/class_list.dart +++ b/lib/src/widgets/generic/class_list.dart @@ -1,5 +1,4 @@ import "package:flutter/material.dart"; -import "package:link_text/link_text.dart"; import "package:ramaz/data.dart"; import "package:ramaz/models.dart"; @@ -59,11 +58,7 @@ class ClassPanel extends StatelessWidget { for (final String label in children) Padding ( padding: const EdgeInsets.symmetric(vertical: 5), - child: LinkText( - label, - shouldTrimParams: true, - linkStyle: const TextStyle(color: Color(0xff0000EE)), - ), + child: Text(label), ), if (activity != null) ActivityTile(activity!), // already checked for null diff --git a/pubspec.lock b/pubspec.lock index 9b84e8d8c..4e91a193b 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -392,14 +392,6 @@ packages: url: "https://pub.dev" source: hosted version: "0.6.7" - link_text: - dependency: "direct main" - description: - name: link_text - sha256: "5babfe3bcd987bb3f1dde61a47aa55ffd05137634a392385c899651e788d7ebc" - url: "https://pub.dev" - source: hosted - version: "0.2.0" matcher: dependency: "direct dev" description: diff --git a/pubspec.yaml b/pubspec.yaml index 4b14ec658..275e25626 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -33,7 +33,6 @@ dependencies: # flutter_native_timezone: ^2.0.0 url_launcher: ^6.0.3 adaptive_breakpoints: ^0.1.6 - link_text: ^0.2.0 provider: ^6.0.5 meta: ^1.9.1 timezone: ^0.9.2