From ab40a8650d6930a67adf8dd03895d6573dee2c68 Mon Sep 17 00:00:00 2001 From: Tanav Date: Wed, 13 Dec 2023 16:33:18 -0800 Subject: [PATCH 01/18] fixes --- .idea/workspace.xml | 42 +-- android/build.gradle | 2 +- .../gradle/wrapper/gradle-wrapper.properties | 2 +- lib/services/Alert.dart | 2 +- lib/services/database.dart | 50 ++-- lib/ui/tools/ToolAdd.dart | 6 +- lib/ui/tools/ToolCard.dart | 2 +- lib/ui/tools/ToolsPage.dart | 65 ++++- pubspec.lock | 266 ++++++++++++------ pubspec.yaml | 2 +- 10 files changed, 292 insertions(+), 147 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 9266aa2..019d04e 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -5,26 +5,27 @@ - - - - - - - - - - + + + + + + + + + @@ -38,17 +39,16 @@ - - - - - - - - - - - + diff --git a/android/build.gradle b/android/build.gradle index 4273368..19b1a7d 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -27,6 +27,6 @@ subprojects { project.evaluationDependsOn(':app') } -task clean(type: Delete) { +tasks.register("clean", Delete) { delete rootProject.buildDir } diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index 296b146..cfe88f6 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip diff --git a/lib/services/Alert.dart b/lib/services/Alert.dart index 5b5fe5c..8beaf16 100644 --- a/lib/services/Alert.dart +++ b/lib/services/Alert.dart @@ -6,7 +6,7 @@ import 'package:google_fonts/google_fonts.dart'; class Alert extends StatelessWidget { final String alert; - const Alert({Key key, this.alert}) : super(key: key); + const Alert({Key? key, required this.alert}) : super(key: key); static Future showAlert(BuildContext context, String error) async { return showDialog( diff --git a/lib/services/database.dart b/lib/services/database.dart index 136fb8a..9b02da9 100644 --- a/lib/services/database.dart +++ b/lib/services/database.dart @@ -587,13 +587,13 @@ class Database { for (var tool in list) { if (category_map.containsKey(tool.category)) { - category_map[tool.category as String].insert(0, tool); + category_map[tool.category as String]!.insert(0, tool); } else { category_map[tool.category as String] = [tool]; } } - print(category_map['Drill'][0].reservations); + print(category_map['Drill']![0].reservations); return category_map; } @@ -633,13 +633,13 @@ class Database { for (var tool in list) { if (category_map.containsKey(tool.category)) { - category_map[tool.category as String].insert(0, tool); + category_map[tool.category as String]!.insert(0, tool); } else { category_map[tool.category as String] = [tool]; } } - print(category_map['Drill'][0].reservations); + print(category_map['Drill']![0].reservations); return LinkedHashMap.fromEntries(category_map.entries.toList().reversed); } @@ -697,16 +697,16 @@ class Part { final String status; Part( - {@required this.id, - @required this.uid, - @required this.name, - @required this.link, - @required this.trackingId, - @required this.carrier, - @required this.description, - @required this.priority, - @required this.displayName, - @required this.status}); + {required this.id, + required this.uid, + required this.name, + required this.link, + required this.trackingId, + required this.carrier, + required this.description, + required this.priority, + required this.displayName, + required this.status}); factory Part.fromJson(Map json) { String status = json['status']; @@ -741,12 +741,12 @@ class Tool { final String status; Tool({ - @required this.id, - @required this.name, - @required this.category, - @required this.user, - @required this.reservations, - @required this.status, + required this.id, + required this.name, + required this.category, + required this.user, + required this.reservations, + required this.status, }); factory Tool.fromJson(Map json) { @@ -770,10 +770,10 @@ class User { final String displayName; final bool certified; User( - {@required this.uid, - @required this.email, - @required this.displayName, - @required this.certified}); + {required this.uid, + required this.email, + required this.displayName, + required this.certified}); factory User.fromJson(Map json) { return User( @@ -789,7 +789,7 @@ class User { } class LastCheckInTime { - int _value; + late int _value; LastCheckInTime(int value) { _value = value; diff --git a/lib/ui/tools/ToolAdd.dart b/lib/ui/tools/ToolAdd.dart index 80e4c8d..1f5aa3b 100644 --- a/lib/ui/tools/ToolAdd.dart +++ b/lib/ui/tools/ToolAdd.dart @@ -11,7 +11,7 @@ import 'package:OptixToolkit/services/NavigationService.dart'; import 'package:OptixToolkit/services/database.dart'; class ToolAdd extends StatefulWidget { - ToolAdd({Key key}) : super(key: key); + ToolAdd({required Key key}) : super(key: key); @override _ToolAddState createState() => _ToolAddState(); @@ -80,7 +80,7 @@ class _ToolAddState extends State { margin: EdgeInsets.only(top: 20), child: TextFormField( validator: (value) { - if (value.isEmpty) { + if (value!.isEmpty) { return 'Enter Part Name'; } return null; @@ -164,7 +164,7 @@ class _ToolAddState extends State { borderRadius: BorderRadius.circular(7.0)), child: ElevatedButton( onPressed: () async { - if (_formKey.currentState.validate()) { + if (_formKey.currentState!.validate()) { print("Handling on pressed"); var result = await Database.addTool( Provider.of(context, diff --git a/lib/ui/tools/ToolCard.dart b/lib/ui/tools/ToolCard.dart index bcf5d97..50b06fc 100644 --- a/lib/ui/tools/ToolCard.dart +++ b/lib/ui/tools/ToolCard.dart @@ -12,7 +12,7 @@ class ToolCard extends StatelessWidget { final List tools; final String category; final RefreshFunction refreshTools; - const ToolCard({Key key, this.tools, this.category, this.refreshTools}) + const ToolCard({required Key key, required this.tools, required this.category, required this.refreshTools}) : super(key: key); @override diff --git a/lib/ui/tools/ToolsPage.dart b/lib/ui/tools/ToolsPage.dart index cd2b344..ed6d9e8 100644 --- a/lib/ui/tools/ToolsPage.dart +++ b/lib/ui/tools/ToolsPage.dart @@ -56,10 +56,10 @@ class _toolState extends State with RouteAware { this.idToken = idToken; } - void _showDialog(BuildContext context) { + void _showDialog(BuildContext context) { //dialog is the modal // flutter defined function showDialog( - context: context, + context: context, //tells flutter the context, or where we are in the app builder: (BuildContext context) { // return object of type Dialog return AlertDialog( @@ -282,3 +282,64 @@ class _toolState extends State with RouteAware { ); } } + +// ButtonTheme( //This is for barcode scanner new +// minWidth: MediaQuery.of(context).size.width * 0.43, +// height: 55, +// shape: RoundedRectangleBorder( +// borderRadius: +// BorderRadius.circular(7.0)), +// child: ElevatedButton( +// onPressed: () { +// returnScan().catchError(() { +// _showDialog(context); +// }); +// refreshTools(); +// }, +// child: Text( +// 'RETURN', +// style: GoogleFonts.rubik( +// fontWeight: FontWeight.bold, +// fontSize: 20.0, +// color: Colors.white, +// ), +// ), +// style: ElevatedButton.styleFrom(backgroundColor: Color(0xff159deb)), +// ), +// ) + +// Container( +// margin: EdgeInsets.only(left: 12, top: 50, right: 12, bottom: 0), +// width: 400, +// height: MediaQuery.of(context).size.height * 0.63, +// decoration: BoxDecoration( +// borderRadius: BorderRadius.circular(10.0), +// color: Color(0xff3a3d41), +// ), +// child: Padding( +// padding: EdgeInsets.all(15.0), +// child: Column( +// children: [ +// Row( +// mainAxisAlignment: MainAxisAlignment.center, +// crossAxisAlignment: CrossAxisAlignment.center, +// children: [ +// RichText( +// text: TextSpan( +// children: [ +// TextSpan( +// text: 'Checkout ', +// style: GoogleFonts.rubik( +// color: Colors.white, +// fontSize: 25.0, +// ) +// ) +// ] +// ) +// ) +// ] +// ) +// ] +// ) +// ) +// ) \ No newline at end of file diff --git a/pubspec.lock b/pubspec.lock index b20af34..859f164 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,189 +5,216 @@ packages: dependency: transitive description: name: _flutterfire_internals - url: "https://pub.dartlang.org" + sha256: d58dc7eda77a05866ad4fac26a4953e82bac29167aa571224d499da5d2027bc6 + url: "https://pub.dev" source: hosted version: "1.0.11" args: dependency: transitive description: name: args - url: "https://pub.dartlang.org" + sha256: b003c3098049a51720352d219b0bb5f219b60fbfb68e7a4748139a06a5676515 + url: "https://pub.dev" source: hosted version: "2.3.1" async: dependency: transitive description: name: async - url: "https://pub.dartlang.org" + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" source: hosted - version: "2.9.0" + version: "2.11.0" barcode_scan2: dependency: "direct main" description: name: barcode_scan2 - url: "https://pub.dartlang.org" + sha256: "463b6690b8d1c175bccb5ed36cc48f2734749c50e01fd859b92127f9b6b62812" + url: "https://pub.dev" source: hosted version: "4.2.1" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.dartlang.org" + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" characters: dependency: transitive description: name: characters - url: "https://pub.dartlang.org" + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + url: "https://pub.dev" source: hosted - version: "1.2.1" + version: "1.3.0" clock: dependency: transitive description: name: clock - url: "https://pub.dartlang.org" + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" source: hosted version: "1.1.1" cloud_firestore: dependency: "direct main" description: name: cloud_firestore - url: "https://pub.dartlang.org" + sha256: c8c422a8c191b9689a0a392db9987824b47f54c93e3ccaea32962d0b6be96a26 + url: "https://pub.dev" source: hosted version: "4.3.0" cloud_firestore_platform_interface: dependency: transitive description: name: cloud_firestore_platform_interface - url: "https://pub.dartlang.org" + sha256: "86a21d4fd3afe89268e72f62691547e440eff3bcb2781d77c428df706e958149" + url: "https://pub.dev" source: hosted version: "5.10.0" cloud_firestore_web: dependency: transitive description: name: cloud_firestore_web - url: "https://pub.dartlang.org" + sha256: "2d7339bf3f79adcdb123a88e908474478b060317332189bdd5dcb2d498952127" + url: "https://pub.dev" source: hosted version: "3.2.0" collection: dependency: transitive description: name: collection - url: "https://pub.dartlang.org" + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + url: "https://pub.dev" source: hosted - version: "1.16.0" + version: "1.18.0" cross_file: dependency: transitive description: name: cross_file - url: "https://pub.dartlang.org" + sha256: f71079978789bc2fe78d79227f1f8cfe195b31bbd8db2399b0d15a4b96fb843b + url: "https://pub.dev" source: hosted version: "0.3.3+2" crypto: dependency: transitive description: name: crypto - url: "https://pub.dartlang.org" + sha256: aa274aa7774f8964e4f4f38cc994db7b6158dd36e9187aaceaddc994b35c6c67 + url: "https://pub.dev" source: hosted version: "3.0.2" cupertino_icons: dependency: "direct main" description: name: cupertino_icons - url: "https://pub.dartlang.org" + sha256: e35129dc44c9118cee2a5603506d823bab99c68393879edb440e0090d07586be + url: "https://pub.dev" source: hosted version: "1.0.5" fake_async: dependency: transitive description: name: fake_async - url: "https://pub.dartlang.org" + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" source: hosted version: "1.3.1" ffi: dependency: transitive description: name: ffi - url: "https://pub.dartlang.org" + sha256: a38574032c5f1dd06c4aee541789906c12ccaab8ba01446e800d9c5b79c4a978 + url: "https://pub.dev" source: hosted version: "2.0.1" file: dependency: transitive description: name: file - url: "https://pub.dartlang.org" + sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" + url: "https://pub.dev" source: hosted version: "6.1.4" firebase_auth: dependency: "direct main" description: name: firebase_auth - url: "https://pub.dartlang.org" + sha256: e946a21254784116d32e497e09b851b4d03a3c65880e80d6939a720dfce88aed + url: "https://pub.dev" source: hosted version: "4.2.2" firebase_auth_platform_interface: dependency: transitive description: name: firebase_auth_platform_interface - url: "https://pub.dartlang.org" + sha256: bb06708fe31bb5928157e3fe8d4bc5ccfaca9477fb902e6a772288eea609d28d + url: "https://pub.dev" source: hosted version: "6.11.6" firebase_auth_web: dependency: transitive description: name: firebase_auth_web - url: "https://pub.dartlang.org" + sha256: bf8f3093c141abd0a624e0244864154d9db694682ba0cc1fcfdf60ecb6f7f2e3 + url: "https://pub.dev" source: hosted version: "5.2.2" firebase_core: dependency: transitive description: name: firebase_core - url: "https://pub.dartlang.org" + sha256: "01962872df08437d9be593caeab8c700624c93b629f3d3d60f061612d6263666" + url: "https://pub.dev" source: hosted version: "2.4.0" firebase_core_platform_interface: dependency: transitive description: name: firebase_core_platform_interface - url: "https://pub.dartlang.org" + sha256: "5fab93f5b354648efa62e7cc829c90efb68c8796eecf87e0888cae2d5f3accd4" + url: "https://pub.dev" source: hosted version: "4.5.2" firebase_core_web: dependency: transitive description: name: firebase_core_web - url: "https://pub.dartlang.org" + sha256: b2917618cbe75196261621d676a992e05215ce6a70daca5f655794d5a008d369 + url: "https://pub.dev" source: hosted version: "2.0.2" firebase_storage: dependency: "direct main" description: name: firebase_storage - url: "https://pub.dartlang.org" + sha256: "0b46edb072be06b96b693480bdfd8204ea0a782fa9267fa6d67878b032b35bd5" + url: "https://pub.dev" source: hosted version: "11.0.9" firebase_storage_platform_interface: dependency: transitive description: name: firebase_storage_platform_interface - url: "https://pub.dartlang.org" + sha256: e3770f5f38eed5faee4248c2e5cb7311cb07afe2c35e73225b7cceb09b8805bc + url: "https://pub.dev" source: hosted version: "4.1.25" firebase_storage_web: dependency: transitive description: name: firebase_storage_web - url: "https://pub.dartlang.org" + sha256: "18a29aa3b652b26aa54584f8bb3aa4806cfd697d876cd898c0135c475d7d42a0" + url: "https://pub.dev" source: hosted version: "3.3.18" fixnum: dependency: transitive description: name: fixnum - url: "https://pub.dartlang.org" + sha256: "04be3e934c52e082558cc9ee21f42f5c1cd7a1262f4c63cd0357c08d5bba81ec" + url: "https://pub.dev" source: hosted version: "1.0.1" flutter: @@ -199,7 +226,8 @@ packages: dependency: transitive description: name: flutter_plugin_android_lifecycle - url: "https://pub.dartlang.org" + sha256: "60fc7b78455b94e6de2333d2f95196d32cf5c22f4b0b0520a628804cb463503b" + url: "https://pub.dev" source: hosted version: "2.0.7" flutter_test: @@ -216,252 +244,288 @@ packages: dependency: "direct main" description: name: google_fonts - url: "https://pub.dartlang.org" + sha256: "8f099045e2f2a30e4d4d0a35f40c6bc941a8f2ca0e10ad9d214ee9edd3f37483" + url: "https://pub.dev" source: hosted version: "3.0.1" http: dependency: "direct main" description: name: http - url: "https://pub.dartlang.org" + sha256: "6aa2946395183537c8b880962d935877325d6a09a2867c3970c05c0fed6ac482" + url: "https://pub.dev" source: hosted version: "0.13.5" http_parser: dependency: transitive description: name: http_parser - url: "https://pub.dartlang.org" + sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" + url: "https://pub.dev" source: hosted version: "4.0.2" image_picker: dependency: "direct main" description: name: image_picker - url: "https://pub.dartlang.org" + sha256: a8f2f0aed50c03230ab37e93ca2905c50b6c4097245345956eb24a88f45328cd + url: "https://pub.dev" source: hosted version: "0.8.6" image_picker_android: dependency: transitive description: name: image_picker_android - url: "https://pub.dartlang.org" + sha256: b22718074bcecfd0d5008e5fe1ab89db157e125c015b0776ab57ce2160167b82 + url: "https://pub.dev" source: hosted version: "0.8.5+4" image_picker_for_web: dependency: transitive description: name: image_picker_for_web - url: "https://pub.dartlang.org" + sha256: "7d319fb74955ca46d9bf7011497860e3923bb67feebcf068f489311065863899" + url: "https://pub.dev" source: hosted version: "2.1.10" image_picker_ios: dependency: transitive description: name: image_picker_ios - url: "https://pub.dartlang.org" + sha256: "2c59612273411ecb0beccb11e49db7272975c882f5866c7948017cb6acb3557e" + url: "https://pub.dev" source: hosted version: "0.8.6+3" image_picker_platform_interface: dependency: transitive description: name: image_picker_platform_interface - url: "https://pub.dartlang.org" + sha256: "7cef2f28f4f2fef99180f636c3d446b4ccbafd6ba0fad2adc9a80c4040f656b8" + url: "https://pub.dev" source: hosted version: "2.6.2" import_sorter: dependency: "direct dev" description: name: import_sorter - url: "https://pub.dartlang.org" + sha256: eb15738ccead84e62c31e0208ea4e3104415efcd4972b86906ca64a1187d0836 + url: "https://pub.dev" source: hosted version: "4.6.0" intl: dependency: transitive description: name: intl - url: "https://pub.dartlang.org" + sha256: a3715e3bc90294e971cb7dc063fbf3cd9ee0ebf8604ffeafabd9e6f16abbdbe6 + url: "https://pub.dev" source: hosted version: "0.18.0" js: dependency: transitive description: name: js - url: "https://pub.dartlang.org" + sha256: a5e201311cb08bf3912ebbe9a2be096e182d703f881136ec1e81a2338a9e120d + url: "https://pub.dev" source: hosted version: "0.6.4" loading_animations: dependency: "direct main" description: name: loading_animations - url: "https://pub.dartlang.org" + sha256: c62a8c1fbbe5ade3ac2814128a9aa92ee784756b11ad9e6a915b673b90005cc8 + url: "https://pub.dev" source: hosted version: "2.2.0" matcher: dependency: transitive description: name: matcher - url: "https://pub.dartlang.org" + sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + url: "https://pub.dev" source: hosted - version: "0.12.12" + version: "0.12.16" material_color_utilities: dependency: transitive description: name: material_color_utilities - url: "https://pub.dartlang.org" + sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" + url: "https://pub.dev" source: hosted - version: "0.1.5" + version: "0.5.0" meta: dependency: transitive description: name: meta - url: "https://pub.dartlang.org" + sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e + url: "https://pub.dev" source: hosted - version: "1.8.0" + version: "1.10.0" nested: dependency: transitive description: name: nested - url: "https://pub.dartlang.org" + sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20" + url: "https://pub.dev" source: hosted version: "1.0.0" path: dependency: transitive description: name: path - url: "https://pub.dartlang.org" + sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + url: "https://pub.dev" source: hosted - version: "1.8.2" + version: "1.8.3" path_provider: dependency: transitive description: name: path_provider - url: "https://pub.dartlang.org" + sha256: "050e8e85e4b7fecdf2bb3682c1c64c4887a183720c802d323de8a5fd76d372dd" + url: "https://pub.dev" source: hosted version: "2.0.11" path_provider_android: dependency: transitive description: name: path_provider_android - url: "https://pub.dartlang.org" + sha256: a776c088d671b27f6e3aa8881d64b87b3e80201c64e8869b811325de7a76c15e + url: "https://pub.dev" source: hosted version: "2.0.22" path_provider_ios: dependency: transitive description: name: path_provider_ios - url: "https://pub.dartlang.org" + sha256: "03d639406f5343478352433f00d3c4394d52dac8df3d847869c5e2333e0bbce8" + url: "https://pub.dev" source: hosted version: "2.0.11" path_provider_linux: dependency: transitive description: name: path_provider_linux - url: "https://pub.dartlang.org" + sha256: ab0987bf95bc591da42dffb38c77398fc43309f0b9b894dcc5d6f40c4b26c379 + url: "https://pub.dev" source: hosted version: "2.1.7" path_provider_macos: dependency: transitive description: name: path_provider_macos - url: "https://pub.dartlang.org" + sha256: "2a97e7fbb7ae9dcd0dfc1220a78e9ec3e71da691912e617e8715ff2a13086ae8" + url: "https://pub.dev" source: hosted version: "2.0.6" path_provider_platform_interface: dependency: transitive description: name: path_provider_platform_interface - url: "https://pub.dartlang.org" + sha256: f0abc8ebd7253741f05488b4813d936b4d07c6bae3e86148a09e342ee4b08e76 + url: "https://pub.dev" source: hosted version: "2.0.5" path_provider_windows: dependency: transitive description: name: path_provider_windows - url: "https://pub.dartlang.org" + sha256: bcabbe399d4042b8ee687e17548d5d3f527255253b4a639f5f8d2094a9c2b45c + url: "https://pub.dev" source: hosted version: "2.1.3" percent_indicator: dependency: "direct main" description: name: percent_indicator - url: "https://pub.dartlang.org" + sha256: cec41f67181fbd5322aa68b355621d1a4eea827426b8eeb613f6cbe195ff7b4a + url: "https://pub.dev" source: hosted version: "4.2.2" permission_handler: dependency: "direct main" description: name: permission_handler - url: "https://pub.dartlang.org" + sha256: "33c6a1253d1f95fd06fa74b65b7ba907ae9811f9d5c1d3150e51417d04b8d6a8" + url: "https://pub.dev" source: hosted version: "10.2.0" permission_handler_android: dependency: transitive description: name: permission_handler_android - url: "https://pub.dartlang.org" + sha256: "8028362b40c4a45298f1cbfccd227c8dd6caf0e27088a69f2ba2ab15464159e2" + url: "https://pub.dev" source: hosted version: "10.2.0" permission_handler_apple: dependency: transitive description: name: permission_handler_apple - url: "https://pub.dartlang.org" + sha256: "9c370ef6a18b1c4b2f7f35944d644a56aa23576f23abee654cf73968de93f163" + url: "https://pub.dev" source: hosted version: "9.0.7" permission_handler_platform_interface: dependency: transitive description: name: permission_handler_platform_interface - url: "https://pub.dartlang.org" + sha256: "68abbc472002b5e6dfce47fe9898c6b7d8328d58b5d2524f75e277c07a97eb84" + url: "https://pub.dev" source: hosted version: "3.9.0" permission_handler_windows: dependency: transitive description: name: permission_handler_windows - url: "https://pub.dartlang.org" + sha256: f67cab14b4328574938ecea2db3475dad7af7ead6afab6338772c5f88963e38b + url: "https://pub.dev" source: hosted version: "0.1.2" platform: dependency: transitive description: name: platform - url: "https://pub.dartlang.org" + sha256: "4a451831508d7d6ca779f7ac6e212b4023dd5a7d08a27a63da33756410e32b76" + url: "https://pub.dev" source: hosted version: "3.1.0" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface - url: "https://pub.dartlang.org" + sha256: dbf0f707c78beedc9200146ad3cb0ab4d5da13c246336987be6940f026500d3a + url: "https://pub.dev" source: hosted version: "2.1.3" process: dependency: transitive description: name: process - url: "https://pub.dartlang.org" + sha256: "53fd8db9cec1d37b0574e12f07520d582019cb6c44abf5479a01505099a34a09" + url: "https://pub.dev" source: hosted version: "4.2.4" protobuf: dependency: transitive description: name: protobuf - url: "https://pub.dartlang.org" + sha256: "01dd9bd0fa02548bf2ceee13545d4a0ec6046459d847b6b061d8a27237108a08" + url: "https://pub.dev" source: hosted version: "2.1.0" provider: dependency: "direct main" description: name: provider - url: "https://pub.dartlang.org" + sha256: cdbe7530b12ecd9eb455bdaa2fcb8d4dad22e80b8afb4798b41479d5ce26847f + url: "https://pub.dev" source: hosted version: "6.0.5" rxdart: dependency: "direct main" description: name: rxdart - url: "https://pub.dartlang.org" + sha256: "0c7c0cedd93788d996e33041ffecda924cc54389199cde4e6a34b440f50044cb" + url: "https://pub.dev" source: hosted version: "0.27.7" sky_engine: @@ -473,86 +537,106 @@ packages: dependency: transitive description: name: source_span - url: "https://pub.dartlang.org" + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.dev" source: hosted - version: "1.9.0" + version: "1.10.0" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.dartlang.org" + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.11.1" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.dartlang.org" + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.2" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.dartlang.org" + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "1.2.0" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.dartlang.org" + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" source: hosted version: "1.2.1" test_api: dependency: transitive description: name: test_api - url: "https://pub.dartlang.org" + sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" + url: "https://pub.dev" source: hosted - version: "0.4.12" + version: "0.6.1" tint: dependency: transitive description: name: tint - url: "https://pub.dartlang.org" + sha256: d856019547532d4ea24171f554b319081c004c37741e7946eae30cb09f24e1c7 + url: "https://pub.dev" source: hosted version: "2.0.0" typed_data: dependency: transitive description: name: typed_data - url: "https://pub.dartlang.org" + sha256: "26f87ade979c47a150c9eaab93ccd2bebe70a27dc0b4b29517f2904f04eb11a5" + url: "https://pub.dev" source: hosted version: "1.3.1" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.dartlang.org" + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.4" + web: + dependency: transitive + description: + name: web + sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152 + url: "https://pub.dev" + source: hosted + version: "0.3.0" win32: dependency: transitive description: name: win32 - url: "https://pub.dartlang.org" + sha256: c9ebe7ee4ab0c2194e65d3a07d8c54c5d00bb001b76081c4a04cdb8448b59e46 + url: "https://pub.dev" source: hosted version: "3.1.3" xdg_directories: dependency: transitive description: name: xdg_directories - url: "https://pub.dartlang.org" + sha256: "11541eedefbcaec9de35aa82650b695297ce668662bbd6e3911a7fabdbde589f" + url: "https://pub.dev" source: hosted version: "0.2.0+2" yaml: dependency: transitive description: name: yaml - url: "https://pub.dartlang.org" + sha256: "23812a9b125b48d4007117254bca50abb6c712352927eece9e155207b1db2370" + url: "https://pub.dev" source: hosted version: "3.1.1" sdks: - dart: ">=2.17.0 <3.0.0" + dart: ">=3.2.0-194.0.dev <4.0.0" flutter: ">=3.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index c8acff5..c66211f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -8,7 +8,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev version: 2.0.0 environment: - sdk: ">=2.7.0 <3.0.0" + sdk: ">=2.12.0 <3.0.0" dependencies: flutter: From 3e394e777c24294d57ccf730f0c58c6be899fc91 Mon Sep 17 00:00:00 2001 From: Tanav Date: Wed, 13 Dec 2023 21:24:32 -0800 Subject: [PATCH 02/18] few fixes --- lib/services/Good.dart | 2 +- lib/services/GoodPop.dart | 2 +- lib/services/NavigationService.dart | 8 ++++---- lib/ui/HoursPage.dart | 4 ++-- lib/ui/ProfilePage.dart | 2 +- lib/ui/UserList.dart | 18 +++++++++--------- lib/ui/UserModal.dart | 2 +- lib/ui/tools/ToolReserve.dart | 2 +- lib/ui/tools/ToolsPage.dart | 4 ++-- 9 files changed, 22 insertions(+), 22 deletions(-) diff --git a/lib/services/Good.dart b/lib/services/Good.dart index c01d221..020e3f9 100644 --- a/lib/services/Good.dart +++ b/lib/services/Good.dart @@ -6,7 +6,7 @@ import 'package:google_fonts/google_fonts.dart'; class Good extends StatelessWidget { final String good; - const Good({Key key, this.good}) : super(key: key); + const Good({required Key key, this.good}) : super(key: key); static Future showGood(BuildContext context, String good) async { return showDialog( diff --git a/lib/services/GoodPop.dart b/lib/services/GoodPop.dart index 205cf7f..b26542e 100644 --- a/lib/services/GoodPop.dart +++ b/lib/services/GoodPop.dart @@ -6,7 +6,7 @@ import 'package:google_fonts/google_fonts.dart'; class GoodPop extends StatelessWidget { final String good; - const GoodPop({Key key, this.good}) : super(key: key); + const GoodPop({required Key key, this.good}) : super(key: key); static Future showGood(BuildContext context, String good) async { return showDialog( diff --git a/lib/services/NavigationService.dart b/lib/services/NavigationService.dart index dfd1250..5a71d64 100644 --- a/lib/services/NavigationService.dart +++ b/lib/services/NavigationService.dart @@ -5,18 +5,18 @@ class NavigationService { static final GlobalKey navigatorKey = new GlobalKey(); static Future navigateTo(Route route) { - return navigatorKey.currentState.pushReplacement(route); + return navigatorKey.currentState!.pushReplacement(route); } static Future goTo(Route route) { - return navigatorKey.currentState.push(route); + return navigatorKey.currentState!.push(route); } static Future goToAndThen(Route route, Function f) { - return navigatorKey.currentState.push(route).then(f); + return navigatorKey.currentState!.push(route).then(f); } static void pop() { - return navigatorKey.currentState.pop(); + return navigatorKey.currentState!.pop(); } } diff --git a/lib/ui/HoursPage.dart b/lib/ui/HoursPage.dart index fb49d48..c7806dc 100644 --- a/lib/ui/HoursPage.dart +++ b/lib/ui/HoursPage.dart @@ -8,7 +8,7 @@ import 'package:OptixToolkit/services/database.dart'; import 'package:provider/provider.dart'; class hoursPage extends StatelessWidget { - const hoursPage({Key key}) : super(key: key); + const hoursPage({required Key key}) : super(key: key); @override Widget build(BuildContext context) { @@ -27,7 +27,7 @@ class hoursPage extends StatelessWidget { } class hoursPageLoaded extends StatefulWidget { - const hoursPageLoaded({Key key}) : super(key: key); + const hoursPageLoaded({required Key key}) : super(key: key); @override _hoursPageState createState() => _hoursPageState(); diff --git a/lib/ui/ProfilePage.dart b/lib/ui/ProfilePage.dart index 3f1722c..d22c5c5 100644 --- a/lib/ui/ProfilePage.dart +++ b/lib/ui/ProfilePage.dart @@ -12,7 +12,7 @@ import 'package:provider/provider.dart'; import 'package:OptixToolkit/services/firebase.dart'; class profilePage extends StatelessWidget { - const profilePage({Key key}) : super(key: key); + const profilePage({required Key key}) : super(key: key); @override Widget build(BuildContext context) { diff --git a/lib/ui/UserList.dart b/lib/ui/UserList.dart index 8e58894..a258b62 100644 --- a/lib/ui/UserList.dart +++ b/lib/ui/UserList.dart @@ -14,7 +14,7 @@ import 'Loading.dart'; import 'UserCard.dart'; class UserList extends StatefulWidget { - UserList({Key key}) : super(key: key); + UserList({required Key key}) : super(key: key); @override _UserListState createState() => _UserListState(); @@ -32,8 +32,8 @@ class _UserListState extends State { final _formKey = GlobalKey(); - List users = null; - String err = null; + List? users = null; + String? err = null; bool called = false; Future _showToolService(BuildContext context) async { @@ -78,7 +78,7 @@ class _UserListState extends State { margin: EdgeInsets.only(top: 20), child: TextFormField( validator: (value) { - if (value.isEmpty) { + if (value!.isEmpty) { return 'Enter User Name'; } return null; @@ -101,7 +101,7 @@ class _UserListState extends State { margin: EdgeInsets.only(top: 20, bottom: 20), child: TextFormField( validator: (value) { - if (value.isEmpty) { + if (value!.isEmpty) { return 'Enter User Email Address'; } return null; @@ -129,9 +129,9 @@ class _UserListState extends State { checkColor: Colors.white, selected: _checked, value: _checked, - onChanged: (bool value) { + onChanged: (bool? value) { setState(() { - _checked = value; + _checked = value ?? false; }); }, ), @@ -152,7 +152,7 @@ class _UserListState extends State { BorderRadius.circular(7.0)), child: ElevatedButton( onPressed: () async { - if (_formKey.currentState.validate()) { + if (_formKey.currentState!.validate()) { print("Handling on pressed"); var result = await Database.addUser( Provider.of( @@ -283,7 +283,7 @@ class _UserListState extends State { Expanded( child: RefreshIndicator( onRefresh: () async {}, - child: ListView(children: users), + child: ListView(children: users??[]), ), ), ], diff --git a/lib/ui/UserModal.dart b/lib/ui/UserModal.dart index 4b13595..a1405e2 100644 --- a/lib/ui/UserModal.dart +++ b/lib/ui/UserModal.dart @@ -9,7 +9,7 @@ import 'package:google_fonts/google_fonts.dart'; class UserModal extends StatelessWidget { final User user; - const UserModal({Key key, this.user}) : super(key: key); + const UserModal({required Key key, this.user}) : super(key: key); @override Widget build(BuildContext context) { diff --git a/lib/ui/tools/ToolReserve.dart b/lib/ui/tools/ToolReserve.dart index f9e36de..5185a2c 100644 --- a/lib/ui/tools/ToolReserve.dart +++ b/lib/ui/tools/ToolReserve.dart @@ -18,7 +18,7 @@ class ToolReserve extends StatelessWidget { final List tools; final String category; - ToolReserve({Key key, this.tools, this.category}) : super(key: key); + ToolReserve({required Key key, this.tools, this.category}) : super(key: key); final Color background = Color(0xff26292c); final Color gray = Color(0xff3A3D41); diff --git a/lib/ui/tools/ToolsPage.dart b/lib/ui/tools/ToolsPage.dart index ed6d9e8..ca3b922 100644 --- a/lib/ui/tools/ToolsPage.dart +++ b/lib/ui/tools/ToolsPage.dart @@ -12,7 +12,7 @@ import 'package:barcode_scan2/barcode_scan2.dart'; import 'package:google_fonts/google_fonts.dart'; class toolsPage extends StatelessWidget { - const toolsPage({Key key, this.uid}) : super(key: key); + const toolsPage({required Key key, this.uid}) : super(key: key); final String uid; @override @@ -41,7 +41,7 @@ class ToolWidget extends StatefulWidget { Map> tools; final firebase.IdTokenResult idToken; - ToolWidget({Key key, this.tools, this.idToken}) : super(key: key); + ToolWidget({required Key key, this.tools, this.idToken}) : super(key: key); @override _toolState createState() => _toolState(this.tools, this.idToken); From 72dc1bcbfdbece6c8bb71ad22075e4570c031351 Mon Sep 17 00:00:00 2001 From: Tanav Date: Thu, 14 Dec 2023 08:49:57 -0800 Subject: [PATCH 03/18] more fixes --- lib/ui/Home.dart | 8 ++++---- lib/ui/HoursPage.dart | 10 +++++----- lib/ui/tools/ToolCard.dart | 2 +- lib/ui/tools/ToolLine.dart | 2 +- lib/ui/tools/ToolReserve.dart | 2 +- lib/ui/tools/ToolReserveItem.dart | 2 +- lib/ui/tools/ToolsPage.dart | 8 ++++---- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/lib/ui/Home.dart b/lib/ui/Home.dart index cec4258..c170417 100644 --- a/lib/ui/Home.dart +++ b/lib/ui/Home.dart @@ -17,7 +17,7 @@ import 'package:OptixToolkit/services/firebase.dart'; import 'package:OptixToolkit/ui/parts/PartReimburse.dart'; class MyStatefulWidget extends StatefulWidget { - MyStatefulWidget({Key key}) : super(key: key); + MyStatefulWidget({required Key key}) : super(key: key); @override _MyStatefulWidgetState createState() => _MyStatefulWidgetState(); @@ -57,10 +57,10 @@ class _MyStatefulWidgetState extends State { Widget build(BuildContext context) { List _widgetOptions = [ homePage(changePage: changePage), - hoursPage(), - toolsPage(), + hoursPage(key: null,), + toolsPage(key: null, uid: '',), PartReimburse(), - profilePage(), + profilePage(key: null,), Container( child: Column( children: [ diff --git a/lib/ui/HoursPage.dart b/lib/ui/HoursPage.dart index c7806dc..3caf1c0 100644 --- a/lib/ui/HoursPage.dart +++ b/lib/ui/HoursPage.dart @@ -15,14 +15,14 @@ class hoursPage extends StatelessWidget { return MultiProvider(providers: [ FutureProvider.value( value: - Database.getTime(Provider.of(context), context)), + Database.getTime(Provider.of(context), context), initialData: 0,), FutureProvider.value( value: Database.getLastCheckIn( - Provider.of(context), context)), + Provider.of(context), context), initialData: null,), FutureProvider.value( value: Database.getMeetingCount( - Provider.of(context), context)) - ], child: hoursPageLoaded()); + Provider.of(context), context), initialData: null,) + ], child: hoursPageLoaded(key: null,)); } } @@ -34,7 +34,7 @@ class hoursPageLoaded extends StatefulWidget { } class _hoursPageState extends State { - int time, lastCheckIn, meetingCount; + late int time, lastCheckIn, meetingCount; @override void initState() { diff --git a/lib/ui/tools/ToolCard.dart b/lib/ui/tools/ToolCard.dart index 50b06fc..3d2b738 100644 --- a/lib/ui/tools/ToolCard.dart +++ b/lib/ui/tools/ToolCard.dart @@ -28,7 +28,7 @@ class ToolCard extends StatelessWidget { NavigationService.goToAndThen( PageRouteBuilder( pageBuilder: (context, animation1, animation2) => - ToolReserve(category: category, tools: tools), + ToolReserve(category: category, tools: tools, key: null,), ), (value) { refreshTools(); }); diff --git a/lib/ui/tools/ToolLine.dart b/lib/ui/tools/ToolLine.dart index 36db633..b0da2c7 100644 --- a/lib/ui/tools/ToolLine.dart +++ b/lib/ui/tools/ToolLine.dart @@ -5,7 +5,7 @@ import 'package:OptixToolkit/services/database.dart'; class ToolLine extends StatelessWidget { final Tool tool; final String status; - const ToolLine({Key key, this.tool, this.status}) : super(key: key); + const ToolLine({required Key key, required this.tool, required this.status}) : super(key: key); @override Widget build(BuildContext context) { diff --git a/lib/ui/tools/ToolReserve.dart b/lib/ui/tools/ToolReserve.dart index 5185a2c..0d4063f 100644 --- a/lib/ui/tools/ToolReserve.dart +++ b/lib/ui/tools/ToolReserve.dart @@ -93,7 +93,7 @@ class ToolReserve extends StatelessWidget { NavigationService.goTo( PageRouteBuilder( pageBuilder: (context, animation1, animation2) => - ToolAdd(), + ToolAdd(key: null,), ), ); }, diff --git a/lib/ui/tools/ToolReserveItem.dart b/lib/ui/tools/ToolReserveItem.dart index 02b6935..773bdbc 100644 --- a/lib/ui/tools/ToolReserveItem.dart +++ b/lib/ui/tools/ToolReserveItem.dart @@ -7,7 +7,7 @@ import 'package:firebase_auth/firebase_auth.dart' as firebase; class ToolReserveItem extends StatelessWidget { final Tool tool; - const ToolReserveItem({Key key, this.tool}) : super(key: key); + const ToolReserveItem({required Key key, required this.tool}) : super(key: key); Future _showToolService(BuildContext context) async { Widget doneButton = TextButton( diff --git a/lib/ui/tools/ToolsPage.dart b/lib/ui/tools/ToolsPage.dart index ca3b922..3a1061b 100644 --- a/lib/ui/tools/ToolsPage.dart +++ b/lib/ui/tools/ToolsPage.dart @@ -12,7 +12,7 @@ import 'package:barcode_scan2/barcode_scan2.dart'; import 'package:google_fonts/google_fonts.dart'; class toolsPage extends StatelessWidget { - const toolsPage({required Key key, this.uid}) : super(key: key); + const toolsPage({required Key key, required this.uid}) : super(key: key); final String uid; @override @@ -29,7 +29,7 @@ class toolsPage extends StatelessWidget { else return ToolWidget( tools: snapshot.data, - idToken: Provider.of(context), + idToken: Provider.of(context), key: null, ); } }, @@ -41,7 +41,7 @@ class ToolWidget extends StatefulWidget { Map> tools; final firebase.IdTokenResult idToken; - ToolWidget({required Key key, this.tools, this.idToken}) : super(key: key); + ToolWidget({required Key key, required this.tools, required this.idToken}) : super(key: key); @override _toolState createState() => _toolState(this.tools, this.idToken); @@ -157,7 +157,7 @@ class _toolState extends State with RouteAware { ToolCard( category: category, tools: tools, - refreshTools: refreshTools, + refreshTools: refreshTools, key: null, ))); return Container( From 9279fbbed5a9df5d27abd047dae3522ad37af0ff Mon Sep 17 00:00:00 2001 From: Tanav Date: Thu, 14 Dec 2023 20:59:52 -0800 Subject: [PATCH 04/18] did my work? --- .idea/workspace.xml | 25 ++++---- lib/services/database.dart | 2 +- lib/ui/HomePage.dart | 12 ++-- lib/ui/tools/ToolsPage.dart | 120 ++++++++++++++++++------------------ 4 files changed, 79 insertions(+), 80 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 019d04e..d75d924 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -6,11 +6,8 @@ - - - - - + + - { + "keyToString": { + "RunOnceActivity.ShowReadmeOnStart": "true", + "RunOnceActivity.cidr.known.project.marker": "true", + "cf.first.check.clang-format": "false", + "cidr.known.project.marker": "true", + "git-widget-placeholder": "master", + "last_opened_file_path": "C:/Users/fifte/.vscode/OptixToolkit" } -}]]> +} diff --git a/lib/services/database.dart b/lib/services/database.dart index 9b02da9..05a9b36 100644 --- a/lib/services/database.dart +++ b/lib/services/database.dart @@ -712,7 +712,7 @@ class Part { String status = json['status']; print(status + " " + json['trackingInfo']['trackingId']); if (deliveryMap.containsKey(json['status'])) { - status = deliveryMap[status]; + status = deliveryMap[status]!; } else { status = "Faliure"; } diff --git a/lib/ui/HomePage.dart b/lib/ui/HomePage.dart index cf50d2a..6fc5b83 100644 --- a/lib/ui/HomePage.dart +++ b/lib/ui/HomePage.dart @@ -11,18 +11,18 @@ import 'package:OptixToolkit/ui/tools/ToolLine.dart'; class homePage extends StatelessWidget { final Function(int) changePage; - homePage({Key key, this.changePage}) : super(key: key); + homePage({required Key key, required this.changePage}) : super(key: key); @override Widget build(BuildContext context) { return MultiProvider(providers: [ FutureProvider>.value( - value: Database.getParts(Provider.of(context))), + value: Database.getParts(Provider.of(context)), initialData: [],), FutureProvider>>.value( value: - Database.getToolsReversed(Provider.of(context))), + Database.getToolsReversed(Provider.of(context)), initialData: {},), FutureProvider.value( - value: Database.getTime(Provider.of(context), context)) + value: Database.getTime(Provider.of(context), context), initialData: 0,) ], child: homePage2()); } } @@ -32,7 +32,7 @@ class homePage2 extends StatefulWidget { final List tools; final int time; final Function(int) changePage; - homePage2({Key key, this.parts, this.tools, this.changePage, this.time}) + homePage2({required Key key, required this.parts, required this.tools, required this.changePage, required this.time}) : super(key: key); @override @@ -102,7 +102,7 @@ class _homePage2State extends State { TextSpan( text: Provider.of(context) .displayName - .split(" ")[0], + ?.split(" ")[0], style: GoogleFonts.rubik( fontWeight: FontWeight.bold, color: Colors.white, diff --git a/lib/ui/tools/ToolsPage.dart b/lib/ui/tools/ToolsPage.dart index 3a1061b..77c30af 100644 --- a/lib/ui/tools/ToolsPage.dart +++ b/lib/ui/tools/ToolsPage.dart @@ -283,63 +283,65 @@ class _toolState extends State with RouteAware { } } -// ButtonTheme( //This is for barcode scanner new -// minWidth: MediaQuery.of(context).size.width * 0.43, -// height: 55, -// shape: RoundedRectangleBorder( -// borderRadius: -// BorderRadius.circular(7.0)), -// child: ElevatedButton( -// onPressed: () { -// returnScan().catchError(() { -// _showDialog(context); -// }); -// refreshTools(); -// }, -// child: Text( -// 'RETURN', -// style: GoogleFonts.rubik( -// fontWeight: FontWeight.bold, -// fontSize: 20.0, -// color: Colors.white, -// ), -// ), -// style: ElevatedButton.styleFrom(backgroundColor: Color(0xff159deb)), -// ), -// ) +ElevatedButton( + onPressed: () { + _scanBarcode(context); // Function to initiate barcode scanning + }, + child: Text( + 'Barcode Scanner', + style: GoogleFonts.rubik( + fontWeight: FontWeight.bold, + fontSize: 20.0, + color: Colors.white, + ), + ), + style: ElevatedButton.styleFrom(backgroundColor: Color(0xff159deb)), +), +]; -// Container( -// margin: EdgeInsets.only(left: 12, top: 50, right: 12, bottom: 0), -// width: 400, -// height: MediaQuery.of(context).size.height * 0.63, -// decoration: BoxDecoration( -// borderRadius: BorderRadius.circular(10.0), -// color: Color(0xff3a3d41), -// ), -// child: Padding( -// padding: EdgeInsets.all(15.0), -// child: Column( -// children: [ -// Row( -// mainAxisAlignment: MainAxisAlignment.center, -// crossAxisAlignment: CrossAxisAlignment.center, -// children: [ -// RichText( -// text: TextSpan( -// children: [ -// TextSpan( -// text: 'Checkout ', -// style: GoogleFonts.rubik( -// color: Colors.white, -// fontSize: 25.0, -// ) -// ) -// ] -// ) -// ) -// ] -// ) -// ] -// ) -// ) -// ) \ No newline at end of file +// Function to handle barcode scanning +Future _scanBarcode(BuildContext context) async { + try { + String barcodeValue = (await BarcodeScanner.scan()).rawContent; + _showBarcodeModal(context, barcodeValue); + } on PlatformException catch (e) { + if (e.code == BarcodeScanner.cameraAccessDenied) { + print('Camera permission not granted'); + } else { + print('Unknown Error: $e'); + } + } on FormatException catch (e) { + print('User pressed back button before scanning'); + } catch (e) { + print('Unknown Error: $e'); + } +} + +// Function to show a modal +void _showBarcodeModal(BuildContext context, String barcodeValue) { + showModalBottomSheet( + context: context, + builder: (BuildContext context) { + return Container( + height: 200, + color: Colors.white, + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + 'Scanned Barcode Value:', + style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold), + ), + SizedBox(height: 10), + Text( + barcodeValue, + style: TextStyle(fontSize: 16), + ), + ], + ), + ), + ); + }, + ); +} From 4aca322b2decd4273e3715ce15ecf10b79247c76 Mon Sep 17 00:00:00 2001 From: rjawesome Date: Fri, 15 Dec 2023 12:19:39 -0800 Subject: [PATCH 05/18] fix ui/parts --- lib/ui/parts/PartAdd.dart | 28 +++++++++++++++++----------- lib/ui/parts/PartCard.dart | 2 +- lib/ui/parts/PartLine.dart | 4 ++-- lib/ui/parts/PartModal.dart | 8 ++++---- lib/ui/parts/PartReimburse.dart | 20 ++++++++++---------- lib/ui/parts/PartsPage.dart | 10 +++++----- 6 files changed, 39 insertions(+), 33 deletions(-) diff --git a/lib/ui/parts/PartAdd.dart b/lib/ui/parts/PartAdd.dart index 6add90b..dabbb7f 100644 --- a/lib/ui/parts/PartAdd.dart +++ b/lib/ui/parts/PartAdd.dart @@ -11,7 +11,7 @@ import 'package:OptixToolkit/services/NavigationService.dart'; import 'package:OptixToolkit/services/database.dart'; class PartAdd extends StatefulWidget { - PartAdd({Key key}) : super(key: key); + PartAdd({Key? key}) : super(key: key); @override _PartAddState createState() => _PartAddState(); @@ -80,7 +80,7 @@ class _PartAddState extends State { margin: EdgeInsets.only(top: 20), child: TextFormField( validator: (value) { - if (value.isEmpty) { + if (value == null || value.isEmpty) { return 'Enter Part Name'; } return null; @@ -103,7 +103,8 @@ class _PartAddState extends State { margin: EdgeInsets.only(top: 17), child: TextFormField( validator: (value) { - if (value.length < 8 && + if (value != null && + value.length < 8 && !((value.substring(0, 8) != "https://") || (value.substring(0, 8) != "http://"))) { return 'Enter Valid Link (with http(s))'; @@ -128,7 +129,7 @@ class _PartAddState extends State { margin: EdgeInsets.only(top: 20), child: TextFormField( validator: (value) { - if (value.isEmpty) { + if (value == null || value.isEmpty) { return 'Enter Tracking Number'; } return null; @@ -166,10 +167,12 @@ class _PartAddState extends State { return "Select a Tool"; return null; }, - onChanged: (String newValue) { - setState(() { - dropdownValue = newValue; - }); + onChanged: (String? newValue) { + if (newValue != null) { + setState(() { + dropdownValue = newValue; + }); + } }, items: [ 'Select a Carrier', @@ -234,10 +237,12 @@ class _PartAddState extends State { borderRadius: BorderRadius.circular(7.0)), child: ElevatedButton( onPressed: () async { - if (_formKey.currentState.validate()) { + if (_formKey.currentState != null && + _formKey.currentState!.validate()) { print("Handling on pressed"); var result = await Database.addPart( - Provider.of(context, + Provider.of( + context, listen: false), Provider.of(context, listen: false), @@ -259,7 +264,8 @@ class _PartAddState extends State { style: GoogleFonts.rubik( fontWeight: FontWeight.bold, color: Colors.white)), - style: ElevatedButton.styleFrom(backgroundColor: Color(0xff159deb)), + style: ElevatedButton.styleFrom( + backgroundColor: Color(0xff159deb)), ), ), ], diff --git a/lib/ui/parts/PartCard.dart b/lib/ui/parts/PartCard.dart index 5e1db6f..deb932a 100644 --- a/lib/ui/parts/PartCard.dart +++ b/lib/ui/parts/PartCard.dart @@ -10,7 +10,7 @@ import 'package:OptixToolkit/services/database.dart'; class PartCard extends StatelessWidget { final Part part; - const PartCard({Key key, this.part}) : super(key: key); + const PartCard({Key? key, required this.part}) : super(key: key); Future _showMyDialog(BuildContext context) async { return showDialog( diff --git a/lib/ui/parts/PartLine.dart b/lib/ui/parts/PartLine.dart index 1d1817e..a95c283 100644 --- a/lib/ui/parts/PartLine.dart +++ b/lib/ui/parts/PartLine.dart @@ -5,7 +5,7 @@ import 'package:google_fonts/google_fonts.dart'; class PartLine extends StatelessWidget { final Part part; - const PartLine({Key key, this.part}) : super(key: key); + const PartLine({Key? key, required this.part}) : super(key: key); @override Widget build(BuildContext context) { @@ -59,7 +59,7 @@ class PartLine extends StatelessWidget { lineHeight: 30.0, animationDuration: 1000, backgroundColor: Color(0xff26292c), - percent: percentMap[part.status], + percent: percentMap[part.status]!, center: RichText( text: TextSpan( children: [ diff --git a/lib/ui/parts/PartModal.dart b/lib/ui/parts/PartModal.dart index 649574d..b07af47 100644 --- a/lib/ui/parts/PartModal.dart +++ b/lib/ui/parts/PartModal.dart @@ -12,7 +12,7 @@ import 'package:OptixToolkit/services/database.dart'; class PartModal extends StatelessWidget { final Part part; - const PartModal({Key key, this.part}) : super(key: key); + const PartModal({Key? key, required this.part}) : super(key: key); @override Widget build(BuildContext context) { @@ -187,9 +187,9 @@ class PartModal extends StatelessWidget { ), ), actions: [ - (Provider.of(context).claims['admin'] == true) - ? removeButton - : null, + if (Provider.of(context).claims?['admin'] == + true) + removeButton, doneButton, ], ); diff --git a/lib/ui/parts/PartReimburse.dart b/lib/ui/parts/PartReimburse.dart index 39c452b..fa418f2 100644 --- a/lib/ui/parts/PartReimburse.dart +++ b/lib/ui/parts/PartReimburse.dart @@ -13,7 +13,7 @@ import 'package:image_picker/image_picker.dart'; import 'package:OptixToolkit/services/firebase.dart'; class PartReimburse extends StatefulWidget { - PartReimburse({Key key}) : super(key: key); + PartReimburse({Key? key}) : super(key: key); @override _PartReimburseState createState() => _PartReimburseState(); @@ -25,7 +25,7 @@ class _PartReimburseState extends State { final mailingAddressController = TextEditingController(); final partDescriptionController = TextEditingController(); final checkAddressedToController = TextEditingController(); - File _image; + File? _image; final picker = ImagePicker(); final _formKey = GlobalKey(); @@ -88,7 +88,7 @@ class _PartReimburseState extends State { margin: EdgeInsets.only(top: 20), child: TextFormField( validator: (value) { - if (value.isEmpty) { + if (value == null || value.isEmpty) { return 'Enter Part Name'; } return null; @@ -111,7 +111,7 @@ class _PartReimburseState extends State { margin: EdgeInsets.only(top: 17), child: TextFormField( validator: (value) { - if (value.length < 8 && + if (value != null && value.length < 8 && !((value.substring(0, 8) != "https://") || (value.substring(0, 8) != "http://"))) { return 'Enter Valid Link (with http(s))'; @@ -136,7 +136,7 @@ class _PartReimburseState extends State { margin: EdgeInsets.only(top: 20), child: TextFormField( validator: (value) { - if (value.isEmpty) { + if (value == null || value.isEmpty) { return 'Enter Recipient Name'; } return null; @@ -159,7 +159,7 @@ class _PartReimburseState extends State { margin: EdgeInsets.only(top: 20), child: TextFormField( validator: (value) { - if (value.isEmpty) { + if (value == null || value.isEmpty) { return 'Enter Mailing Address'; } return null; @@ -222,19 +222,19 @@ class _PartReimburseState extends State { borderRadius: BorderRadius.circular(7.0)), child: ElevatedButton( onPressed: () async { - if (_formKey.currentState.validate()) { + if (_formKey.currentState != null && _formKey.currentState!.validate() && _image != null) { print("Handling on pressed"); var result = await Database.reimbursement( Provider.of(context, listen: false), Provider.of(context, listen: false) - .displayName, + .displayName!, partNameController.text, partLinkController.text, mailingAddressController.text, await Auth.getImageUrl( - _image, + _image!, Provider.of(context, listen: false)), checkAddressedToController.text, @@ -244,7 +244,7 @@ class _PartReimburseState extends State { if (result) { Good.showGood(context, "We have sent your reimbursement to business for review. They will file it and send you a check shortly."); - File _image = null; + _image = null; partNameController.clear(); partLinkController.clear(); mailingAddressController.clear(); diff --git a/lib/ui/parts/PartsPage.dart b/lib/ui/parts/PartsPage.dart index 552ba81..e7eab30 100644 --- a/lib/ui/parts/PartsPage.dart +++ b/lib/ui/parts/PartsPage.dart @@ -15,7 +15,7 @@ import 'package:OptixToolkit/services/NavigationService.dart'; import 'package:provider/provider.dart'; class partsPage extends StatelessWidget { - const partsPage({Key key, this.uid}) : super(key: key); + const partsPage({Key? key, required this.uid}) : super(key: key); final String uid; @override @@ -31,7 +31,7 @@ class partsPage extends StatelessWidget { return Text('Error: ${snapshot.error}'); else return PartsWidget( - parts: snapshot.data, + parts: snapshot.data ?? [], idToken: Provider.of(context)); } }, @@ -43,15 +43,15 @@ class PartsWidget extends StatefulWidget { final List parts; final firebase.IdTokenResult idToken; - PartsWidget({Key key, this.parts, this.idToken}) : super(key: key); + PartsWidget({Key? key, required this.parts, required this.idToken}) : super(key: key); @override _partState createState() => _partState(this.parts, this.idToken); } class _partState extends State { - List parts; - firebase.IdTokenResult idToken; + late List parts; + late firebase.IdTokenResult idToken; _partState(List parts, firebase.IdTokenResult idToken) { this.parts = parts; From ee596788191393ca55a0ab454e6e749f6cf3722f Mon Sep 17 00:00:00 2001 From: rjawesome Date: Fri, 15 Dec 2023 12:25:11 -0800 Subject: [PATCH 06/18] fix services --- lib/services/Good.dart | 2 +- lib/services/GoodPop.dart | 2 +- lib/services/NavigationService.dart | 2 +- lib/services/database.dart | 20 +++++++++++--------- lib/services/firebase.dart | 10 +++++----- 5 files changed, 19 insertions(+), 17 deletions(-) diff --git a/lib/services/Good.dart b/lib/services/Good.dart index 020e3f9..a264a05 100644 --- a/lib/services/Good.dart +++ b/lib/services/Good.dart @@ -6,7 +6,7 @@ import 'package:google_fonts/google_fonts.dart'; class Good extends StatelessWidget { final String good; - const Good({required Key key, this.good}) : super(key: key); + const Good({Key? key, required this.good}) : super(key: key); static Future showGood(BuildContext context, String good) async { return showDialog( diff --git a/lib/services/GoodPop.dart b/lib/services/GoodPop.dart index b26542e..2ff798d 100644 --- a/lib/services/GoodPop.dart +++ b/lib/services/GoodPop.dart @@ -6,7 +6,7 @@ import 'package:google_fonts/google_fonts.dart'; class GoodPop extends StatelessWidget { final String good; - const GoodPop({required Key key, this.good}) : super(key: key); + const GoodPop({Key? key, required this.good}) : super(key: key); static Future showGood(BuildContext context, String good) async { return showDialog( diff --git a/lib/services/NavigationService.dart b/lib/services/NavigationService.dart index 5a71d64..05a18d8 100644 --- a/lib/services/NavigationService.dart +++ b/lib/services/NavigationService.dart @@ -12,7 +12,7 @@ class NavigationService { return navigatorKey.currentState!.push(route); } - static Future goToAndThen(Route route, Function f) { + static Future goToAndThen(Route route, Function(Object?) f) { return navigatorKey.currentState!.push(route).then(f); } diff --git a/lib/services/database.dart b/lib/services/database.dart index 05a9b36..7c84415 100644 --- a/lib/services/database.dart +++ b/lib/services/database.dart @@ -160,8 +160,12 @@ class Database { } } - static Future changeToolStatus(firebase.IdTokenResult idToken, firebase.User user, - String toolname, String newstatus, BuildContext context) async { + static Future changeToolStatus( + firebase.IdTokenResult idToken, + firebase.User user, + String toolname, + String newstatus, + BuildContext context) async { var client = http.Client(); Map data = { @@ -238,8 +242,8 @@ class Database { } } - static Future addTool(firebase.IdTokenResult idToken, String toolname, String category, - BuildContext context) async { + static Future addTool(firebase.IdTokenResult idToken, String toolname, + String category, BuildContext context) async { var client = http.Client(); Map data = { @@ -314,8 +318,8 @@ class Database { } } - static Future addUser(firebase.IdTokenResult idToken, String name, String email, - bool admin, BuildContext context) async { + static Future addUser(firebase.IdTokenResult idToken, String name, + String email, bool admin, BuildContext context) async { var client = http.Client(); Map data = { @@ -803,9 +807,7 @@ class LastCheckInTime { class MeetingCount { int _value; - MeetingCount(int value) { - _value = value; - } + MeetingCount(int value) : _value = value; int getValue() { return _value; diff --git a/lib/services/firebase.dart b/lib/services/firebase.dart index f2a6868..c3b3d97 100644 --- a/lib/services/firebase.dart +++ b/lib/services/firebase.dart @@ -18,8 +18,8 @@ class Auth { //do login try { await _auth.signInWithEmailAndPassword(email: email, password: password); - } catch (e) { - Alert.showAlert(context, e.message); + } on firebase.FirebaseAuthException catch (e) { + Alert.showAlert(context, e.message ?? "Unknown authentication error"); } isInProcess = false; } @@ -28,7 +28,7 @@ class Auth { await _auth.signOut(); } - static Stream authState() { + static Stream authState() { return _auth.authStateChanges(); } @@ -36,8 +36,8 @@ class Auth { String email, BuildContext context) async { try { await _auth.sendPasswordResetEmail(email: email); - } catch (e) { - Alert.showAlert(context, e.message); + } on firebase.FirebaseAuthException catch (e) { + Alert.showAlert(context, e.message ?? "Unknown Authentication error"); print(e); } } From 9f39c097d7cc5cc965b15403632f0e03bd6b4e45 Mon Sep 17 00:00:00 2001 From: rjawesome Date: Fri, 15 Dec 2023 12:26:44 -0800 Subject: [PATCH 07/18] fix main --- lib/main.dart | 12 +++++++++--- lib/ui/Home.dart | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 2b3dada..f6aaf94 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -30,11 +30,17 @@ class MyApp extends StatelessWidget { ], ); return MultiProvider( - providers: [StreamProvider.value(value: Auth.authState())], - child: Consumer( + providers: [ + StreamProvider.value( + value: Auth.authState(), + initialData: null, + ) + ], + child: Consumer( builder: (context, user, child) { if (user != null) { - return FutureProvider( + return FutureProvider( + initialData: null, create: (_) => user.getIdTokenResult(), child: MaterialApp( title: 'OptixToolkit', diff --git a/lib/ui/Home.dart b/lib/ui/Home.dart index c170417..d538eb9 100644 --- a/lib/ui/Home.dart +++ b/lib/ui/Home.dart @@ -17,7 +17,7 @@ import 'package:OptixToolkit/services/firebase.dart'; import 'package:OptixToolkit/ui/parts/PartReimburse.dart'; class MyStatefulWidget extends StatefulWidget { - MyStatefulWidget({required Key key}) : super(key: key); + MyStatefulWidget({Key? key}) : super(key: key); @override _MyStatefulWidgetState createState() => _MyStatefulWidgetState(); From f982d7b1d9ebdbc78e0c6a4e2db85e80afef2cab Mon Sep 17 00:00:00 2001 From: rjawesome Date: Fri, 15 Dec 2023 12:35:51 -0800 Subject: [PATCH 08/18] fix ui/ directory --- lib/services/database.dart | 12 ++++++++---- lib/ui/ForgetPassword.dart | 6 +++--- lib/ui/Form.dart | 29 +++++++++++++++-------------- lib/ui/Home.dart | 4 ++-- lib/ui/HomePage.dart | 9 +++------ lib/ui/HoursPage.dart | 14 +++++++------- lib/ui/ProfilePage.dart | 6 +++--- lib/ui/UserCard.dart | 2 +- lib/ui/UserList.dart | 2 +- lib/ui/UserModal.dart | 2 +- lib/ui/tools/ToolLine.dart | 2 +- lib/ui/tools/ToolsPage.dart | 2 +- 12 files changed, 46 insertions(+), 44 deletions(-) diff --git a/lib/services/database.dart b/lib/services/database.dart index 7c84415..bc068d6 100644 --- a/lib/services/database.dart +++ b/lib/services/database.dart @@ -458,8 +458,10 @@ class Database { } } - static Future getLastCheckIn( - firebase.IdTokenResult idToken, BuildContext context) async { + static Future getLastCheckIn( + firebase.IdTokenResult? idToken, BuildContext context) async { + if (idToken == null) return null; + var client = http.Client(); Map data = { @@ -484,8 +486,10 @@ class Database { } } - static Future getMeetingCount( - firebase.IdTokenResult idToken, BuildContext context) async { + static Future getMeetingCount( + firebase.IdTokenResult? idToken, BuildContext context) async { + if (idToken == null) return null; + var client = http.Client(); Map data = { diff --git a/lib/ui/ForgetPassword.dart b/lib/ui/ForgetPassword.dart index be832e5..0a91cad 100644 --- a/lib/ui/ForgetPassword.dart +++ b/lib/ui/ForgetPassword.dart @@ -10,7 +10,7 @@ import 'package:google_fonts/google_fonts.dart'; import 'package:OptixToolkit/services/firebase.dart'; class ForgetPassword extends StatefulWidget { - ForgetPassword({Key key}) : super(key: key); + ForgetPassword({Key? key}) : super(key: key); @override _ForgetPasswordState createState() => _ForgetPasswordState(); @@ -65,7 +65,7 @@ class _ForgetPasswordState extends State { width: 300, child: TextFormField( validator: (value) { - if (value.isEmpty) { + if (value == null || value.isEmpty) { return 'Email'; } return null; @@ -101,7 +101,7 @@ class _ForgetPasswordState extends State { borderRadius: BorderRadius.circular(7.0)), child: ElevatedButton( onPressed: () { - if (_formKey.currentState.validate()) { + if (_formKey.currentState != null && _formKey.currentState!.validate()) { Auth.sendPasswordResetEmail( emailController.text, context); Good.showGood(context, "Sent!"); diff --git a/lib/ui/Form.dart b/lib/ui/Form.dart index 177d4b9..d101185 100644 --- a/lib/ui/Form.dart +++ b/lib/ui/Form.dart @@ -11,7 +11,7 @@ import 'package:OptixToolkit/services/NavigationService.dart'; import 'package:OptixToolkit/services/firebase.dart'; class FormPage extends StatefulWidget { - FormPage({Key key}) : super(key: key); + FormPage({Key? key}) : super(key: key); @override _FormPageState createState() => _FormPageState(); @@ -62,7 +62,7 @@ class _FormPageState extends State { width: 300, child: TextFormField( validator: (value) { - if (value.isEmpty) { + if (value == null || value.isEmpty) { return 'Email'; } return null; @@ -85,7 +85,7 @@ class _FormPageState extends State { width: 300, child: TextFormField( validator: (value) { - if (value.isEmpty) { + if (value == null || value.isEmpty) { return 'Password'; } return null; @@ -134,17 +134,18 @@ class _FormPageState extends State { shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(7.0)), child: ElevatedButton( - onPressed: () { - if (_formKey.currentState.validate()) { - Auth.signIn(emailController.text, - passwordController.text, context); - } - }, - child: Text('LOG IN', - style: GoogleFonts.rubik( - fontWeight: FontWeight.bold, color: white)), - style: ElevatedButton.styleFrom(backgroundColor: blue) - ), + onPressed: () { + if (_formKey.currentState != null && + _formKey.currentState!.validate()) { + Auth.signIn(emailController.text, + passwordController.text, context); + } + }, + child: Text('LOG IN', + style: GoogleFonts.rubik( + fontWeight: FontWeight.bold, color: white)), + style: + ElevatedButton.styleFrom(backgroundColor: blue)), ), SizedBox(height: 20), RichText( diff --git a/lib/ui/Home.dart b/lib/ui/Home.dart index d538eb9..ccc06f8 100644 --- a/lib/ui/Home.dart +++ b/lib/ui/Home.dart @@ -57,8 +57,8 @@ class _MyStatefulWidgetState extends State { Widget build(BuildContext context) { List _widgetOptions = [ homePage(changePage: changePage), - hoursPage(key: null,), - toolsPage(key: null, uid: '',), + hoursPage(), + toolsPage(uid: '',), PartReimburse(), profilePage(key: null,), Container( diff --git a/lib/ui/HomePage.dart b/lib/ui/HomePage.dart index 6fc5b83..c6d2b4a 100644 --- a/lib/ui/HomePage.dart +++ b/lib/ui/HomePage.dart @@ -11,7 +11,7 @@ import 'package:OptixToolkit/ui/tools/ToolLine.dart'; class homePage extends StatelessWidget { final Function(int) changePage; - homePage({required Key key, required this.changePage}) : super(key: key); + homePage({Key? key, required this.changePage}) : super(key: key); @override Widget build(BuildContext context) { @@ -23,16 +23,13 @@ class homePage extends StatelessWidget { Database.getToolsReversed(Provider.of(context)), initialData: {},), FutureProvider.value( value: Database.getTime(Provider.of(context), context), initialData: 0,) - ], child: homePage2()); + ], child: homePage2(changePage: this.changePage)); } } class homePage2 extends StatefulWidget { - final List parts; - final List tools; - final int time; final Function(int) changePage; - homePage2({required Key key, required this.parts, required this.tools, required this.changePage, required this.time}) + homePage2({Key? key, required this.changePage }) : super(key: key); @override diff --git a/lib/ui/HoursPage.dart b/lib/ui/HoursPage.dart index 3caf1c0..d052505 100644 --- a/lib/ui/HoursPage.dart +++ b/lib/ui/HoursPage.dart @@ -8,7 +8,7 @@ import 'package:OptixToolkit/services/database.dart'; import 'package:provider/provider.dart'; class hoursPage extends StatelessWidget { - const hoursPage({required Key key}) : super(key: key); + const hoursPage({Key? key}) : super(key: key); @override Widget build(BuildContext context) { @@ -16,18 +16,18 @@ class hoursPage extends StatelessWidget { FutureProvider.value( value: Database.getTime(Provider.of(context), context), initialData: 0,), - FutureProvider.value( + FutureProvider.value( value: Database.getLastCheckIn( - Provider.of(context), context), initialData: null,), - FutureProvider.value( + Provider.of(context), context), initialData: null), + FutureProvider.value( value: Database.getMeetingCount( - Provider.of(context), context), initialData: null,) - ], child: hoursPageLoaded(key: null,)); + Provider.of(context), context), initialData: null) + ], child: hoursPageLoaded()); } } class hoursPageLoaded extends StatefulWidget { - const hoursPageLoaded({required Key key}) : super(key: key); + const hoursPageLoaded({Key? key}) : super(key: key); @override _hoursPageState createState() => _hoursPageState(); diff --git a/lib/ui/ProfilePage.dart b/lib/ui/ProfilePage.dart index d22c5c5..00634f6 100644 --- a/lib/ui/ProfilePage.dart +++ b/lib/ui/ProfilePage.dart @@ -12,7 +12,7 @@ import 'package:provider/provider.dart'; import 'package:OptixToolkit/services/firebase.dart'; class profilePage extends StatelessWidget { - const profilePage({required Key key}) : super(key: key); + const profilePage({Key? key}) : super(key: key); @override Widget build(BuildContext context) { @@ -54,7 +54,7 @@ class profilePage extends StatelessWidget { TextSpan( text: Provider.of(context) .displayName - .split(" ")[0], + ?.split(" ")[0], style: GoogleFonts.rubik( fontWeight: FontWeight.bold, color: Colors.white, @@ -207,7 +207,7 @@ class profilePage extends StatelessWidget { ), ), ), - if (Provider.of(context).claims['admin'] == true) + if (Provider.of(context).claims?['admin'] == true) Container( margin: EdgeInsets.only(left: 12, top: 17, right: 12, bottom: 0), width: 400, diff --git a/lib/ui/UserCard.dart b/lib/ui/UserCard.dart index ebb0627..bcbb9e1 100644 --- a/lib/ui/UserCard.dart +++ b/lib/ui/UserCard.dart @@ -13,7 +13,7 @@ import 'package:provider/provider.dart'; class UserCard extends StatelessWidget { final User user; - const UserCard({Key key, this.user}) : super(key: key); + const UserCard({Key? key, required this.user}) : super(key: key); Future _showMyDialog(BuildContext context) async { return showDialog( diff --git a/lib/ui/UserList.dart b/lib/ui/UserList.dart index a258b62..114d785 100644 --- a/lib/ui/UserList.dart +++ b/lib/ui/UserList.dart @@ -14,7 +14,7 @@ import 'Loading.dart'; import 'UserCard.dart'; class UserList extends StatefulWidget { - UserList({required Key key}) : super(key: key); + UserList({Key? key}) : super(key: key); @override _UserListState createState() => _UserListState(); diff --git a/lib/ui/UserModal.dart b/lib/ui/UserModal.dart index a1405e2..4ab4fa0 100644 --- a/lib/ui/UserModal.dart +++ b/lib/ui/UserModal.dart @@ -9,7 +9,7 @@ import 'package:google_fonts/google_fonts.dart'; class UserModal extends StatelessWidget { final User user; - const UserModal({required Key key, this.user}) : super(key: key); + const UserModal({Key? key, required this.user}) : super(key: key); @override Widget build(BuildContext context) { diff --git a/lib/ui/tools/ToolLine.dart b/lib/ui/tools/ToolLine.dart index b0da2c7..18938d6 100644 --- a/lib/ui/tools/ToolLine.dart +++ b/lib/ui/tools/ToolLine.dart @@ -5,7 +5,7 @@ import 'package:OptixToolkit/services/database.dart'; class ToolLine extends StatelessWidget { final Tool tool; final String status; - const ToolLine({required Key key, required this.tool, required this.status}) : super(key: key); + const ToolLine({Key? key, required this.tool, required this.status}) : super(key: key); @override Widget build(BuildContext context) { diff --git a/lib/ui/tools/ToolsPage.dart b/lib/ui/tools/ToolsPage.dart index 77c30af..14bf278 100644 --- a/lib/ui/tools/ToolsPage.dart +++ b/lib/ui/tools/ToolsPage.dart @@ -12,7 +12,7 @@ import 'package:barcode_scan2/barcode_scan2.dart'; import 'package:google_fonts/google_fonts.dart'; class toolsPage extends StatelessWidget { - const toolsPage({required Key key, required this.uid}) : super(key: key); + const toolsPage({Key? key, required this.uid}) : super(key: key); final String uid; @override From de2f56e76e37117ae45e6290bbce3007f7d20610 Mon Sep 17 00:00:00 2001 From: rjawesome Date: Fri, 15 Dec 2023 13:26:49 -0800 Subject: [PATCH 09/18] rest of null fixes --- lib/ui/tools/ToolAdd.dart | 12 ++++--- lib/ui/tools/ToolCard.dart | 2 +- lib/ui/tools/ToolReserve.dart | 4 +-- lib/ui/tools/ToolReserveItem.dart | 27 ++++++++++------ lib/ui/tools/ToolStatus.dart | 2 +- lib/ui/tools/ToolsPage.dart | 52 +++++++++++++++++-------------- 6 files changed, 56 insertions(+), 43 deletions(-) diff --git a/lib/ui/tools/ToolAdd.dart b/lib/ui/tools/ToolAdd.dart index 1f5aa3b..60bbce0 100644 --- a/lib/ui/tools/ToolAdd.dart +++ b/lib/ui/tools/ToolAdd.dart @@ -11,7 +11,7 @@ import 'package:OptixToolkit/services/NavigationService.dart'; import 'package:OptixToolkit/services/database.dart'; class ToolAdd extends StatefulWidget { - ToolAdd({required Key key}) : super(key: key); + ToolAdd({Key? key}) : super(key: key); @override _ToolAddState createState() => _ToolAddState(); @@ -119,10 +119,12 @@ class _ToolAddState extends State { return "Type of Tool"; return null; }, - onChanged: (String newValue) { - setState(() { - dropdownValue = newValue; - }); + onChanged: (String? newValue) { + if (newValue != null) { + setState(() { + dropdownValue = newValue; + }); + } }, items: [ 'Type of Tool', diff --git a/lib/ui/tools/ToolCard.dart b/lib/ui/tools/ToolCard.dart index 3d2b738..9753464 100644 --- a/lib/ui/tools/ToolCard.dart +++ b/lib/ui/tools/ToolCard.dart @@ -12,7 +12,7 @@ class ToolCard extends StatelessWidget { final List tools; final String category; final RefreshFunction refreshTools; - const ToolCard({required Key key, required this.tools, required this.category, required this.refreshTools}) + const ToolCard({Key? key, required this.tools, required this.category, required this.refreshTools}) : super(key: key); @override diff --git a/lib/ui/tools/ToolReserve.dart b/lib/ui/tools/ToolReserve.dart index 0d4063f..7950ac2 100644 --- a/lib/ui/tools/ToolReserve.dart +++ b/lib/ui/tools/ToolReserve.dart @@ -18,7 +18,7 @@ class ToolReserve extends StatelessWidget { final List tools; final String category; - ToolReserve({required Key key, this.tools, this.category}) : super(key: key); + ToolReserve({Key? key, required this.tools, required this.category}) : super(key: key); final Color background = Color(0xff26292c); final Color gray = Color(0xff3A3D41); @@ -87,7 +87,7 @@ class ToolReserve extends StatelessWidget { ), ), floatingActionButton: - (Provider.of(context).claims['admin'] == true) + (Provider.of(context).claims?['admin'] == true) ? FloatingActionButton( onPressed: () { NavigationService.goTo( diff --git a/lib/ui/tools/ToolReserveItem.dart b/lib/ui/tools/ToolReserveItem.dart index 773bdbc..b332d2d 100644 --- a/lib/ui/tools/ToolReserveItem.dart +++ b/lib/ui/tools/ToolReserveItem.dart @@ -7,7 +7,7 @@ import 'package:firebase_auth/firebase_auth.dart' as firebase; class ToolReserveItem extends StatelessWidget { final Tool tool; - const ToolReserveItem({required Key key, required this.tool}) : super(key: key); + const ToolReserveItem({Key? key, required this.tool}) : super(key: key); Future _showToolService(BuildContext context) async { Widget doneButton = TextButton( @@ -80,7 +80,8 @@ class ToolReserveItem extends StatelessWidget { print("Tool Status: " + tool.status); if (tool.status == "notInUse") { var result = await Database.changeToolStatus( - Provider.of(context, listen: false), + Provider.of(context, + listen: false), Provider.of(context, listen: false), tool.name, "outOfService", @@ -92,7 +93,8 @@ class ToolReserveItem extends StatelessWidget { } } else if (tool.status == "outOfService") { var result = await Database.changeToolStatus( - Provider.of(context, listen: false), + Provider.of(context, + listen: false), Provider.of(context, listen: false), tool.name, "notInUse", @@ -115,15 +117,17 @@ class ToolReserveItem extends StatelessWidget { color: Colors.white, ), ), - style: ElevatedButton.styleFrom(backgroundColor: Color(0xff159deb)), + style: ElevatedButton.styleFrom( + backgroundColor: Color(0xff159deb)), ), ], ), ), actions: [ - (!!Provider.of(context).claims['admin']) - ? removeButton - : null, + if (Provider.of(context) + .claims?['admin'] == + true) + removeButton, doneButton, ], ), @@ -313,12 +317,14 @@ class ToolReserveItem extends StatelessWidget { print("Tool Name: " + tool.name); print("Tool Status: " + tool.status); var result = await Database.reserveTool( - Provider.of(context, listen: false), + Provider.of(context, + listen: false), Provider.of(context, listen: false), tool.name, context); print(await Database.getUsers( - Provider.of(context, listen: false))); + Provider.of(context, + listen: false))); print("Result of the request: " + result.toString()); if (result) { NavigationService.pop(); @@ -335,7 +341,8 @@ class ToolReserveItem extends StatelessWidget { color: Colors.white, ), ), - style: ElevatedButton.styleFrom(backgroundColor: Color(0xff159deb)), + style: ElevatedButton.styleFrom( + backgroundColor: Color(0xff159deb)), ), ), ], diff --git a/lib/ui/tools/ToolStatus.dart b/lib/ui/tools/ToolStatus.dart index 37c0264..6a1b926 100644 --- a/lib/ui/tools/ToolStatus.dart +++ b/lib/ui/tools/ToolStatus.dart @@ -3,7 +3,7 @@ import 'package:google_fonts/google_fonts.dart'; class ToolStatus extends StatelessWidget { final String status; - const ToolStatus({Key key, @required this.status}) : super(key: key); + const ToolStatus({Key? key, required this.status}) : super(key: key); @override Widget build(BuildContext context) { diff --git a/lib/ui/tools/ToolsPage.dart b/lib/ui/tools/ToolsPage.dart index 14bf278..7dc458b 100644 --- a/lib/ui/tools/ToolsPage.dart +++ b/lib/ui/tools/ToolsPage.dart @@ -28,8 +28,8 @@ class toolsPage extends StatelessWidget { return Text('Error: ${snapshot.error}'); else return ToolWidget( - tools: snapshot.data, - idToken: Provider.of(context), key: null, + tools: snapshot.data ?? {}, + idToken: Provider.of(context), ); } }, @@ -41,15 +41,15 @@ class ToolWidget extends StatefulWidget { Map> tools; final firebase.IdTokenResult idToken; - ToolWidget({required Key key, required this.tools, required this.idToken}) : super(key: key); + ToolWidget({Key? key, required this.tools, required this.idToken}) : super(key: key); @override _toolState createState() => _toolState(this.tools, this.idToken); } class _toolState extends State with RouteAware { - Map> tools; - firebase.IdTokenResult idToken; + late Map> tools; + late firebase.IdTokenResult idToken; _toolState(Map> tools, firebase.IdTokenResult idToken) { this.tools = tools; @@ -196,7 +196,10 @@ class _toolState extends State with RouteAware { color: Colors.white, ), ), - style: ElevatedButton.styleFrom(backgroundColor: Color(0xff159deb)), + style: ButtonStyle( + backgroundColor: + MaterialStateProperty.all(Color(0xff159deb)), + ), ), ), ButtonTheme( @@ -219,13 +222,30 @@ class _toolState extends State with RouteAware { color: Colors.white, ), ), - style: ElevatedButton.styleFrom(backgroundColor: Color(0xff159deb)), + style: ButtonStyle( + backgroundColor: + MaterialStateProperty.all(Color(0xff159deb)), + ), ), ) ], ), ), ), + ElevatedButton( + onPressed: () { + _scanBarcode(context); // Function to initiate barcode scanning + }, + child: Text( + 'Barcode Scanner', + style: GoogleFonts.rubik( + fontWeight: FontWeight.bold, + fontSize: 20.0, + color: Colors.white, + ), + ), + style: ElevatedButton.styleFrom(backgroundColor: Color(0xff159deb)), + ), Container( margin: EdgeInsets.only(left: 12, top: 17, right: 12, bottom: 0), width: 400, @@ -267,7 +287,7 @@ class _toolState extends State with RouteAware { const SizedBox(height: 15), Expanded( child: RefreshIndicator( - onRefresh: () { + onRefresh: () async { refreshTools(); }, child: ListView(children: widgets), @@ -283,22 +303,6 @@ class _toolState extends State with RouteAware { } } -ElevatedButton( - onPressed: () { - _scanBarcode(context); // Function to initiate barcode scanning - }, - child: Text( - 'Barcode Scanner', - style: GoogleFonts.rubik( - fontWeight: FontWeight.bold, - fontSize: 20.0, - color: Colors.white, - ), - ), - style: ElevatedButton.styleFrom(backgroundColor: Color(0xff159deb)), -), -]; - // Function to handle barcode scanning Future _scanBarcode(BuildContext context) async { try { From 5ea04b696617e3b8d20749bd9e88a7c9442613b3 Mon Sep 17 00:00:00 2001 From: rjawesome Date: Fri, 15 Dec 2023 13:40:41 -0800 Subject: [PATCH 10/18] update flutter aciton and package versions --- .github/workflows/build.yml | 2 +- pubspec.lock | 30 +++++++++++++++--------------- pubspec.yaml | 2 +- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5a63b4f..43d990f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,7 +13,7 @@ jobs: - uses: actions/setup-java@v1 with: java-version: "12.x" - - uses: subosito/flutter-action@v1.3.2 + - uses: subosito/flutter-action@v2 - run: flutter pub get - run: flutter build apk diff --git a/pubspec.lock b/pubspec.lock index 859f164..ad41b2a 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -85,10 +85,10 @@ packages: dependency: transitive description: name: collection - sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 url: "https://pub.dev" source: hosted - version: "1.18.0" + version: "1.17.2" cross_file: dependency: transitive description: @@ -244,10 +244,10 @@ packages: dependency: "direct main" description: name: google_fonts - sha256: "8f099045e2f2a30e4d4d0a35f40c6bc941a8f2ca0e10ad9d214ee9edd3f37483" + sha256: "6b6f10f0ce3c42f6552d1c70d2c28d764cf22bb487f50f66cca31dcd5194f4d6" url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "4.0.4" http: dependency: "direct main" description: @@ -356,10 +356,10 @@ packages: dependency: transitive description: name: meta - sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e + sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.9.1" nested: dependency: transitive description: @@ -545,18 +545,18 @@ packages: dependency: transitive description: name: stack_trace - sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 url: "https://pub.dev" source: hosted - version: "1.11.1" + version: "1.11.0" stream_channel: dependency: transitive description: name: stream_channel - sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.1" string_scanner: dependency: transitive description: @@ -577,10 +577,10 @@ packages: dependency: transitive description: name: test_api - sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" + sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8" url: "https://pub.dev" source: hosted - version: "0.6.1" + version: "0.6.0" tint: dependency: transitive description: @@ -609,10 +609,10 @@ packages: dependency: transitive description: name: web - sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152 + sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10 url: "https://pub.dev" source: hosted - version: "0.3.0" + version: "0.1.4-beta" win32: dependency: transitive description: @@ -638,5 +638,5 @@ packages: source: hosted version: "3.1.1" sdks: - dart: ">=3.2.0-194.0.dev <4.0.0" + dart: ">=3.1.0-185.0.dev <4.0.0" flutter: ">=3.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index c66211f..7e43c49 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -22,7 +22,7 @@ dependencies: firebase_storage: cloud_firestore: rxdart: - google_fonts: + google_fonts: ^4.0.4 percent_indicator: provider: image_picker: From acc529c2692b245a52063d1e263c911ed1ea40bf Mon Sep 17 00:00:00 2001 From: rjawesome Date: Fri, 15 Dec 2023 13:41:44 -0800 Subject: [PATCH 11/18] update gradle version --- android/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/build.gradle b/android/build.gradle index 19b1a7d..35e3623 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -6,7 +6,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:3.5.0' + classpath 'com.android.tools.build:gradle:4.2.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath 'com.google.gms:google-services:4.3.3' } From a00beab858c8edd79e1321ce1aeeba94d15462a9 Mon Sep 17 00:00:00 2001 From: rjawesome Date: Fri, 15 Dec 2023 13:48:21 -0800 Subject: [PATCH 12/18] more gradle updates --- android/app/src/main/AndroidManifest.xml | 3 ++- android/build.gradle | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 29ea470..1872ea8 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -31,7 +31,8 @@ android:theme="@style/LaunchTheme" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" - android:windowSoftInputMode="adjustResize"> + android:windowSoftInputMode="adjustResize" + android:exported="true">