From 53d24a176b9deddf51c3e1d7700fa05e9e166c7d Mon Sep 17 00:00:00 2001 From: Pranjal Aggarwal Date: Sun, 15 Aug 2021 09:08:27 +0530 Subject: [PATCH 1/3] Updates for v1 --- .vscode/launch.json | 2 +- analysis_options.yaml | 3 + lib/main.dart | 19 +- lib/modules/calendar/calendar.dart | 1 + .../calendar/screens/AppointmentEditor.dart | 389 +++++++++--------- lib/modules/login/userlogin/login_page.dart | 8 +- .../news/widgets/confirmationDialog.dart | 12 +- lib/push_notifications.dart | 4 +- lib/values/Constants.dart | 4 +- pubspec.lock | 14 +- 10 files changed, 231 insertions(+), 225 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 3287bb6..b0511a7 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -7,7 +7,7 @@ { "name": "Flutter", "request": "launch", - "type": "dart" + "type": "dart", } ] } \ No newline at end of file diff --git a/analysis_options.yaml b/analysis_options.yaml index 108d105..eefa3de 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1 +1,4 @@ include: package:pedantic/analysis_options.yaml +# analyzer: +# errors: +# todo: ignore diff --git a/lib/main.dart b/lib/main.dart index 2dee4ec..9d93153 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -16,14 +16,15 @@ import 'package:firebase_core/firebase_core.dart'; // import 'package:global_configuration/global_configuration.dart'; // import 'package:syncfusion_flutter_core/core.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:pedantic/pedantic.dart'; import 'package:provider/provider.dart'; -import 'package:IITDAPP/modules/discussionForum/discuss.dart'; +// import 'package:IITDAPP/modules/discussionForum/discuss.dart'; import 'package:IITDAPP/modules/courses/screens/search.dart'; + void main() async { WidgetsFlutterBinding.ensureInitialized(); - // try { // await GlobalConfiguration().loadFromAsset('secrets'); // SyncfusionLicense.registerLicense( @@ -58,7 +59,6 @@ void main() async { ChangeNotifierProvider( create: (_) => EventsTabProvider(), ), - ChangeNotifierProvider(create: (_) => LoginStateProvider()), ], child: MyApp())); } @@ -103,8 +103,13 @@ initialiseNotifications() async { print('Testing Push Notifications'); var pushNotificationsManager = PushNotificationsManager(); await pushNotificationsManager.init(); - await Calendarnotificationprovider.setDescription( - start: 'Time:- ', end: '', text: DynamicTextEventKeys.RangeTime); - await Calendarnotificationprovider.setTitle( - start: 'Event:- ', text: DynamicTextEventKeys.Title); + try { + await Calendarnotificationprovider.setPackageName('com.example.IITDAPP'); + await Calendarnotificationprovider.setDescription( + start: 'Time:- ', end: '', text: DynamicTextEventKeys.RangeTime); + await Calendarnotificationprovider.setTitle( + start: 'Event:- ', text: DynamicTextEventKeys.Title); + } on PlatformException { + print('Error Occured'); + } } diff --git a/lib/modules/calendar/calendar.dart b/lib/modules/calendar/calendar.dart index 7bf3d9e..d6d849e 100644 --- a/lib/modules/calendar/calendar.dart +++ b/lib/modules/calendar/calendar.dart @@ -202,6 +202,7 @@ class _CalendarScreenState extends State { data.id, RetrieveEventsParams( startDate: startDate, endDate: endDate)); + calendarModel.add(CalendarModel( id: data.id, name: data.name, diff --git a/lib/modules/calendar/screens/AppointmentEditor.dart b/lib/modules/calendar/screens/AppointmentEditor.dart index e8f1fa4..43f5e78 100644 --- a/lib/modules/calendar/screens/AppointmentEditor.dart +++ b/lib/modules/calendar/screens/AppointmentEditor.dart @@ -93,10 +93,10 @@ class AppointmentEditorState extends State { ), actions: [ TextButton( - child: Text('OK'), onPressed: () { Navigator.of(context).pop(); }, + child: Text('OK'), ), ]); }, @@ -329,27 +329,6 @@ class AppointmentEditorState extends State { textAlign: TextAlign.right, ))), ])), - // ListTile( - // contentPadding: const EdgeInsets.fromLTRB(5, 2, 5, 2), - // leading: Icon(Icons.lens, color: Color(_selectedColor)), - // title: Text( - // colorCollection[_selectedColorIndex] == Color(_selectedColor) - // ? colorNames[_selectedColorIndex] - // : '', - // style: TextStyle( - // color: - // Provider.of(context).theme.PRIMARY_TEXT_COLOR), - // ), - // onTap: () { - // showDialog( - // context: context, - // barrierDismissible: true, - // builder: (BuildContext context) { - // return _ColorPicker(); - // }, - // ).then((dynamic value) => setState(() {})); - // }, - // ), const Divider( height: 1.0, thickness: 1, @@ -461,35 +440,35 @@ class AppointmentEditorState extends State { .theme .PRIMARY_TEXT_COLOR .withOpacity(0.54)), - hintText: 'Add Attendee', + hintText: 'Add Attendees', ), ), ), - ListTile( - // Attendee - onTap: () { - showDialog( - context: context, - builder: (BuildContext context) => RecurrenceDialog(), - ).then((dynamic value) => setState(() {})); - }, - contentPadding: const EdgeInsets.all(5), - leading: Icon( - Icons.repeat, - color: Provider.of(context) - .theme - .PRIMARY_TEXT_COLOR - .withOpacity(0.87), - ), - title: Text( - 'Repeat', - style: TextStyle(fontSize: 18), - ), - subtitle: Text( - _recurrence, - style: TextStyle(color: Colors.green), - ), - ), + // ListTile( + // // Recurrence + // onTap: () { + // showDialog( + // context: context, + // builder: (BuildContext context) => RecurrenceDialog(), + // ).then((dynamic value) => setState(() {})); + // }, + // contentPadding: const EdgeInsets.all(5), + // leading: Icon( + // Icons.repeat, + // color: Provider.of(context) + // .theme + // .PRIMARY_TEXT_COLOR + // .withOpacity(0.87), + // ), + // title: Text( + // 'Repeat', + // style: TextStyle(fontSize: 18), + // ), + // subtitle: Text( + // _recurrence, + // style: TextStyle(color: Colors.green), + // ), + // ), ListTile( contentPadding: const EdgeInsets.all(5), leading: Icon( @@ -562,125 +541,130 @@ class AppointmentEditorState extends State { color: Colors.white, ), onPressed: () async { + // Update or Create Event + var isExternalCalendar = _selectedAppointment != null && + (_selectedAppointment.calendarId != IITDCalendarId || + _selectedAppointment.calendarId != + userEventsCalendarId || + _selectedAppointment.calendarId != + starredCalendarId); + + var isRecurring = _selectedAppointment != null && + _selectedAppointment.recurrence != null; + unawaited(showLoading(context, message: 'Loading')); - var meetings = []; - if (_selectedAppointment != null) { - _events.appointments.removeAt( - _events.appointments.indexOf(_selectedAppointment)); - _events.notifyListeners(CalendarDataSourceAction.remove, - [_selectedAppointment]); - calForceSetsState(); - } - var event = Event( - _selectedAppointment == null - ? userEventsCalendarId - : _selectedAppointment.calendarId, - start: _startDate, - end: _endDate); - if (_selectedAppointment != null) { - event.eventId = _selectedAppointment.eventId; - } - event.title = _subject == '' ? '(No title)' : _subject; - event.description = _notes; - event.location = _location; - event.attendees = getAttendeeList(_attendee); - event.reminders = getReminderList(_reminder); - event.allDay = _isAllDay; - event.startTimeZone = ''; - event.endTimeZone = ''; - event = addRecurrenceRule(_recurrence, event); - var res = await postReminder( - event, !(_selectedAppointment == null), - addToQueue: false); - if (res == 'error') { - print('server error occured'); + if (isRecurring && isExternalCalendar) { + print('You can quit now'); Navigator.pop(context); - ScaffoldMessenger.of(context).showSnackBar(SnackBar( - behavior: SnackBarBehavior.floating, - content: CustomSnackBarContent( - text: 'Server Error Occured', - ), - )); Navigator.pop(context); - return; - } - if (res == 'timeout') { - connectedToInternet = false; - ScaffoldMessenger.of(context).showSnackBar(SnackBar( - behavior: SnackBarBehavior.floating, - content: CustomSnackBarContent( - text: 'Unable to connect to server', - ), - )); - } - // event.availability = 'BUSY'; - var createEventResult = await DeviceCalendarPlugin() - .createOrUpdateEvent(event); - var prefs = await SharedPreferences.getInstance(); - if (createEventResult.isSuccess) { - if (res == 'timeout') { - QueueManager.addToList({ - 'func': 'postReminder', - 'event': createPostReminderBody(event), - 'patch': _selectedAppointment != null, - 'eventId': createEventResult.data - }); - } - if (res != '' && res != 'timeout' && res != 'error') { - await prefs.setString( - 'ser ' + res, 'loc ' + createEventResult.data); + } else { + var meetings = []; + if (_selectedAppointment != null) { + _events.appointments.removeAt(_events.appointments + .indexOf(_selectedAppointment)); + _events.notifyListeners( + CalendarDataSourceAction.remove, + [_selectedAppointment]); + calForceSetsState(); } + var event = Event( + _selectedAppointment == null + ? userEventsCalendarId + : _selectedAppointment.calendarId, + start: _startDate, + end: _endDate); if (_selectedAppointment != null) { - var id = prefs.getInt('rem' + createEventResult.data); - if (id != null && id != 0) { - await flutterLocalNotificationsPlugin.cancel(id); - } - await prefs.setInt('rem' + createEventResult.data, 0); + event.eventId = _selectedAppointment.eventId; } - if (event.reminders.isNotEmpty) { - var rnd = Random().nextInt(1000000000) + 1; - await prefs.setInt( - 'rem' + createEventResult.data, rnd); - var rem = event.start.subtract( - Duration(minutes: event.reminders[0].minutes)); - await _showNotificationWithDefaultSound( - title: event.title, - id: rnd, - description: 'Starts in ' + _reminder, - time: rem, - payload: generatePayload(event)); + event.title = _subject == '' ? '(No title)' : _subject; + event.description = _notes; + event.location = _location; + event.attendees = getAttendeeList(_attendee); + event.reminders = getReminderList(_reminder); + event.allDay = _isAllDay; + event.startTimeZone = ''; + event.endTimeZone = ''; + event = addRecurrenceRule(_recurrence, event); + var res = ''; + if (!isExternalCalendar) { + res = await postReminder( + event, !(_selectedAppointment == null), + addToQueue: false); + if (res == 'error') { + print('server error occured'); + Navigator.pop(context); + ScaffoldMessenger.of(context).showSnackBar(SnackBar( + behavior: SnackBarBehavior.floating, + content: CustomSnackBarContent( + text: 'Server Error Occured', + ), + )); + Navigator.pop(context); + return; + } + if (res == 'timeout') { + connectedToInternet = false; + ScaffoldMessenger.of(context).showSnackBar(SnackBar( + behavior: SnackBarBehavior.floating, + content: CustomSnackBarContent( + text: 'Unable to connect to server', + ), + )); + } } - meetings.add(Meeting( - eventId: createEventResult.data, - from: _startDate, - to: _endDate, - background: Color( - _selectedColor), //colorCollection[_selectedColorIndex], - startTimeZone: '', - endTimeZone: '', - location: _location, - attendee: event.attendees, - recurrence: event.recurrenceRule, - reminder: event.reminders, - calendarId: _selectedAppointment == null - ? userEventsCalendarId - : _selectedAppointment.calendarId, - description: _notes, - isAllDay: _isAllDay, - eventName: _subject == '' ? '(No title)' : _subject, - )); - print(meetings); - _events.appointments.add(meetings[0]); + // event.availability = 'BUSY'; + var createEventResult = await DeviceCalendarPlugin() + .createOrUpdateEvent(event); + var prefs = await SharedPreferences.getInstance(); + if (createEventResult.isSuccess) { + if (!isExternalCalendar) { + if (res == 'timeout') { + QueueManager.addToList({ + 'func': 'postReminder', + 'event': createPostReminderBody(event), + 'patch': _selectedAppointment != null, + 'eventId': createEventResult.data + }); + } + if (res != '' && + res != 'timeout' && + res != 'error') { + await prefs.setString('ser ' + res, + 'loc ' + createEventResult.data); + } + } + meetings.add(Meeting( + eventId: createEventResult.data, + from: _startDate, + to: _endDate, + background: Color( + _selectedColor), //colorCollection[_selectedColorIndex], + startTimeZone: '', + endTimeZone: '', + location: _location, + attendee: event.attendees, + recurrence: event.recurrenceRule, + reminder: event.reminders, + calendarId: _selectedAppointment == null + ? userEventsCalendarId + : _selectedAppointment.calendarId, + description: _notes, + isAllDay: _isAllDay, + eventName: _subject == '' ? '(No title)' : _subject, + )); + print(meetings); + _events.appointments.add(meetings[0]); - _events.notifyListeners(CalendarDataSourceAction.add, - [meetings[0]]); - _selectedAppointment = null; - calForceSetsState(); - } else { - print('error occured'); + _events.notifyListeners(CalendarDataSourceAction.add, + [meetings[0]]); + _selectedAppointment = null; + calForceSetsState(); + } else { + print('error occured'); + } + Navigator.pop(context); + Navigator.pop(context); } - Navigator.pop(context); - Navigator.pop(context); }) ], ), @@ -694,40 +678,50 @@ class AppointmentEditorState extends State { ? const Text('') : FloatingActionButton( onPressed: () async { - unawaited(showLoading(context, message: 'Loading')); - if (_selectedAppointment != null) { - var succ = await deleteReminderFromServer( - _selectedAppointment.eventId); - if (succ == -1) { - print('unable to connect to server'); - } else if (succ == 0) { - print('Error occured'); - return; - } - var res = await DeviceCalendarPlugin().deleteEvent( - _selectedAppointment.calendarId, - _selectedAppointment.eventId); - if (res.isSuccess) { - var prefs = await SharedPreferences.getInstance(); - var id = prefs - .getInt('rem' + _selectedAppointment.eventId); - if (id != null && id != 0) { - await flutterLocalNotificationsPlugin.cancel(id); + // Dlete the Given Appointment + var isExternalCalendar = + _selectedAppointment.calendarId != IITDCalendarId || + _selectedAppointment.calendarId != + starredCalendarId || + _selectedAppointment.calendarId != + userEventsCalendarId; + + var isRecurring = _selectedAppointment.recurrence != null; + if (isRecurring && isExternalCalendar) { + print('User shouldnt delete this'); + print('Show an appropriate Dialog and return'); + Navigator.pop(context); + // Navigator.pop(context); + } else { + unawaited(showLoading(context, message: 'Loading')); + if (_selectedAppointment != null) { + if (!isExternalCalendar) { + var succ = await deleteReminderFromServer( + _selectedAppointment.eventId); + if (succ == -1) { + print('unable to connect to server'); + } else if (succ == 0) { + print('Error occured'); + return; + } } - await prefs.setInt( - 'rem' + _selectedAppointment.eventId, 0); - _events.appointments.removeAt(_events.appointments - .indexOf(_selectedAppointment)); - _events.notifyListeners( - CalendarDataSourceAction.remove, - [_selectedAppointment]); - _selectedAppointment = null; - calForceSetsState(); - } else { - print('Error:- Could not delete event'); + var res = await DeviceCalendarPlugin().deleteEvent( + _selectedAppointment.calendarId, + _selectedAppointment.eventId); + if (res.isSuccess) { + _events.appointments.removeAt(_events.appointments + .indexOf(_selectedAppointment)); + _events.notifyListeners( + CalendarDataSourceAction.remove, + [_selectedAppointment]); + _selectedAppointment = null; + calForceSetsState(); + } else { + print('Error:- Could not delete event'); + } + Navigator.pop(context); + Navigator.pop(context); } - Navigator.pop(context); - Navigator.pop(context); } }, backgroundColor: Colors.red, @@ -743,7 +737,8 @@ class AppointmentEditorState extends State { Event addRecurrenceRule(var rule, Event event) { //verify this function - + // TODO: Currently Forced -> rule = recurrenceOptions[0] + rule = recurrenceOptions[0]; if (rule == null || rule == recurrenceOptions[0]) { return event; } @@ -764,7 +759,7 @@ Event addRecurrenceRule(var rule, Event event) { } List getAttendeeListFromList(var lis) { - var res = []; // ignore: prefer_collection_literals + var res = []; // ignore: prefer_collection_literals for (var i = 0; i < lis.length; i++) { if (lis[i] == '') { continue; @@ -775,7 +770,7 @@ List getAttendeeListFromList(var lis) { } List getAttendeeList(String str) { - var res = []; // ignore: prefer_collection_literals + var res = []; // ignore: prefer_collection_literals if (str == '' || str == null) { return res; } @@ -906,17 +901,17 @@ class _ReminderPickerState extends State { children: [ Spacer(), TextButton( - child: Text('CANCEL'), onPressed: () { Navigator.pop(context); }, + child: Text('CANCEL'), ), TextButton( - child: Text('SAVE'), onPressed: () { setReminder(time + ' ' + reminderUnits[type]); Navigator.pop(context); }, + child: Text('SAVE'), ), ], ) @@ -1001,17 +996,17 @@ class _RecurrenceDialogState extends State { children: [ Spacer(), TextButton( - child: Text('CANCEL'), onPressed: () { Navigator.pop(context); }, + child: Text('CANCEL'), ), TextButton( - child: Text('SAVE'), onPressed: () { setRecurrence(recurrenceOptions[type]); Navigator.pop(context); }, + child: Text('SAVE'), ), ], ) diff --git a/lib/modules/login/userlogin/login_page.dart b/lib/modules/login/userlogin/login_page.dart index 1d5ff00..c4aca94 100644 --- a/lib/modules/login/userlogin/login_page.dart +++ b/lib/modules/login/userlogin/login_page.dart @@ -19,8 +19,9 @@ import '../casi_user.dart'; void onLoginSuccess(BuildContext context, String newtoken) async { print('newtoken: $newtoken'); // ignore: unawaited_futures - if (!Provider.of(context, listen: false).loading) + if (!Provider.of(context, listen: false).loading) { showLoading(context); + } final storage = FlutterSecureStorage(); print('Getting User Info'); final response = await http @@ -38,8 +39,9 @@ void onLoginSuccess(BuildContext context, String newtoken) async { var topr = await storage.read(key: 'token'); print(topr); token = newtoken; - if (!Provider.of(context, listen: false).loading) + if (!Provider.of(context, listen: false).loading) { Navigator.pop(context); + } Provider.of(context, listen: false).signIn(); } else { print('Could not get user info.'); @@ -186,4 +188,4 @@ class LoginPageState extends State { // }, // ); // } -} \ No newline at end of file +} diff --git a/lib/modules/news/widgets/confirmationDialog.dart b/lib/modules/news/widgets/confirmationDialog.dart index aabb1c8..76d82bd 100644 --- a/lib/modules/news/widgets/confirmationDialog.dart +++ b/lib/modules/news/widgets/confirmationDialog.dart @@ -11,25 +11,25 @@ void showAlertDialog( @required String content}) { // set up the buttons Widget cancelButton = TextButton( + onPressed: () { + Navigator.of(context).pop(); + }, child: Text('Cancel', style: TextStyle( color: Provider.of(context, listen: false) .theme .ALERT_DIALOG_TEXT)), + ); + Widget actioButton = TextButton( onPressed: () { Navigator.of(context).pop(); + action(); }, - ); - Widget actioButton = TextButton( child: Text(actionName, style: TextStyle( color: Provider.of(context, listen: false) .theme .ALERT_DIALOG_TEXT)), - onPressed: () { - Navigator.of(context).pop(); - action(); - }, ); // set up the AlertDialog var alert = AlertDialog( diff --git a/lib/push_notifications.dart b/lib/push_notifications.dart index e0b150f..d582d0a 100644 --- a/lib/push_notifications.dart +++ b/lib/push_notifications.dart @@ -22,9 +22,9 @@ class PushNotificationsManager { // // For testing purposes print the Firebase Messaging token var token = await _firebaseMessaging.getToken(); // ignore: prefer_single_quotes - //print("FirebaseMessaging token: $token"); + print('FirebaseMessaging token: $token'); - //_initialized = true; + _initialized = true; } } } diff --git a/lib/values/Constants.dart b/lib/values/Constants.dart index a0ea78a..701790b 100644 --- a/lib/values/Constants.dart +++ b/lib/values/Constants.dart @@ -73,8 +73,8 @@ const String url = 'https://iitd-connect-server.herokuapp.com'; String title = 'IITD APP'; String token; bool connectedToInternet = true; -//User currentUser; - User currentUser = User(isAdmin: true,name: 'Riya Sawhney',email: 'cs1200374@iitd.ac.in'); +User currentUser; +// User currentUser = User(isAdmin: true,name: 'Riya Sawhney',email: 'cs1200374@iitd.ac.in'); final GlobalKey scaffoldKey = GlobalKey(); var logoutFunc; var loginFunc; diff --git a/pubspec.lock b/pubspec.lock index 909f2ba..de1bcb1 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -147,7 +147,7 @@ packages: name: date_format url: "https://pub.dartlang.org" source: hosted - version: "2.0.2" + version: "2.0.4" datetime_picker_formfield: dependency: "direct main" description: @@ -294,7 +294,7 @@ packages: name: flutter_calendar_carousel url: "https://pub.dartlang.org" source: hosted - version: "2.0.2" + version: "2.0.3" flutter_local_notifications: dependency: "direct main" description: @@ -694,21 +694,21 @@ packages: name: syncfusion_flutter_calendar url: "https://pub.dartlang.org" source: hosted - version: "19.2.49" + version: "19.2.55" syncfusion_flutter_core: dependency: transitive description: name: syncfusion_flutter_core url: "https://pub.dartlang.org" source: hosted - version: "19.2.49" + version: "19.2.55" syncfusion_flutter_datepicker: dependency: transitive description: name: syncfusion_flutter_datepicker url: "https://pub.dartlang.org" source: hosted - version: "19.2.49" + version: "19.2.55" synchronized: dependency: transitive description: @@ -834,7 +834,7 @@ packages: name: webview_flutter url: "https://pub.dartlang.org" source: hosted - version: "2.0.10" + version: "2.0.12" xml: dependency: transitive description: @@ -844,4 +844,4 @@ packages: version: "5.1.2" sdks: dart: ">=2.12.0 <3.0.0" - flutter: ">=2.0.0" \ No newline at end of file + flutter: ">=2.0.0" From 5392f2764f86b83ff63682ee307b5d01a73f9b53 Mon Sep 17 00:00:00 2001 From: Pranjal Aggarwal Date: Sun, 15 Aug 2021 13:48:18 +0530 Subject: [PATCH 2/3] Polish App --- analysis_options.yaml | 37 ++- lib/main.dart | 12 +- lib/modules/about/about.dart | 5 +- lib/modules/calendar/calendar.dart | 19 ++ .../calendar/screens/AppointmentEditor.dart | 39 +-- lib/modules/calendar/widgets/CustomModal.dart | 1 + .../discussionForum/screens/chat_screens.dart | 214 ++++++++-------- .../widgets/category_selector.dart | 70 +++--- .../discussionForum/widgets/recent_chats.dart | 228 +++++++++--------- .../events/events/event_info/star_button.dart | 3 + .../events/event_info/update_calendar.dart | 35 +++ lib/modules/events/manage/add_event_form.dart | 14 +- lib/modules/events/manage/edit_event.dart | 14 +- lib/modules/explore/widgets/AboutScreen.dart | 28 ++- lib/modules/login/userlogin/login_page.dart | 6 +- lib/modules/map/widgets/customSearchBar.dart | 22 +- lib/modules/news/screens/newsPage.dart | 36 +-- .../news/widgets/cards/recentNewsWidget.dart | 32 +-- .../quickLinks/screens/LinksScreen.dart | 1 + lib/modules/settings.rar | Bin 10686 -> 0 bytes lib/modules/settings/SettingsScreen.dart | 2 +- lib/utility/UrlHandler.dart | 16 ++ lib/values/Constants.dart | 13 + lib/widgets/choice_alert.dart | 46 ++++ pubspec.lock | 21 ++ pubspec.yaml | 3 + 26 files changed, 565 insertions(+), 352 deletions(-) create mode 100644 lib/modules/events/events/event_info/update_calendar.dart delete mode 100644 lib/modules/settings.rar create mode 100644 lib/widgets/choice_alert.dart diff --git a/analysis_options.yaml b/analysis_options.yaml index eefa3de..02b7500 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,4 +1,33 @@ -include: package:pedantic/analysis_options.yaml -# analyzer: -# errors: -# todo: ignore +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +include: package:flutter_lints/flutter.yaml + +analyzer: + errors: + todo: ignore + +linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at + # https://dart-lang.github.io/linter/lints/index.html. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. + rules: + # avoid_print: false # Uncomment to disable the `avoid_print` rule + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options \ No newline at end of file diff --git a/lib/main.dart b/lib/main.dart index 9d93153..b088fe2 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -17,6 +17,7 @@ import 'package:firebase_core/firebase_core.dart'; // import 'package:syncfusion_flutter_core/core.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:package_info/package_info.dart'; import 'package:pedantic/pedantic.dart'; import 'package:provider/provider.dart'; // import 'package:IITDAPP/modules/discussionForum/discuss.dart'; @@ -33,7 +34,7 @@ void main() async { // } catch (e) { // print('secrets.json file is required'); // } - + unawaited(extractAppVersion()); unawaited(initialiseNotifications()); unawaited(initialisePreferences()); await savedstate.init(); @@ -96,6 +97,15 @@ initialisePreferences() async { defaultScreen = res; } +// ignore: always_declare_return_types +extractAppVersion() async => + PackageInfo.fromPlatform().then((PackageInfo packageInfo) { + appName = packageInfo.appName; + packageName = packageInfo.packageName; + version = packageInfo.version; + buildNumber = packageInfo.buildNumber; + }); + // ignore: always_declare_return_types initialiseNotifications() async { print('Initialising Notifications'); diff --git a/lib/modules/about/about.dart b/lib/modules/about/about.dart index 18f9c93..5168149 100644 --- a/lib/modules/about/about.dart +++ b/lib/modules/about/about.dart @@ -3,6 +3,7 @@ import 'package:IITDAPP/modules/about/privacyPolicy.dart'; import 'package:IITDAPP/modules/about/releaseNotes.dart'; import 'package:IITDAPP/modules/settings/widgets/SettingsTextWidgets.dart'; import 'package:IITDAPP/utility/UrlHandler.dart'; +import 'package:IITDAPP/values/Constants.dart'; //import 'package:gradient_app_bar/gradient_app_bar.dart'; import 'package:provider/provider.dart'; import 'package:flutter/material.dart'; @@ -56,7 +57,7 @@ class AboutScreen extends StatelessWidget { ], )), Padding(padding: EdgeInsets.all(10)), - Text('1.2.3', + Text(version, style: TextStyle( fontSize: Theme.of(context).primaryTextTheme.headline6.fontSize, @@ -96,7 +97,7 @@ class AboutScreen extends StatelessWidget { text: 'Feedback', onTap: () { UrlHandler.startEmail('devclub.iitd@gmail.com', - subject: 'App Feedback', body: 'App Version 1.2.3'); + subject: 'App Feedback', body: 'App Version $version'); }, ), ], diff --git a/lib/modules/calendar/calendar.dart b/lib/modules/calendar/calendar.dart index d6d849e..68eac2e 100644 --- a/lib/modules/calendar/calendar.dart +++ b/lib/modules/calendar/calendar.dart @@ -5,6 +5,9 @@ import 'dart:math'; import 'package:IITDAPP/modules/calendar/data/CalendarModel.dart'; import 'package:IITDAPP/modules/settings/data/SettingsHandler.dart'; import 'package:IITDAPP/ThemeModel.dart'; +import 'package:IITDAPP/utility/UrlHandler.dart'; +import 'package:IITDAPP/widgets/choice_alert.dart'; +import 'package:IITDAPP/widgets/error_alert.dart'; import 'package:provider/provider.dart'; import 'package:IITDAPP/widgets/CustomAppBar.dart'; import 'package:IITDAPP/widgets/CustomSnackbar.dart'; @@ -374,6 +377,7 @@ class _CalendarScreenState extends State { dayFormat: 'EEE', monthCellStyle: MonthCellStyle( textStyle: TextStyle(fontSize: 17), + // ignore: deprecated_member_use todayTextStyle: TextStyle(fontSize: 17), ), ), @@ -393,6 +397,21 @@ class _CalendarScreenState extends State { key: scaffoldKey, appBar: CustomAppBar( title: Text('Calendar'), + actions: [ + IconButton( + icon: Icon(Icons.calendar_today), + iconSize: 30, + color: Colors.white, + onPressed: () async { + var openExternalCalendar = await showChoiceAlert( + context, + 'Open Calendar in Device Default', + 'Are you sure you want to open events in Device Calendar?', + UrlHandler.launchDeviceCalendar); + if (openExternalCalendar == null) {} + // Navigator.pop(context); + }), + ], ), drawer: AppDrawer(tag: 'Calendar'), floatingActionButton: Stack( diff --git a/lib/modules/calendar/screens/AppointmentEditor.dart b/lib/modules/calendar/screens/AppointmentEditor.dart index 43f5e78..16af1e0 100644 --- a/lib/modules/calendar/screens/AppointmentEditor.dart +++ b/lib/modules/calendar/screens/AppointmentEditor.dart @@ -103,22 +103,22 @@ class AppointmentEditorState extends State { ); } - Future _showNotificationWithDefaultSound( - {String title, - String description, - int id, - String payload, - DateTime time}) async { - var androidPlatformChannelSpecifics = AndroidNotificationDetails( - 'IITDAPP', 'IITD APP', 'IITD APP Calendar Events', - importance: Importance.Max, priority: Priority.High); - var iOSPlatformChannelSpecifics = IOSNotificationDetails(); - var platformChannelSpecifics = NotificationDetails( - androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); - await flutterLocalNotificationsPlugin.schedule( - id, title, description, time, platformChannelSpecifics, - payload: payload, androidAllowWhileIdle: true); - } + // Future _showNotificationWithDefaultSound( + // {String title, + // String description, + // int id, + // String payload, + // DateTime time}) async { + // var androidPlatformChannelSpecifics = AndroidNotificationDetails( + // 'IITDAPP', 'IITD APP', 'IITD APP Calendar Events', + // importance: Importance.Max, priority: Priority.High); + // var iOSPlatformChannelSpecifics = IOSNotificationDetails(); + // var platformChannelSpecifics = NotificationDetails( + // androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); + // await flutterLocalNotificationsPlugin.schedule( + // id, title, description, time, platformChannelSpecifics, + // payload: payload, androidAllowWhileIdle: true); + // } Widget _getAppointmentEditor(BuildContext context) { return Container( @@ -556,6 +556,8 @@ class AppointmentEditorState extends State { if (isRecurring && isExternalCalendar) { print('You can quit now'); Navigator.pop(context); + await showErrorAlert(context, 'Event Cannot be updated', + 'The event was added from external calendar, cannot be updated from this App!!!'); Navigator.pop(context); } else { var meetings = []; @@ -690,8 +692,11 @@ class AppointmentEditorState extends State { if (isRecurring && isExternalCalendar) { print('User shouldnt delete this'); print('Show an appropriate Dialog and return'); - Navigator.pop(context); // Navigator.pop(context); + await showErrorAlert(context, 'Event Cannot be deleted', + 'The event was added from external calendar, cannot be deleted from this App!!!'); + + Navigator.pop(context); } else { unawaited(showLoading(context, message: 'Loading')); if (_selectedAppointment != null) { diff --git a/lib/modules/calendar/widgets/CustomModal.dart b/lib/modules/calendar/widgets/CustomModal.dart index 0d7fdd5..353b000 100644 --- a/lib/modules/calendar/widgets/CustomModal.dart +++ b/lib/modules/calendar/widgets/CustomModal.dart @@ -172,6 +172,7 @@ class _CustomModalState extends State { child: Container( child: Column( children: [ + // ignore: missing_required_param ExpandablePanel( theme: const ExpandableThemeData( headerAlignment: diff --git a/lib/modules/discussionForum/screens/chat_screens.dart b/lib/modules/discussionForum/screens/chat_screens.dart index e45f70a..9c07eda 100644 --- a/lib/modules/discussionForum/screens/chat_screens.dart +++ b/lib/modules/discussionForum/screens/chat_screens.dart @@ -2,9 +2,9 @@ import 'package:flutter/material.dart'; import 'package:IITDAPP/modules/discussionForum/models/message_model.dart'; import 'package:IITDAPP/modules/discussionForum/models/user_model.dart'; + //package:IITDAPP/modules/events/home.dart class ChatScreen extends StatefulWidget { - final User user; ChatScreen({this.user}); @override @@ -12,148 +12,144 @@ class ChatScreen extends StatefulWidget { } class _ChatScreenState extends State { - - _buildMessage(Message message, bool isMe) - { + Container _buildMessage(Message message, bool isMe) { return Container( - margin: isMe? EdgeInsets.only( - top: 8, - bottom: 8, - left: 80, ):EdgeInsets.only( - top: 8, - bottom: 8, - right: 80, - ) , - padding: EdgeInsets.symmetric( - horizontal: 25, - vertical: 15, - ), - + margin: isMe + ? EdgeInsets.only( + top: 8, + bottom: 8, + left: 80, + ) + : EdgeInsets.only( + top: 8, + bottom: 8, + right: 80, + ), + padding: EdgeInsets.symmetric( + horizontal: 25, + vertical: 15, + ), + //child: //Text(message.text), decoration: BoxDecoration( - color: isMe?Colors.teal[100]: Colors.lightBlueAccent[100], - borderRadius: isMe? BorderRadius.only( - topLeft: Radius.circular(15), - bottomLeft: Radius.circular(15), - ): - BorderRadius.only( - topRight: Radius.circular(15), - bottomRight: Radius.circular(15), - ), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(message.time, + color: isMe ? Colors.teal[100] : Colors.lightBlueAccent[100], + borderRadius: isMe + ? BorderRadius.only( + topLeft: Radius.circular(15), + bottomLeft: Radius.circular(15), + ) + : BorderRadius.only( + topRight: Radius.circular(15), + bottomRight: Radius.circular(15), + ), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(message.time, style: TextStyle( color: Colors.blueGrey, fontSize: 16, fontWeight: FontWeight.w600, - - ) - ), - SizedBox(height: 8,), - Text(message.text, + )), + SizedBox( + height: 8, + ), + Text(message.text, style: TextStyle( color: Colors.blue[900], fontSize: 16, fontWeight: FontWeight.w600, - - ) - ), - ], - ), + )), + ], + ), ); } - _buildMessageComposer(){ + + Container _buildMessageComposer() { return Container( - padding: EdgeInsets.symmetric(horizontal: 8,), + padding: EdgeInsets.symmetric( + horizontal: 8, + ), height: 70, color: Colors.white, child: Row( children: [ - Expanded(child: TextField( - textCapitalization: TextCapitalization.sentences, - onChanged: (value) {}, - decoration: InputDecoration.collapsed( - hintText: 'Send a message...' + Expanded( + child: TextField( + textCapitalization: TextCapitalization.sentences, + onChanged: (value) {}, + decoration: + InputDecoration.collapsed(hintText: 'Send a message...'), ), ), - ), IconButton( - onPressed: (){}, - icon: Icon(Icons.photo), - iconSize: 25, - color: Colors.lightBlue, - ), + onPressed: () {}, + icon: Icon(Icons.photo), + iconSize: 25, + color: Colors.lightBlue, + ), ], ), - ); + ); } + @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.teal, appBar: AppBar( - title: Text( - widget.user.name, - style: TextStyle( - fontSize: 28, - fontWeight: FontWeight.bold, - ), + title: Text( + widget.user.name, + style: TextStyle( + fontSize: 28, + fontWeight: FontWeight.bold, + ), ), - elevation: 0.0, - actions: [ + elevation: 0.0, + actions: [ IconButton( - icon: Icon(Icons.more_horiz), - iconSize: 30, - color: Colors.white, - onPressed: (){} - - ), - ] - - ), + icon: Icon(Icons.more_horiz), + iconSize: 30, + color: Colors.white, + onPressed: () {}), + ]), body: GestureDetector( - onTap : ()=> FocusScope.of(context).unfocus(), - child: Column( - children: [ - Expanded( - child: Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.only( - topLeft: Radius.circular(30), - topRight: Radius.circular(30), - ), - ), - child: ClipRRect( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(30), - topRight: Radius.circular(30), - ), - child: ListView.builder( - reverse: true, - padding: EdgeInsets.only(top: 15 ), - itemCount: messages.length, - itemBuilder: (BuildContext context, int index){ - final Message message= messages[index]; - final bool isMe = message.sender.id == currentUser.id; + onTap: () => FocusScope.of(context).unfocus(), + child: Column( + children: [ + Expanded( + child: Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(30), + topRight: Radius.circular(30), + ), + ), + child: ClipRRect( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(30), + topRight: Radius.circular(30), + ), + child: ListView.builder( + reverse: true, + padding: EdgeInsets.only(top: 15), + itemCount: messages.length, + itemBuilder: (BuildContext context, int index) { + final message = messages[index]; + final isMe = message.sender.id == currentUser.id; return _buildMessage(message, isMe); - - }, - - ), - - ), - - ), - ), - _buildMessageComposer(), - ], - ), + }, + ), + ), + ), + ), + _buildMessageComposer(), + ], + ), ), ); } -} \ No newline at end of file +} diff --git a/lib/modules/discussionForum/widgets/category_selector.dart b/lib/modules/discussionForum/widgets/category_selector.dart index 1b4ed68..a3f8aa2 100644 --- a/lib/modules/discussionForum/widgets/category_selector.dart +++ b/lib/modules/discussionForum/widgets/category_selector.dart @@ -6,44 +6,42 @@ class CategorySelector extends StatefulWidget { } class _CategorySelectorState extends State { - - int selectedIndex= 0; - final List categories= ['Messages', 'online', 'Groups', 'Requests']; + int selectedIndex = 0; + final List categories = ['Messages', 'online', 'Groups', 'Requests']; @override Widget build(BuildContext context) { return Container( - height: 90, - color: Colors.deepPurpleAccent, - child: ListView.builder( - scrollDirection: Axis.horizontal, - itemCount: categories.length, - itemBuilder: (BuildContext context, int index){ - return GestureDetector( - onTap: (){ - setState((){ - selectedIndex= index; - } - - ); - }, - child: Padding( - padding: EdgeInsets.symmetric( - horizontal: 20, - vertical: 30 - ), - child: Text(categories[index], - style: TextStyle( - color: index== selectedIndex? Colors.limeAccent: Colors.white60, - fontSize: 24, - fontWeight: FontWeight.bold, - letterSpacing: 1.2, - ), - ), - ), - ); - return Text(categories[index]); + height: 90, + color: Colors.deepPurpleAccent, + child: ListView.builder( + scrollDirection: Axis.horizontal, + itemCount: categories.length, + itemBuilder: (BuildContext context, int index) { + return GestureDetector( + onTap: () { + setState(() { + selectedIndex = index; + }); }, - ) - ); + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 20, vertical: 30), + child: Text( + categories[index], + style: TextStyle( + color: index == selectedIndex + ? Colors.limeAccent + : Colors.white60, + fontSize: 24, + fontWeight: FontWeight.bold, + letterSpacing: 1.2, + ), + ), + ), + ); + // TODO: Take care of this + // ignore: dead_code + return Text(categories[index]); + }, + )); } -} \ No newline at end of file +} diff --git a/lib/modules/discussionForum/widgets/recent_chats.dart b/lib/modules/discussionForum/widgets/recent_chats.dart index b258e8a..9213e9e 100644 --- a/lib/modules/discussionForum/widgets/recent_chats.dart +++ b/lib/modules/discussionForum/widgets/recent_chats.dart @@ -8,127 +8,125 @@ class RecentChats extends StatelessWidget { @override Widget build(BuildContext context) { return Expanded( - child:Container( - - decoration:BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.only( - topLeft: Radius.circular(30), - topRight: Radius.circular(30), - ), - ), - child: ClipRect( - /*borderRadius: BorderRadius.only( + child: Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(30), + topRight: Radius.circular(30), + ), + ), + child: ClipRect( + /*borderRadius: BorderRadius.only( topLeft: Radius.circular(30), topRight: Radius.circular(30), ),*/ - child: ListView.builder( - itemCount: chats.length, - itemBuilder: (BuildContext context, int index){ - final Message chat= chats[index]; - return GestureDetector( - onTap: ()=> Navigator.push(context, MaterialPageRoute( - builder: (_) => ChatScreen( + child: ListView.builder( + itemCount: chats.length, + itemBuilder: (BuildContext context, int index) { + final chat = chats[index]; + return GestureDetector( + onTap: () => Navigator.push( + context, + MaterialPageRoute( + builder: (_) => ChatScreen( user: chat.sender, - - ), - ), - ), - child: Container( - margin: EdgeInsets.only(top: 5, - bottom: 5, - right: 20, - ), - padding: EdgeInsets.symmetric( - horizontal: 20, - vertical : 10, - ), - decoration: BoxDecoration( - color: chat.unread?Colors.lime[100]: Colors.white, - borderRadius: BorderRadius.only( - topRight: Radius.circular(20), - bottomRight: Radius.circular(20), - ), - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children:[ - CircleAvatar(radius: 35, - backgroundImage: AssetImage(chat.sender.imageUrl), - - ), - SizedBox( - width: 2, - ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - chat.sender.name, - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.grey, - fontSize: 15, - ) ), - SizedBox(height: 5.0), - Container( - width: MediaQuery.of(context).size.width*0.45, - child: Text( - chat.text, - style: TextStyle( - fontWeight: FontWeight.w600, - color: Colors.teal, - fontSize: 15, - ), - overflow: TextOverflow.ellipsis, - ), - ), - ], - ), - Column( - children: [ - Text(chat.time, - style: TextStyle( - color: Colors.grey, - fontSize: 15, - fontWeight: FontWeight.bold, - ), - ), - SizedBox(height: 5, - ), - chat.unread? Container( - width: 40, - height: 20, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(30), - color: Colors.red[100], - ), - alignment: Alignment.center, - child: Text('NEW', - style: TextStyle( - color: Colors.white, - fontSize: 12, - fontWeight: FontWeight.bold, - ), - ), - ): SizedBox.shrink(), - ], - ), - ], ), + ), + child: Container( + margin: EdgeInsets.only( + top: 5, + bottom: 5, + right: 20, ), - ); - - - - }, - - ), + padding: EdgeInsets.symmetric( + horizontal: 20, + vertical: 10, + ), + decoration: BoxDecoration( + color: chat.unread ? Colors.lime[100] : Colors.white, + borderRadius: BorderRadius.only( + topRight: Radius.circular(20), + bottomRight: Radius.circular(20), + ), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + CircleAvatar( + radius: 35, + backgroundImage: AssetImage(chat.sender.imageUrl), + ), + SizedBox( + width: 2, + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(chat.sender.name, + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.grey, + fontSize: 15, + )), + SizedBox(height: 5.0), + Container( + width: MediaQuery.of(context).size.width * 0.45, + child: Text( + chat.text, + style: TextStyle( + fontWeight: FontWeight.w600, + color: Colors.teal, + fontSize: 15, ), + overflow: TextOverflow.ellipsis, ), - ); - } - } - - + ), + ], + ), + Column( + children: [ + Text( + chat.time, + style: TextStyle( + color: Colors.grey, + fontSize: 15, + fontWeight: FontWeight.bold, + ), + ), + SizedBox( + height: 5, + ), + chat.unread + ? Container( + width: 40, + height: 20, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(30), + color: Colors.red[100], + ), + alignment: Alignment.center, + child: Text( + 'NEW', + style: TextStyle( + color: Colors.white, + fontSize: 12, + fontWeight: FontWeight.bold, + ), + ), + ) + : SizedBox.shrink(), + ], + ), + ], + ), + ), + ); + }, + ), + ), + ), + ); + } +} diff --git a/lib/modules/events/events/event_info/star_button.dart b/lib/modules/events/events/event_info/star_button.dart index 75a01f6..a3291ac 100644 --- a/lib/modules/events/events/event_info/star_button.dart +++ b/lib/modules/events/events/event_info/star_button.dart @@ -1,7 +1,9 @@ import 'package:IITDAPP/modules/events/EventsTabProvider.dart'; +import 'package:IITDAPP/modules/events/events/event_info/update_calendar.dart'; import 'package:IITDAPP/values/Constants.dart'; import 'package:IITDAPP/ThemeModel.dart'; +import 'package:pedantic/pedantic.dart'; import 'package:provider/provider.dart'; import 'package:flutter/material.dart'; import 'dart:async'; @@ -64,6 +66,7 @@ class StarButtonState extends State { } print(response.statusCode); if (response.statusCode == 200) { + unawaited(updateCalendar()); var parsedJson = json.decode(response.body); if (parsedJson['message'] == 'Successfully Starred') { Provider.of(context, listen: false) diff --git a/lib/modules/events/events/event_info/update_calendar.dart b/lib/modules/events/events/event_info/update_calendar.dart new file mode 100644 index 0000000..d05d843 --- /dev/null +++ b/lib/modules/events/events/event_info/update_calendar.dart @@ -0,0 +1,35 @@ +import 'package:IITDAPP/modules/calendar/calendar.dart'; +import 'package:device_calendar/device_calendar.dart'; + +// ignore: always_declare_return_types +updateCalendar() async { + var _deviceCalendarPlugin = DeviceCalendarPlugin(); + + var permissionsGranted = await _deviceCalendarPlugin.hasPermissions(); + if (permissionsGranted.isSuccess && !permissionsGranted.data) { + permissionsGranted = await _deviceCalendarPlugin.requestPermissions(); + if (!permissionsGranted.isSuccess || !permissionsGranted.data) { + return; + } + } + + await QueueManager.executeList(await QueueManager.getList()); + final calendarsResult = await _deviceCalendarPlugin.retrieveCalendars(); + + var _calendars = calendarsResult?.data; + _calendars.asMap().forEach((idx, data) { + Future _retrieveCalendarEvents() async { + final startDate = DateTime.now().add(Duration(days: -180)); + final endDate = DateTime.now().add(Duration(days: 180)); + if (data.name == 'IITD Connect') { + var calendarEventsResult = await _deviceCalendarPlugin.retrieveEvents( + data.id, + RetrieveEventsParams(startDate: startDate, endDate: endDate)); + getAllEvents(calendarEventsResult, 0, startDate, endDate); + } + starredCalendarId = data.id; + } + + _retrieveCalendarEvents(); + }); +} diff --git a/lib/modules/events/manage/add_event_form.dart b/lib/modules/events/manage/add_event_form.dart index b545574..eada171 100644 --- a/lib/modules/events/manage/add_event_form.dart +++ b/lib/modules/events/manage/add_event_form.dart @@ -362,13 +362,6 @@ class _EventFormState extends State { .theme .RAISED_BUTTON_BACKGROUND, ), - child: Text( - 'SUBMIT', - style: TextStyle( - color: Provider.of(context) - .theme - .RAISED_BUTTON_FOREGROUND), - ), onPressed: () async { if (_key.currentState.validate()) { _key.currentState.save(); @@ -392,6 +385,13 @@ class _EventFormState extends State { // ModalRoute.withName(Navigator.defaultRouteName)); } }, + child: Text( + 'SUBMIT', + style: TextStyle( + color: Provider.of(context) + .theme + .RAISED_BUTTON_FOREGROUND), + ), ), ], ), diff --git a/lib/modules/events/manage/edit_event.dart b/lib/modules/events/manage/edit_event.dart index 64bf442..936eb85 100644 --- a/lib/modules/events/manage/edit_event.dart +++ b/lib/modules/events/manage/edit_event.dart @@ -383,13 +383,6 @@ class _EditEventFormState extends State { .theme .RAISED_BUTTON_BACKGROUND, ), - child: Text( - 'SUBMIT', - style: TextStyle( - color: Provider.of(context) - .theme - .RAISED_BUTTON_FOREGROUND), - ), onPressed: () async { if (_key.currentState.validate()) { _key.currentState.save(); @@ -404,6 +397,13 @@ class _EditEventFormState extends State { Navigator.pop(context); } }, + child: Text( + 'SUBMIT', + style: TextStyle( + color: Provider.of(context) + .theme + .RAISED_BUTTON_FOREGROUND), + ), ), ], ), diff --git a/lib/modules/explore/widgets/AboutScreen.dart b/lib/modules/explore/widgets/AboutScreen.dart index c80063a..ca38826 100644 --- a/lib/modules/explore/widgets/AboutScreen.dart +++ b/lib/modules/explore/widgets/AboutScreen.dart @@ -1,3 +1,4 @@ +import 'package:IITDAPP/ThemeModel.dart'; import 'package:IITDAPP/modules/explore/data/ClubsData.dart'; import 'package:IITDAPP/utility/UrlHandler.dart'; import 'package:IITDAPP/widgets/CustomAppBar.dart'; @@ -10,6 +11,8 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:google_fonts/google_fonts.dart'; import 'dart:math' as math; +import 'package:provider/provider.dart'; + // ignore: must_be_immutable class AboutScreen extends StatelessWidget { AboutScreen( @@ -145,7 +148,9 @@ class SpeedDialSection extends StatelessWidget { child: FaIcon(FontAwesomeIcons.facebook), ), label: 'Visit FB Page', - labelStyle: TextStyle(color: Colors.black))); + labelStyle: TextStyle( + color: Provider.of(context).theme.PRIMARY_TEXT_COLOR, + ))); } if (links['insta'] != '') { list.add(SpeedDialChild( @@ -156,7 +161,9 @@ class SpeedDialSection extends StatelessWidget { child: FaIcon(FontAwesomeIcons.instagram), ), label: 'Visit Insta Page', - labelStyle: TextStyle(color: Colors.black))); + labelStyle: TextStyle( + color: Provider.of(context).theme.PRIMARY_TEXT_COLOR, + ))); } if (links['linkedin'] != '') { list.add(SpeedDialChild( @@ -167,7 +174,9 @@ class SpeedDialSection extends StatelessWidget { child: FaIcon(FontAwesomeIcons.linkedinIn), ), label: 'Visit LinkedIn Profile', - labelStyle: TextStyle(color: Colors.black))); + labelStyle: TextStyle( + color: Provider.of(context).theme.PRIMARY_TEXT_COLOR, + ))); } if (links['web'] != '') { list.add(SpeedDialChild( @@ -179,12 +188,15 @@ class SpeedDialSection extends StatelessWidget { scale: 0.5, child: SvgPicture.asset( 'assets/images/visit_web.svg', - color: Colors.black, + color: + Provider.of(context).theme.PRIMARY_TEXT_COLOR, ), ), ), label: 'Visit Website', - labelStyle: TextStyle(color: Colors.black))); + labelStyle: TextStyle( + color: Provider.of(context).theme.PRIMARY_TEXT_COLOR, + ))); } return list; @@ -268,7 +280,7 @@ class MemberCard extends StatelessWidget { Widget build(BuildContext context) { return Container( padding: EdgeInsets.all(10), - height: 120, + // height: 140, color: Colors.blueAccent, child: Row( mainAxisSize: MainAxisSize.max, @@ -313,7 +325,9 @@ class MemberCard extends StatelessWidget { Padding( padding: const EdgeInsets.only(left: 16), child: Text( - data.post, + (data.post.length > 20) + ? data.post.substring(0, 18) + '...' + : data.post, style: GoogleFonts.literata( color: Colors.redAccent, fontSize: 20, diff --git a/lib/modules/login/userlogin/login_page.dart b/lib/modules/login/userlogin/login_page.dart index c4aca94..26184d5 100644 --- a/lib/modules/login/userlogin/login_page.dart +++ b/lib/modules/login/userlogin/login_page.dart @@ -20,6 +20,7 @@ void onLoginSuccess(BuildContext context, String newtoken) async { print('newtoken: $newtoken'); // ignore: unawaited_futures if (!Provider.of(context, listen: false).loading) { + // ignore: unawaited_futures showLoading(context); } final storage = FlutterSecureStorage(); @@ -45,8 +46,9 @@ void onLoginSuccess(BuildContext context, String newtoken) async { Provider.of(context, listen: false).signIn(); } else { print('Could not get user info.'); - if (!Provider.of(context, listen: false).loading) + if (!Provider.of(context, listen: false).loading) { Navigator.pop(context); + } await showErrorAlert( context, 'Login Failed', 'Something went wrong. Please Try Again'); } @@ -80,6 +82,7 @@ Future login(BuildContext context, {bool pop = true}) async { title: Text('An Error Occured!'), content: Text(e.toString()), actions: [ + // ignore: deprecated_member_use FlatButton( onPressed: () => Navigator.of(context).pop(), child: Text('Try Again'), @@ -134,6 +137,7 @@ class LoginPageState extends State { children: [ SizedBox( width: MediaQuery.of(context).size.width * 0.8, + // ignore: deprecated_member_use child: FlatButton( color: Provider.of(context) .theme diff --git a/lib/modules/map/widgets/customSearchBar.dart b/lib/modules/map/widgets/customSearchBar.dart index b040c98..be769db 100644 --- a/lib/modules/map/widgets/customSearchBar.dart +++ b/lib/modules/map/widgets/customSearchBar.dart @@ -112,20 +112,20 @@ class _SearchBarState extends State with TickerProviderStateMixin { Padding( padding: EdgeInsets.only(right: 10), child: GestureDetector( - child: AnimatedIcon( - icon: AnimatedIcons.menu_arrow, - color: Provider.of(context, - listen: false) - .theme - .PRIMARY_TEXT_COLOR, - progress: _controller), onTap: () { if (!expanded) { Scaffold.of(context).openDrawer(); return; } toggleExpansion(); - }), + }, + child: AnimatedIcon( + icon: AnimatedIcons.menu_arrow, + color: Provider.of(context, + listen: false) + .theme + .PRIMARY_TEXT_COLOR, + progress: _controller)), ), Expanded( child: GestureDetector( @@ -158,14 +158,14 @@ class _SearchBarState extends State with TickerProviderStateMixin { ), ), GestureDetector( + onTap: () => (!expanded) + ? showAlert(context, logoutFunc) + : setState(() => resetSearch()), child: expanded ? Icon(Icons.cancel) : Transform.scale( scale: 1.8, child: FittedBox(child: PopupMenu())), - onTap: () => (!expanded) - ? showAlert(context, logoutFunc) - : setState(() => resetSearch()), ) ])), AnimatedContainer( diff --git a/lib/modules/news/screens/newsPage.dart b/lib/modules/news/screens/newsPage.dart index 27e0ea6..450b289 100644 --- a/lib/modules/news/screens/newsPage.dart +++ b/lib/modules/news/screens/newsPage.dart @@ -177,6 +177,13 @@ class NewsPage extends StatelessWidget { .RAISED_BUTTON_BACKGROUND .withOpacity(0.4), ), + onPressed: () { + if (syncItem.details.status == Status.COMPLETED) { + Navigator.of(context).push(MaterialPageRoute( + builder: (_) => ReportsList(syncItem, false), + )); + } + }, child: Text('View Reports', style: TextStyle( fontSize: 15, @@ -192,25 +199,8 @@ class NewsPage extends StatelessWidget { .theme .RAISED_BUTTON_FOREGROUND .withOpacity(0.4), - )), - onPressed: () { - if (syncItem.details.status == Status.COMPLETED) { - Navigator.of(context).push(MaterialPageRoute( - builder: (_) => ReportsList(syncItem, false), - )); - } - }), + ))), TextButton( - child: Text( - 'Report This Article', - style: TextStyle( - color: Theme.of(context) - .textTheme - .headline1 - .color - .withOpacity(0.54), - fontSize: 15), - ), onPressed: () async { final result = await Navigator.of(context).push(MaterialPageRoute( @@ -221,6 +211,16 @@ class NewsPage extends StatelessWidget { showSnackbarResult(result, Scaffold.of(context)); }, + child: Text( + 'Report This Article', + style: TextStyle( + color: Theme.of(context) + .textTheme + .headline1 + .color + .withOpacity(0.54), + fontSize: 15), + ), ), if (item.details.status == Status.COMPLETED) Container( diff --git a/lib/modules/news/widgets/cards/recentNewsWidget.dart b/lib/modules/news/widgets/cards/recentNewsWidget.dart index ed8b34f..320b2c6 100644 --- a/lib/modules/news/widgets/cards/recentNewsWidget.dart +++ b/lib/modules/news/widgets/cards/recentNewsWidget.dart @@ -46,6 +46,22 @@ class RecentWidget extends StatelessWidget { height: (width - 16) * 0.45 * 2 / 3, child: GestureDetector( behavior: HitTestBehavior.opaque, + onTap: () async { + Provider.of(context, listen: false) + .setViewed(item.id); + final result = await Navigator.push( + context, + MaterialPageRoute( + builder: (_) => NewsPage( + item: item, + imageTag: 'r${item.id}', + redirectPossible: true, + ), + ), + ); + + showSnackbarResult(result, parentScaffold); + }, child: Row(mainAxisAlignment: MainAxisAlignment.start, children: [ ClipRRect( borderRadius: BorderRadius.circular(5), @@ -148,22 +164,6 @@ class RecentWidget extends StatelessWidget { ), ) ]), - onTap: () async { - Provider.of(context, listen: false) - .setViewed(item.id); - final result = await Navigator.push( - context, - MaterialPageRoute( - builder: (_) => NewsPage( - item: item, - imageTag: 'r${item.id}', - redirectPossible: true, - ), - ), - ); - - showSnackbarResult(result, parentScaffold); - }, ), ), ); diff --git a/lib/modules/quickLinks/screens/LinksScreen.dart b/lib/modules/quickLinks/screens/LinksScreen.dart index 1a43d35..58d11fc 100644 --- a/lib/modules/quickLinks/screens/LinksScreen.dart +++ b/lib/modules/quickLinks/screens/LinksScreen.dart @@ -64,6 +64,7 @@ class LinksScreen extends StatelessWidget { ])), child: Column( children: [ + // ignore: missing_required_param ExpandablePanel( theme: const ExpandableThemeData( headerAlignment: ExpandablePanelHeaderAlignment.center, diff --git a/lib/modules/settings.rar b/lib/modules/settings.rar deleted file mode 100644 index 37ce49e225f03bcbf1d47d84f99bf02d75b46ffe..0000000000000000000000000000000000000000 GIT binary patch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M*&BX`mtJkBdd0 zy|&1}AR)=9M=M0)TS~V{16IOQa^!J;>g~Xog;UJHnXw_9saWbL za7I%c8Fs+Rpa^!d!{Q+Akrlxk#~VKw*g5vwK8s3S{sPMqO07H{ zXzO_1ixfk~2INRb7s}7^>KEkzVWc#69{*}FPRQ=(>>n!tGI_gQhINa%?d$lKSJlLU zVRD=$Ad5)(N0>h1umN#v00m7Qc_)zBBw; zEnW_h$j-_d8puR1Oi|P(b(ahh8VfL!Q`D=`h@1PAIkK(hA1h#%<=+tvA*s`zr66Yq z7ZPv#hq>BcoBobzs%Q2g6&Sa{#x77yuQM1vLInXBbxWm1W+=qAzcZk1grD<6zuyb$ z)w+|dkt)n2m9_VsObS&FKa=4kG5rNDdr`A79f8%E3PeH6mfyj>TMyBP^XMbC_s37K z^d{cS@V}@G#2e0AhW)jg*@Zv7 ze#;ka9&T0~L+;G(Xnu-^{52v-IzNo_aO#}MWW@(T5m%y9}vC4~TGIfK<55Aa)#Y8JVP^12e`rg_c7`kFF^)=8llgmP0wx;pEpIb9k5cU>b^; z7M`RhUa8IKvl1y1Qgerk1sUK^J0T_gTOpZ>$K>`&ZJ>oM$U+@4NZ8_HfzE(!3_^>N zI`r3inN2EDo^_E&4&#{~YdvUJg#7;~b~pfmaly%Lc$iz@QZ;mKNs`OaXGaU^WH zWd1n`p`7xL+|-#XYIcT}X(v9m6(d8jy*=HtQ { height: 5, ), SettingsTextButton( - subtitle: 'version 1.1.2', + subtitle: 'version $version', text: 'About', onTap: () { Navigator.push(context, diff --git a/lib/utility/UrlHandler.dart b/lib/utility/UrlHandler.dart index cecc6f7..7a57f7d 100644 --- a/lib/utility/UrlHandler.dart +++ b/lib/utility/UrlHandler.dart @@ -1,4 +1,5 @@ import 'package:url_launcher/url_launcher.dart'; +import 'dart:io' show Platform; class UrlHandler { static Future launchInBrowser(String url, {launchInApp = false}) async { @@ -18,6 +19,21 @@ class UrlHandler { } } + static Future launchDeviceCalendar() async { + var url = ''; + if (Platform.isAndroid) { + // Android-specific code + url = 'content://com.android.calendar/time/'; + } else if (Platform.isIOS) { + // iOS-specific code + // This should be tested for. + url = 'calshow://'; + } + if (await canLaunch(url)) { + await launch(url); + } + } + static Future makePhoneCall(String number) async { var url = 'tel:' + number; if (await canLaunch(url)) { diff --git a/lib/values/Constants.dart b/lib/values/Constants.dart index 701790b..173f72b 100644 --- a/lib/values/Constants.dart +++ b/lib/values/Constants.dart @@ -70,6 +70,19 @@ import 'package:flutter/material.dart'; // const String url = 'https://campusserver2.herokuapp.com/'; const String url = 'https://iitd-connect-server.herokuapp.com'; +// ignore: always_declare_return_types +// PackageInfo.fromPlatform().then((PackageInfo packageInfo) { +// String appName = packageInfo.appName; +// String packageName = packageInfo.packageName; +// String version = packageInfo.version; +// String buildNumber = packageInfo.buildNumber; +// }); + +String appName; +String packageName; +String version; +String buildNumber; + String title = 'IITD APP'; String token; bool connectedToInternet = true; diff --git a/lib/widgets/choice_alert.dart b/lib/widgets/choice_alert.dart new file mode 100644 index 0000000..30c27d6 --- /dev/null +++ b/lib/widgets/choice_alert.dart @@ -0,0 +1,46 @@ +import 'package:IITDAPP/ThemeModel.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +Future showChoiceAlert( + BuildContext context, String title, String message, var onYesFunction) { + return showDialog( + context: context, + builder: (BuildContext context) { + return AlertDialog( + backgroundColor: + Provider.of(context).theme.ALERT_DIALOG, + title: Text( + title, + style: TextStyle(color: Colors.white), + ), + content: Text( + message, + style: TextStyle(color: Colors.white), + ), + actions: [ + TextButton( + onPressed: () { + Navigator.of(context).pop(false); + }, + child: Text( + 'NO', + style: TextStyle(color: Colors.white70), + ), + ), + TextButton( + onPressed: () { + Navigator.pop(context); + onYesFunction(); + }, + child: Text( + 'YES', + style: TextStyle(color: Colors.white70), + ), + ) + ], + ); + }, + ) ?? + false; +} diff --git a/pubspec.lock b/pubspec.lock index de1bcb1..1810195 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -295,6 +295,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.3" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.4" flutter_local_notifications: dependency: "direct main" description: @@ -438,6 +445,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.6.1" + lints: + dependency: "direct dev" + description: + name: lints + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.1" localstorage: dependency: "direct main" description: @@ -494,6 +508,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.3.0" + package_info: + dependency: "direct main" + description: + name: package_info + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.2" path: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index f4af7d5..2f4bebf 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -72,6 +72,7 @@ dependencies: settings_ui: ^1.0.0 flare_flutter: ^3.0.2 flushbar: ^1.10.4 + package_info: ^2.0.2 calendarnotificationprovider: ^0.0.3 firebase_core: @@ -86,8 +87,10 @@ dependencies: cupertino_icons: ^1.0.0 dev_dependencies: + flutter_lints: ^1.0.4 flutter_test: sdk: flutter + lints: ^1.0.1 # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec From c6e4eb80b71657fe82faede95613990abc41d1f8 Mon Sep 17 00:00:00 2001 From: Pranjal Aggarwal Date: Sun, 15 Aug 2021 14:03:12 +0530 Subject: [PATCH 3/3] Remove Lint Issues --- lib/modules/roles/manage.dart | 2 +- lib/modules/roles/widgets/role.dart | 2 +- lib/modules/roles/widgets/user.dart | 3 ++- lib/modules/user-search/user.dart | 1 + 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/modules/roles/manage.dart b/lib/modules/roles/manage.dart index a0f60de..b8eeb82 100644 --- a/lib/modules/roles/manage.dart +++ b/lib/modules/roles/manage.dart @@ -5,7 +5,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:IITDAPP/widgets/CustomAppBar.dart'; import 'package:provider/provider.dart'; -import 'package:IITDAPP/modules/roles/widgets/user.dart'; +// import 'package:IITDAPP/modules/roles/widgets/user.dart'; import 'package:IITDAPP/modules/roles/data/data.dart'; class Manage extends StatefulWidget { diff --git a/lib/modules/roles/widgets/role.dart b/lib/modules/roles/widgets/role.dart index 9687949..c10fa52 100644 --- a/lib/modules/roles/widgets/role.dart +++ b/lib/modules/roles/widgets/role.dart @@ -1,4 +1,4 @@ -import 'package:IITDAPP/modules/courses/widgets/heading.dart'; +// import 'package:IITDAPP/modules/courses/widgets/heading.dart'; import 'package:flutter/material.dart'; import 'package:IITDAPP/modules/roles/data/data.dart'; import 'package:flutter/cupertino.dart'; diff --git a/lib/modules/roles/widgets/user.dart b/lib/modules/roles/widgets/user.dart index 2557685..ee1a051 100644 --- a/lib/modules/roles/widgets/user.dart +++ b/lib/modules/roles/widgets/user.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:IITDAPP/widgets/Drawer.dart'; +// import 'package:IITDAPP/widgets/Drawer.dart'; import 'package:IITDAPP/widgets/CustomAppBar.dart'; import 'package:provider/provider.dart'; import 'package:IITDAPP/ThemeModel.dart'; @@ -135,6 +135,7 @@ class _SearchScreenState extends State { duration: Duration(milliseconds: 500), margin: EdgeInsets.fromLTRB(20, 0, 10, 0), //color: Colors.red, + // ignore: deprecated_member_use child: FlatButton( onPressed: () => { FocusManager.instance.primaryFocus?.unfocus(), diff --git a/lib/modules/user-search/user.dart b/lib/modules/user-search/user.dart index d9b1bcd..40738ce 100644 --- a/lib/modules/user-search/user.dart +++ b/lib/modules/user-search/user.dart @@ -168,6 +168,7 @@ class _SearchScreenState extends State { duration: Duration(milliseconds: 500), margin: EdgeInsets.fromLTRB(20, 0, 10, 0), //color: Colors.red, + // ignore: deprecated_member_use child: FlatButton( onPressed: () => { FocusManager.instance.primaryFocus?.unfocus(),