diff --git a/.github/workflows/flutter.yml b/.github/workflows/flutter.yml index d00c83c..add364d 100644 --- a/.github/workflows/flutter.yml +++ b/.github/workflows/flutter.yml @@ -11,17 +11,17 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-java@v1 - with: - java-version: '12.x' - - uses: subosito/flutter-action@v1 - with: - flutter-version: '1.22.4' - # - run: flutter pub get - # - run: flutter test - # - run: flutter build apk - + - uses: actions/checkout@v2 + - uses: actions/setup-java@v1 + with: + java-version: '12.x' + - uses: subosito/flutter-action@v1 + with: + flutter-version: '2.0.6' + - run: flutter pub get + # - run: flutter test + # - run: flutter build apk + package-analysis: runs-on: ubuntu-latest diff --git a/android/app/src/debug/AndroidManifest.xml b/android/app/src/debug/AndroidManifest.xml index f0fe5aa..ad37917 100644 --- a/android/app/src/debug/AndroidManifest.xml +++ b/android/app/src/debug/AndroidManifest.xml @@ -3,5 +3,5 @@ - + diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index f5cee40..d660a10 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,6 +1,7 @@ - + + @@ -9,7 +10,7 @@ - + + android:name="io.flutter.embedding.android.NormalTheme" + android:resource="@style/NormalTheme" /> + android:name="io.flutter.embedding.android.SplashScreenDrawable" + android:resource="@drawable/launch_background" /> - - + + + diff --git a/android/app/src/profile/AndroidManifest.xml b/android/app/src/profile/AndroidManifest.xml index f0fe5aa..ad37917 100644 --- a/android/app/src/profile/AndroidManifest.xml +++ b/android/app/src/profile/AndroidManifest.xml @@ -3,5 +3,5 @@ - + diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json index d36b1fa..e882ab9 100644 --- a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -1,122 +1,122 @@ { - "images" : [ + "images": [ { - "size" : "20x20", - "idiom" : "iphone", - "filename" : "Icon-App-20x20@2x.png", - "scale" : "2x" + "size": "20x20", + "idiom": "iphone", + "filename": "Icon-App-20x20@2x.png", + "scale": "2x" }, { - "size" : "20x20", - "idiom" : "iphone", - "filename" : "Icon-App-20x20@3x.png", - "scale" : "3x" + "size": "20x20", + "idiom": "iphone", + "filename": "Icon-App-20x20@3x.png", + "scale": "3x" }, { - "size" : "29x29", - "idiom" : "iphone", - "filename" : "Icon-App-29x29@1x.png", - "scale" : "1x" + "size": "29x29", + "idiom": "iphone", + "filename": "Icon-App-29x29@1x.png", + "scale": "1x" }, { - "size" : "29x29", - "idiom" : "iphone", - "filename" : "Icon-App-29x29@2x.png", - "scale" : "2x" + "size": "29x29", + "idiom": "iphone", + "filename": "Icon-App-29x29@2x.png", + "scale": "2x" }, { - "size" : "29x29", - "idiom" : "iphone", - "filename" : "Icon-App-29x29@3x.png", - "scale" : "3x" + "size": "29x29", + "idiom": "iphone", + "filename": "Icon-App-29x29@3x.png", + "scale": "3x" }, { - "size" : "40x40", - "idiom" : "iphone", - "filename" : "Icon-App-40x40@2x.png", - "scale" : "2x" + "size": "40x40", + "idiom": "iphone", + "filename": "Icon-App-40x40@2x.png", + "scale": "2x" }, { - "size" : "40x40", - "idiom" : "iphone", - "filename" : "Icon-App-40x40@3x.png", - "scale" : "3x" + "size": "40x40", + "idiom": "iphone", + "filename": "Icon-App-40x40@3x.png", + "scale": "3x" }, { - "size" : "60x60", - "idiom" : "iphone", - "filename" : "Icon-App-60x60@2x.png", - "scale" : "2x" + "size": "60x60", + "idiom": "iphone", + "filename": "Icon-App-60x60@2x.png", + "scale": "2x" }, { - "size" : "60x60", - "idiom" : "iphone", - "filename" : "Icon-App-60x60@3x.png", - "scale" : "3x" + "size": "60x60", + "idiom": "iphone", + "filename": "Icon-App-60x60@3x.png", + "scale": "3x" }, { - "size" : "20x20", - "idiom" : "ipad", - "filename" : "Icon-App-20x20@1x.png", - "scale" : "1x" + "size": "20x20", + "idiom": "ipad", + "filename": "Icon-App-20x20@1x.png", + "scale": "1x" }, { - "size" : "20x20", - "idiom" : "ipad", - "filename" : "Icon-App-20x20@2x.png", - "scale" : "2x" + "size": "20x20", + "idiom": "ipad", + "filename": "Icon-App-20x20@2x.png", + "scale": "2x" }, { - "size" : "29x29", - "idiom" : "ipad", - "filename" : "Icon-App-29x29@1x.png", - "scale" : "1x" + "size": "29x29", + "idiom": "ipad", + "filename": "Icon-App-29x29@1x.png", + "scale": "1x" }, { - "size" : "29x29", - "idiom" : "ipad", - "filename" : "Icon-App-29x29@2x.png", - "scale" : "2x" + "size": "29x29", + "idiom": "ipad", + "filename": "Icon-App-29x29@2x.png", + "scale": "2x" }, { - "size" : "40x40", - "idiom" : "ipad", - "filename" : "Icon-App-40x40@1x.png", - "scale" : "1x" + "size": "40x40", + "idiom": "ipad", + "filename": "Icon-App-40x40@1x.png", + "scale": "1x" }, { - "size" : "40x40", - "idiom" : "ipad", - "filename" : "Icon-App-40x40@2x.png", - "scale" : "2x" + "size": "40x40", + "idiom": "ipad", + "filename": "Icon-App-40x40@2x.png", + "scale": "2x" }, { - "size" : "76x76", - "idiom" : "ipad", - "filename" : "Icon-App-76x76@1x.png", - "scale" : "1x" + "size": "76x76", + "idiom": "ipad", + "filename": "Icon-App-76x76@1x.png", + "scale": "1x" }, { - "size" : "76x76", - "idiom" : "ipad", - "filename" : "Icon-App-76x76@2x.png", - "scale" : "2x" + "size": "76x76", + "idiom": "ipad", + "filename": "Icon-App-76x76@2x.png", + "scale": "2x" }, { - "size" : "83.5x83.5", - "idiom" : "ipad", - "filename" : "Icon-App-83.5x83.5@2x.png", - "scale" : "2x" + "size": "83.5x83.5", + "idiom": "ipad", + "filename": "Icon-App-83.5x83.5@2x.png", + "scale": "2x" }, { - "size" : "1024x1024", - "idiom" : "ios-marketing", - "filename" : "Icon-App-1024x1024@1x.png", - "scale" : "1x" + "size": "1024x1024", + "idiom": "ios-marketing", + "filename": "Icon-App-1024x1024@1x.png", + "scale": "1x" } ], - "info" : { - "version" : 1, - "author" : "xcode" + "info": { + "version": 1, + "author": "xcode" } } diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json index 0bedcf2..781d7cd 100644 --- a/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json +++ b/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json @@ -1,23 +1,23 @@ { - "images" : [ + "images": [ { - "idiom" : "universal", - "filename" : "LaunchImage.png", - "scale" : "1x" + "idiom": "universal", + "filename": "LaunchImage.png", + "scale": "1x" }, { - "idiom" : "universal", - "filename" : "LaunchImage@2x.png", - "scale" : "2x" + "idiom": "universal", + "filename": "LaunchImage@2x.png", + "scale": "2x" }, { - "idiom" : "universal", - "filename" : "LaunchImage@3x.png", - "scale" : "3x" + "idiom": "universal", + "filename": "LaunchImage@3x.png", + "scale": "3x" } ], - "info" : { - "version" : 1, - "author" : "xcode" + "info": { + "version": 1, + "author": "xcode" } } diff --git a/lib/components/eureka_appbar.dart b/lib/components/eureka_appbar.dart index 6e7d9fe..ef35e31 100644 --- a/lib/components/eureka_appbar.dart +++ b/lib/components/eureka_appbar.dart @@ -19,7 +19,8 @@ class EurekaAppBar extends StatelessWidget implements PreferredSizeWidget { @override Widget build(BuildContext context) { return AppBar( - title: title is String ? Text(title) : title, //Text(title), + title: title is String ? Text(title) : title, + //Text(title), backgroundColor: Color(0xFF37474F), centerTitle: true, toolbarHeight: toolbarHeight, @@ -27,5 +28,5 @@ class EurekaAppBar extends StatelessWidget implements PreferredSizeWidget { ); } - Size get preferredSize => new Size.fromHeight(toolbarHeight); + Size get preferredSize => Size.fromHeight(toolbarHeight); } diff --git a/lib/components/eureka_list_view.dart b/lib/components/eureka_list_view.dart index 302cfc2..41d2a1d 100644 --- a/lib/components/eureka_list_view.dart +++ b/lib/components/eureka_list_view.dart @@ -11,6 +11,7 @@ class EurekaListView extends StatefulWidget { @required this.questionList, @required this.index, }); + @override _EurekaListViewState createState() => _EurekaListViewState(); } @@ -54,7 +55,7 @@ class _EurekaListViewState extends State { Column timeAndIsActiveRow(int index) { // this is used to format data to return " X days/hours/minutes ago" final dateTime = DateTime.parse(widget.questionList[index].questionDate) - .subtract(new Duration(hours: -7)); + .subtract(Duration(hours: -7)); return Column( children: [ diff --git a/lib/components/eureka_toggle_switch.dart b/lib/components/eureka_toggle_switch.dart index 5180e4b..b490970 100644 --- a/lib/components/eureka_toggle_switch.dart +++ b/lib/components/eureka_toggle_switch.dart @@ -12,6 +12,7 @@ class EurekaToggleSwitch extends StatefulWidget { @required this.initialLabelIndex, @required this.setState, }); + @override _EurekaToggleSwitchState createState() => _EurekaToggleSwitchState(); } diff --git a/lib/components/more_details_view.dart b/lib/components/more_details_view.dart index 6fe8d1c..9c41d0f 100644 --- a/lib/components/more_details_view.dart +++ b/lib/components/more_details_view.dart @@ -18,6 +18,7 @@ class MoreDetailsView extends StatefulWidget { this.userAnswerModel, @required this.isCurrUser, }); + @override _MoreDetailsViewState createState() => _MoreDetailsViewState(); } @@ -82,9 +83,8 @@ class _MoreDetailsViewState extends State { return Row( children: [ Text( - widget.isAnswer - ? "Answered: " - : "Asked: ", // This widget will build depending on if the component is for answers or question + widget.isAnswer ? "Answered: " : "Asked: ", + // This widget will build depending on if the component is for answers or question style: TextStyle( fontSize: widget.isAnswer ? 12.5 : 16.0, fontWeight: FontWeight.bold), diff --git a/lib/components/profile_answers_list.dart b/lib/components/profile_answers_list.dart index da8d136..e5f27f5 100644 --- a/lib/components/profile_answers_list.dart +++ b/lib/components/profile_answers_list.dart @@ -10,6 +10,7 @@ class ProfileAnswersView extends StatefulWidget { @required this.answersList, @required this.index, }); + @override _ProfileAnswersViewState createState() => _ProfileAnswersViewState(); } @@ -41,7 +42,7 @@ class _ProfileAnswersViewState extends State { Column timeAndIsActiveRow(int index) { // this is used to format data to return " X days/hours/minutes ago" final dateTime = DateTime.parse(widget.answersList[index].answerDate) - .subtract(new Duration(hours: -7)); + .subtract(Duration(hours: -7)); return Column( children: [ diff --git a/lib/components/side_menu.dart b/lib/components/side_menu.dart index 5e4df83..c0b2c91 100644 --- a/lib/components/side_menu.dart +++ b/lib/components/side_menu.dart @@ -10,6 +10,7 @@ import 'package:project_eureka_flutter/services/email_auth.dart'; class SideMenu extends StatefulWidget { final String title; + SideMenu({ this.title, }); @@ -20,7 +21,7 @@ class SideMenu extends StatefulWidget { class _SideMenuState extends State { bool loading = true; - UserModel user = new UserModel( + UserModel user = UserModel( firstName: '', lastName: '', email: '', diff --git a/lib/models/question_model.dart b/lib/models/question_model.dart index de054c4..84ed6b8 100644 --- a/lib/models/question_model.dart +++ b/lib/models/question_model.dart @@ -4,6 +4,7 @@ class QuestionModel { final String questionDate; final String description; final String category; + // for Lists (both for list of string and list of integers), use List, e final List mediaUrls; final bool closed; diff --git a/lib/screens/call_screens/call_ended_confirmation.dart b/lib/screens/call_screens/call_ended_confirmation.dart index d17d2d4..afae430 100644 --- a/lib/screens/call_screens/call_ended_confirmation.dart +++ b/lib/screens/call_screens/call_ended_confirmation.dart @@ -1,7 +1,6 @@ import 'package:flutter/material.dart'; class CallEnded extends StatelessWidget { - @override Widget build(BuildContext context) { return Scaffold( @@ -13,8 +12,7 @@ class CallEnded extends StatelessWidget { ), actions: [ FlatButton( - onPressed: () => Navigator.pop(context), - child: Text('Close')), + onPressed: () => Navigator.pop(context), child: Text('Close')), ], )); } diff --git a/lib/screens/call_screens/call_page.dart b/lib/screens/call_screens/call_page.dart index 95bd7f0..370f436 100644 --- a/lib/screens/call_screens/call_page.dart +++ b/lib/screens/call_screens/call_page.dart @@ -15,7 +15,8 @@ class CallPage extends StatefulWidget { final String action; // ChannelName is a combination of user id's (caller's + target's) - const CallPage({Key key, this.token, this.channelName, this.action}) : super(key: key); + const CallPage({Key key, this.token, this.channelName, this.action}) + : super(key: key); @override _CallPageState createState() => _CallPageState(); @@ -175,16 +176,18 @@ class _CallPageState extends State { crossAxisAlignment: CrossAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end, children: [ - if(userJoined == false) - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - if(widget.action == "call") - Text("Calling...", style: TextStyle(fontSize: 35.0, color: Colors.white)), - if(widget.action == "answer") - Text("Connecting...", style: TextStyle(fontSize: 35.0, color: Colors.white)), - ], - ), + if (userJoined == false) + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + if (widget.action == "call") + Text("Calling...", + style: TextStyle(fontSize: 35.0, color: Colors.white)), + if (widget.action == "answer") + Text("Connecting...", + style: TextStyle(fontSize: 35.0, color: Colors.white)), + ], + ), RawMaterialButton( onPressed: _onSwitchCamera, child: Icon( @@ -244,7 +247,6 @@ class _CallPageState extends State { ); } - void _onCallEnd(BuildContext context) { //callEnded = true; @@ -281,7 +283,7 @@ class _CallPageState extends State { Widget build(BuildContext context) { int count = 0; // if user clicks back button, alert if user wants to leave or stay in the call - return new WillPopScope( + return WillPopScope( onWillPop: () async { showDialog( context: context, @@ -299,8 +301,9 @@ class _CallPageState extends State { VideoCallService() .hungUpCaller(widget.channelName), Navigator.push( - context, - MaterialPageRoute(builder: (context) => CallEnded()), + context, + MaterialPageRoute( + builder: (context) => CallEnded()), ), ], child: Text('Leave')), diff --git a/lib/screens/chat_screens/chat_screen.dart b/lib/screens/chat_screens/chat_screen.dart index 9be1b78..74f200a 100644 --- a/lib/screens/chat_screens/chat_screen.dart +++ b/lib/screens/chat_screens/chat_screen.dart @@ -11,6 +11,7 @@ import 'package:project_eureka_flutter/services/users_service.dart'; import 'package:project_eureka_flutter/services/video_communication.dart'; import 'package:project_eureka_flutter/screens/more_details_page.dart'; import 'dart:math'; +import 'package:intl/intl.dart'; // Initialize global variable for channel name for the call receiver; accessible for in ChatScreen and MessageBubble classes String channelNameAnswer = ""; @@ -19,11 +20,12 @@ class ChatScreen extends StatefulWidget { final String fromId; final String recipient; final String questionId; + const ChatScreen({Key key, this.fromId, this.recipient, this.questionId}) : super(key: key); @override - _ChatScreenState createState() => new _ChatScreenState(); + _ChatScreenState createState() => _ChatScreenState(); } class _ChatScreenState extends State @@ -37,14 +39,18 @@ class _ChatScreenState extends State String messageText; String groupChatId; String userId; + // Initialize channel name on caller's side String channelNameCall = ""; + // initialize token on the caller's side that will be requested from the backend String _tokenCall = ""; + // used to get the user's firstName fir the system message when starting the call - UserModel user = new UserModel( + UserModel user = UserModel( firstName: '', ); + // Used for the animated video call button to turn off / turn on animation bool showAnimationButton; @@ -67,7 +73,7 @@ class _ChatScreenState extends State }); }); - _controller = new AnimationController( + _controller = AnimationController( vsync: this, ); _controller.repeat( @@ -92,7 +98,7 @@ class _ChatScreenState extends State break; } // listen to answerToken every 4 seconds - await Future.delayed(new Duration(seconds: 4)); + await Future.delayed(Duration(seconds: 4)); await VideoCallService().getTokenAnswer(channelNameAnswer).then( (payload) { if (!mounted) @@ -208,8 +214,8 @@ class _ChatScreenState extends State ? Container( alignment: Alignment(0, 0.15), child: CustomPaint( - painter: new SpritePainter(_controller), - child: new SizedBox( + painter: SpritePainter(_controller), + child: SizedBox( width: 80.0, height: 80.0, ), @@ -218,7 +224,7 @@ class _ChatScreenState extends State : Container( alignment: Alignment(0, 0.15), child: CustomPaint( - child: new SizedBox( + child: SizedBox( width: 80.0, height: 80.0, ), @@ -401,6 +407,7 @@ class MessageBubble extends StatelessWidget { this.isSystem, this.timestamp, this.showAnswerButton}); + final String sender; final String text; final bool isMe; @@ -551,17 +558,17 @@ class SpritePainter extends CustomPainter { void circle(Canvas canvas, Rect rect, double value) { double opacity = (1.0 - (value / 4.0)).clamp(0.0, 1.0); - Color color = new Color.fromRGBO(0, 117, 194, opacity); + Color color = Color.fromRGBO(0, 117, 194, opacity); double size = rect.width / 2; double area = size * size; double radius = sqrt(area * value / 4); - final Paint paint = new Paint()..color = color; + final Paint paint = Paint()..color = color; canvas.drawCircle(rect.center, radius, paint); } @override void paint(Canvas canvas, Size size) { - Rect rect = new Rect.fromLTRB(0.0, 0.0, size.width, size.height); + Rect rect = Rect.fromLTRB(0.0, 0.0, size.width, size.height); for (int wave = 3; wave >= 0; wave--) { circle(canvas, rect, wave + _animation.value); } diff --git a/lib/screens/chat_screens/user_chats.dart b/lib/screens/chat_screens/user_chats.dart index baa554c..93e6fa7 100644 --- a/lib/screens/chat_screens/user_chats.dart +++ b/lib/screens/chat_screens/user_chats.dart @@ -94,6 +94,7 @@ Future initGetUserDetails(recipientId) async { class ConversationBubble extends StatelessWidget { ConversationBubble({this.recipientId, this.questionTitle, this.questionId}); + final String recipientId; final String questionTitle; final String questionId; diff --git a/lib/screens/forgot_password.dart b/lib/screens/forgot_password.dart index 8373ecb..f46cb5a 100644 --- a/lib/screens/forgot_password.dart +++ b/lib/screens/forgot_password.dart @@ -12,9 +12,9 @@ class ForgotPassword extends StatefulWidget { class _ForgotpasswordState extends State { final GlobalKey _formKey = GlobalKey(); - EmailAuth _emailAuth = new EmailAuth(); + EmailAuth _emailAuth = EmailAuth(); FirebaseExceptionHandler _firebaseExceptionHandler = - new FirebaseExceptionHandler(); + FirebaseExceptionHandler(); String _email; String _exception = ""; diff --git a/lib/screens/home_screen.dart b/lib/screens/home_screen.dart index cb9e5d4..aa71353 100644 --- a/lib/screens/home_screen.dart +++ b/lib/screens/home_screen.dart @@ -16,16 +16,21 @@ class _HomeState extends State { //Made for testing purposes. Used to see if the Users Will Properly show on the home page UserModel user; String userId = EmailAuth().getCurrentUser().uid; + // Questions data. Unfiltered list of questions List data = []; + // Will filter the list of questions List questionsListFiltered = []; + // These lists will help to filter questions by both search key and category simultaneously // Might be inefficient to use that many lists around, thus, this might change in the future versions to something more dynamic and efficient List questionsListFilteredCategory = []; List questionsListFilteredSearch = []; + // isSearching keep track of whether search bar is activated or not. Search bar will appear if user clicked a search icon. bool isSearching = false; + // Keeps track of the last chosen category. By default is All Categories. String selectedCategory = "All Categories"; String dropdownValue = 'All Categories'; @@ -33,6 +38,7 @@ class _HomeState extends State { /// ///for chat screen testing purposes String fromId = "hJGcQsILP7XQDSvWY2Qx2k3MD0V2"; + // Get data from the database to the list. Questions are shown on home page is always questionsListFiltered, // which at this point is a copy of a `data`, as no filters have been applied yet @override @@ -321,8 +327,8 @@ class _HomeState extends State { Widget build(BuildContext context) { return Scaffold( drawer: SideMenu(), - resizeToAvoidBottomInset: - false, // fixed: "Create New Question" button was moving up while in keyboard mode + resizeToAvoidBottomInset: false, + // fixed: "Create New Question" button was moving up while in keyboard mode appBar: homeAppBar(), // List of questions and a category filter diff --git a/lib/screens/more_details_page.dart b/lib/screens/more_details_page.dart index 7751111..45913ed 100644 --- a/lib/screens/more_details_page.dart +++ b/lib/screens/more_details_page.dart @@ -39,6 +39,7 @@ class _MoreDetailsState extends State { ); UserModel user; final String currUserId = EmailAuth().getCurrentUser().uid; + //UserModel currUser; @override diff --git a/lib/screens/new_form_screens/new_form.dart b/lib/screens/new_form_screens/new_form.dart index 9a0179b..1706375 100644 --- a/lib/screens/new_form_screens/new_form.dart +++ b/lib/screens/new_form_screens/new_form.dart @@ -66,8 +66,8 @@ class _NewFormState extends State { : 'Please explain in detail your question...', keyboardType: TextInputType.multiline, textInputAction: TextInputAction.done, - maxLines: - widget.isAnswer ? 15 : 10, // make body form bigger when answer + maxLines: widget.isAnswer ? 15 : 10, + // make body form bigger when answer errValidatorMsg: widget.isAnswer ? 'Answer body is required.' : 'Question body is required.', @@ -169,7 +169,7 @@ class _NewFormState extends State { if (widget.isAnswer) { /// builds answers model setState(() { - _answer = new AnswerModel( + _answer = AnswerModel( id: _id, mediaUrls: downloadUrls, answerDate: _date.toIso8601String(), @@ -185,11 +185,11 @@ class _NewFormState extends State { /// builds question model /// Create new Object to be sent to backend. setState(() { - _question = new QuestionModel( + _question = QuestionModel( id: _id, title: _title, - questionDate: - _date.toIso8601String(), // format date to add `T` character + questionDate: _date.toIso8601String(), + // format date to add `T` character description: _body, mediaUrls: downloadUrls, category: widget.categoryName, diff --git a/lib/screens/profile_onboarding_screen.dart b/lib/screens/profile_onboarding_screen.dart index f46f944..20419b9 100644 --- a/lib/screens/profile_onboarding_screen.dart +++ b/lib/screens/profile_onboarding_screen.dart @@ -173,21 +173,22 @@ class _ProfileOnboardingState extends State { User _firebaseUser = EmailAuth().getCurrentUser(); ProfileOnboardingService _profileOnboardingService = - new ProfileOnboardingService(); + ProfileOnboardingService(); List mediaUrl = []; if (mediaPath != '') { mediaUrl = await uploadFiles(); } /// Create the user object to be sent out. - UserModel user = new UserModel( + UserModel user = UserModel( id: _firebaseUser.uid, firstName: _firstName, lastName: _lastName, firebaseUuid: _firebaseUser.uid, email: _firebaseUser.email, city: '', - category: [], //we don't have form field for this + category: [], + //we don't have form field for this pictureUrl: mediaUrl.length == 0 ? '' : mediaUrl[0], role: _role, ratings: [], diff --git a/lib/screens/profile_screen.dart b/lib/screens/profile_screen.dart index da51a24..04008fc 100644 --- a/lib/screens/profile_screen.dart +++ b/lib/screens/profile_screen.dart @@ -19,7 +19,7 @@ class _ProfileState extends State { int _tab = 0; List questionsList = []; List answersList = []; - UserModel userInfo = new UserModel(); + UserModel userInfo = UserModel(); List categories = []; bool loading = true; diff --git a/lib/screens/rating_screen.dart b/lib/screens/rating_screen.dart index 65f0674..c317f47 100644 --- a/lib/screens/rating_screen.dart +++ b/lib/screens/rating_screen.dart @@ -72,7 +72,10 @@ class _RatingState extends State { widget.userInfo.lastName, 24.0), _ratingBar(_ratingBarMode), - ratingNotChosenError ? Text("Please choose rating", style: TextStyle(color: Colors.red)) : Text("") + ratingNotChosenError + ? Text("Please choose rating", + style: TextStyle(color: Colors.red)) + : Text("") ], ), SizedBox( @@ -105,8 +108,7 @@ class _RatingState extends State { //Rates the current user for now until the answer page is created Future _submit() async { await _closeQuestion(); - RatingModel rating = - new RatingModel(id: widget.userInfo.id, rating: _rating); + RatingModel rating = RatingModel(id: widget.userInfo.id, rating: _rating); try { await RatingService().updateRating(rating); } catch (e) { diff --git a/lib/screens/settings/account/account_settings_delete.dart b/lib/screens/settings/account/account_settings_delete.dart index c2f192d..4df007f 100644 --- a/lib/screens/settings/account/account_settings_delete.dart +++ b/lib/screens/settings/account/account_settings_delete.dart @@ -14,7 +14,7 @@ class AccountSettingsDelete extends StatefulWidget { class _AccountSettingsDeleteState extends State { final GlobalKey _formKey = GlobalKey(); - final EmailAuth _emailAuth = new EmailAuth(); + final EmailAuth _emailAuth = EmailAuth(); String _password; diff --git a/lib/screens/settings/account/account_settings_email.dart b/lib/screens/settings/account/account_settings_email.dart index cbf1901..025eccf 100644 --- a/lib/screens/settings/account/account_settings_email.dart +++ b/lib/screens/settings/account/account_settings_email.dart @@ -11,7 +11,7 @@ class AccountSettingsEmail extends StatefulWidget { class _AccountSettingsEmailState extends State { final GlobalKey _formKey = GlobalKey(); - final EmailAuth _emailAuth = new EmailAuth(); + final EmailAuth _emailAuth = EmailAuth(); String email; static final RegExp _regExp = RegExp( r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+"); diff --git a/lib/screens/settings/account/account_settings_password.dart b/lib/screens/settings/account/account_settings_password.dart index 0bc26fd..95ebafe 100644 --- a/lib/screens/settings/account/account_settings_password.dart +++ b/lib/screens/settings/account/account_settings_password.dart @@ -16,8 +16,8 @@ class _AccountSettingsPasswordState extends State { final RegExp _passwordValid = RegExp(r'^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[!@#\$&*~]).{8,}$'); - FirebaseExceptionHandler _exceptionHandler = new FirebaseExceptionHandler(); - EmailAuth _emailAuth = new EmailAuth(); + FirebaseExceptionHandler _exceptionHandler = FirebaseExceptionHandler(); + EmailAuth _emailAuth = EmailAuth(); String currentPassword; String newPassword; diff --git a/lib/screens/settings/payment/payment_confirmation.dart b/lib/screens/settings/payment/payment_confirmation.dart index 52c981c..cc949b0 100644 --- a/lib/screens/settings/payment/payment_confirmation.dart +++ b/lib/screens/settings/payment/payment_confirmation.dart @@ -1,7 +1,6 @@ import 'package:flutter/material.dart'; class PaymentConfirmation extends StatelessWidget { - @override Widget build(BuildContext context) { var count = 0; @@ -18,7 +17,8 @@ class PaymentConfirmation extends StatelessWidget { ), actions: [ FlatButton( - onPressed: () => Navigator.popUntil(context, (route) { // pop the last 2 routes to get back to payment settings + onPressed: () => Navigator.popUntil(context, (route) { + // pop the last 2 routes to get back to payment settings return count++ == 2; }), child: Text('Close')), diff --git a/lib/screens/settings/settings_general.dart b/lib/screens/settings/settings_general.dart index 44f7bff..e3cdd3f 100644 --- a/lib/screens/settings/settings_general.dart +++ b/lib/screens/settings/settings_general.dart @@ -10,8 +10,7 @@ class SettingsGeneral extends StatefulWidget { /// This is the private State class that goes with MyStatefulWidget. class _SettingsGeneral extends State { - SharedPreferencesHelper sharedPreferencesHelper = - new SharedPreferencesHelper(); + SharedPreferencesHelper sharedPreferencesHelper = SharedPreferencesHelper(); // initialized three settings bool _darkMode = false; diff --git a/lib/screens/settings_screen.dart b/lib/screens/settings_screen.dart index b6c8537..ba0b87f 100644 --- a/lib/screens/settings_screen.dart +++ b/lib/screens/settings_screen.dart @@ -9,7 +9,7 @@ import 'package:project_eureka_flutter/screens/settings/settings_payment.dart'; import 'package:project_eureka_flutter/services/email_auth.dart'; class Settings extends StatelessWidget { - final EmailAuth _emailAuth = new EmailAuth(); + final EmailAuth _emailAuth = EmailAuth(); final String title = 'Settings'; diff --git a/lib/screens/signin_screen.dart b/lib/screens/signin_screen.dart index ae7c30c..62794ae 100644 --- a/lib/screens/signin_screen.dart +++ b/lib/screens/signin_screen.dart @@ -15,10 +15,10 @@ class SignIn extends StatefulWidget { class _SignInState extends State { GlobalKey _formKey = GlobalKey(); - EmailAuth _emailAuth = new EmailAuth(); - GoogleAuth _googleAuth = new GoogleAuth(); + EmailAuth _emailAuth = EmailAuth(); + GoogleAuth _googleAuth = GoogleAuth(); FirebaseExceptionHandler _firebaseExceptionHandler = - new FirebaseExceptionHandler(); + FirebaseExceptionHandler(); String email; String password; diff --git a/lib/screens/signup_screen.dart b/lib/screens/signup_screen.dart index ae0efcc..63d10b9 100644 --- a/lib/screens/signup_screen.dart +++ b/lib/screens/signup_screen.dart @@ -14,9 +14,9 @@ class SignUp extends StatefulWidget { class _SignUpState extends State { final GlobalKey _formKey = GlobalKey(); - EmailAuth _emailAuth = new EmailAuth(); + EmailAuth _emailAuth = EmailAuth(); FirebaseExceptionHandler _firebaseExceptionHandler = - new FirebaseExceptionHandler(); + FirebaseExceptionHandler(); String _userEmail; String _password; diff --git a/lib/services/all_question_service.dart b/lib/services/all_question_service.dart index 9410b96..843378c 100644 --- a/lib/services/all_question_service.dart +++ b/lib/services/all_question_service.dart @@ -9,8 +9,8 @@ class AllQuestionService { Future> getQuestions() async { await DotEnv.load(); - final response = await http.get(Uri.http( - DotEnv.env['HOST'] + ':' + DotEnv.env['PORT'], '/v1/questions')); + final response = + await http.get(Uri.https(DotEnv.env['HOST'], '/v1/questions')); if (response.statusCode == 200) { // If the server did return a 200 OK response, then parse the JSON. @@ -22,8 +22,8 @@ class AllQuestionService { final body = json.decode(response.body); print("All questions were loaded"); - List questionsActive = new List(); - List questionsClosed = new List(); + List questionsActive = []; + List questionsClosed = []; body.reversed.forEach((question) { if (question['visible']) { @@ -33,8 +33,7 @@ class AllQuestionService { } }); - return new List.from(questionsActive) - ..addAll(questionsClosed); + return List.from(questionsActive)..addAll(questionsClosed); } else { throw Exception('Failed to load questions'); } diff --git a/lib/services/close_question_service.dart b/lib/services/close_question_service.dart index 2bde99f..9be0c04 100644 --- a/lib/services/close_question_service.dart +++ b/lib/services/close_question_service.dart @@ -8,19 +8,16 @@ class CloseQuestionService { await DotEnv.load(); return await http.put( - Uri.http(DotEnv.env['HOST'] + ':' + DotEnv.env['PORT'], - '/v1/question/$questionId/close'), + Uri.https(DotEnv.env['HOST'], '/v1/question/$questionId/close'), body: answerId, ); } - Future archiveQuestion( - String questionId) async { + Future archiveQuestion(String questionId) async { await DotEnv.load(); return await http.put( - Uri.http(DotEnv.env['HOST'] + ':' + DotEnv.env['PORT'], - '/v1/questions/$questionId/archive'), + Uri.https(DotEnv.env['HOST'], '/v1/questions/$questionId/archive'), ); } } diff --git a/lib/services/delete_user_service.dart b/lib/services/delete_user_service.dart index c65291f..6075bb0 100644 --- a/lib/services/delete_user_service.dart +++ b/lib/services/delete_user_service.dart @@ -7,11 +7,11 @@ class DeleteUserService { Future deleteUser(String id) async { await DotEnv.load(); return await http.put( - Uri.http(DotEnv.env['HOST'] + ':' + DotEnv.env['PORT'], '/v1/user/delete/$id'), + Uri.https(DotEnv.env['HOST'], '/v1/user/delete/$id'), headers: { 'Content-type': 'application/json; charset=UTF-8', }, body: jsonEncode(null), ); } -} \ No newline at end of file +} diff --git a/lib/services/more_detail_service.dart b/lib/services/more_detail_service.dart index 4aba74d..759aeb5 100644 --- a/lib/services/more_detail_service.dart +++ b/lib/services/more_detail_service.dart @@ -10,8 +10,7 @@ class MoreDetailService { await DotEnv.load(); final http.Response response = await http.get( - Uri.http(DotEnv.env['HOST'] + ':' + DotEnv.env['PORT'], - 'v1/questions/$questionId/details'), + Uri.https(DotEnv.env['HOST'], 'v1/questions/$questionId/details'), ); MoreDetailModel moreDetailModel = diff --git a/lib/services/new_answer_service.dart b/lib/services/new_answer_service.dart index 762ce75..22f1229 100644 --- a/lib/services/new_answer_service.dart +++ b/lib/services/new_answer_service.dart @@ -9,8 +9,8 @@ class NewAnswerService { await DotEnv.load(); final response = await http.post( - Uri.http( - DotEnv.env['HOST'] + ':' + DotEnv.env['PORT'], + Uri.https( + DotEnv.env['HOST'], '/v1/answers', ), headers: { diff --git a/lib/services/new_question_service.dart b/lib/services/new_question_service.dart index eb145bd..a5d346f 100644 --- a/lib/services/new_question_service.dart +++ b/lib/services/new_question_service.dart @@ -9,8 +9,8 @@ class NewQuestionService { await DotEnv.load(); final response = await http.post( - Uri.http( - DotEnv.env['HOST'] + ':' + DotEnv.env['PORT'], + Uri.https( + DotEnv.env['HOST'], '/v1/questions/', ), headers: { diff --git a/lib/services/profile_onboarding_service.dart b/lib/services/profile_onboarding_service.dart index cc08214..cc18ff9 100644 --- a/lib/services/profile_onboarding_service.dart +++ b/lib/services/profile_onboarding_service.dart @@ -9,8 +9,8 @@ class ProfileOnboardingService { await DotEnv.load(); return http.post( - Uri.http( - DotEnv.env['HOST'] + ':' + DotEnv.env['PORT'], + Uri.https( + DotEnv.env['HOST'], '/v1/users', ), headers: { @@ -26,8 +26,8 @@ class ProfileOnboardingService { await DotEnv.load(); return http.put( - Uri.http( - DotEnv.env['HOST'] + ':' + DotEnv.env['PORT'], + Uri.https( + DotEnv.env['HOST'], '/v1/users/$userId', ), headers: { diff --git a/lib/services/profile_service.dart b/lib/services/profile_service.dart index 3edfb27..b525e43 100644 --- a/lib/services/profile_service.dart +++ b/lib/services/profile_service.dart @@ -11,9 +11,8 @@ class ProfileService { // profile id will be changed to the current user id associated with firebase id await DotEnv.load(); - final response = await http.get(Uri.http( - DotEnv.env['HOST'] + ':' + DotEnv.env['PORT'], - '/v1/profile/' + userID)); + final response = + await http.get(Uri.https(DotEnv.env['HOST'], '/v1/profile/' + userID)); if (response.statusCode == 200) { // If the server did return a 200 OK response, then parse the JSON. @@ -37,12 +36,12 @@ class ProfileService { : print( "Profile answers were load. No answers found with this user ID"); - List questions = new List(); - List answers = new List(); + List questions = []; + List answers = []; UserModel user = UserModel.fromJson(body['user']); // profileInfo will be a dynamic List containing user's info, questions list, answers list - List profileInfo = new List(); + List profileInfo = []; body['questions'].reversed.forEach((question) { questions.add(QuestionModel.fromJson(question)); diff --git a/lib/services/rating_service.dart b/lib/services/rating_service.dart index 10576d9..d77ba93 100644 --- a/lib/services/rating_service.dart +++ b/lib/services/rating_service.dart @@ -8,8 +8,8 @@ class RatingService { Future updateRating(RatingModel rating) async { await DotEnv.load(); final response = await http.put( - Uri.http( - DotEnv.env['HOST'] + ':' + DotEnv.env['PORT'], + Uri.https( + DotEnv.env['HOST'], '/v1/users/${rating.id}/rating', ), headers: { diff --git a/lib/services/users_service.dart b/lib/services/users_service.dart index 5ead210..585297b 100644 --- a/lib/services/users_service.dart +++ b/lib/services/users_service.dart @@ -9,8 +9,8 @@ class UserService { Future getUserById(String uid) async { await DotEnv.load(); - final response = await http.get(Uri.http( - DotEnv.env['HOST'] + ':' + DotEnv.env['PORT'], '/v1/users/' + uid)); + final response = + await http.get(Uri.https(DotEnv.env['HOST'], '/v1/users/' + uid)); if (response.statusCode == 200) { final body = json.decode(response.body); diff --git a/lib/services/video_communication.dart b/lib/services/video_communication.dart index 85dc2ae..ae32898 100644 --- a/lib/services/video_communication.dart +++ b/lib/services/video_communication.dart @@ -4,12 +4,12 @@ import 'dart:convert'; import 'package:http/http.dart' as http; class VideoCallService { - Future getTokenCall(String channelName) async { await DotEnv.load(); print("Call -token requested"); - final response = await http.get(Uri.http(DotEnv.env['HOST'] + ':' + DotEnv.env['PORT'], '/v1/agora/call/' + channelName)); + final response = await http + .get(Uri.https(DotEnv.env['HOST'], '/v1/agora/call/' + channelName)); if (response.statusCode == 200) { final body = json.decode(response.body); print("Call - token received"); @@ -21,18 +21,17 @@ class VideoCallService { } Future getTokenAnswer(String channelName) async { - await DotEnv.load(); print("Call answer - token requested"); - final response = await http.get(Uri.http(DotEnv.env['HOST'] + ':' + DotEnv.env['PORT'], '/v1/agora/answer/' + channelName)); + final response = await http + .get(Uri.https(DotEnv.env['HOST'], '/v1/agora/answer/' + channelName)); if (response.statusCode == 200) { final body = json.decode(response.body); if (body['token'] != "error") { print("Call answer - token received"); print(body); - } - else { + } else { print("Call is not active"); } @@ -43,10 +42,10 @@ class VideoCallService { } Future hungUpCaller(String channelName) async { - await DotEnv.load(); - final response = await http.delete(Uri.http(DotEnv.env['HOST'] + ':' + DotEnv.env['PORT'], '/v1/agora/hungup/' + channelName)); + final response = await http.delete( + Uri.https(DotEnv.env['HOST'], '/v1/agora/hungup/' + channelName)); if (response.statusCode == 200) { print("Caller hung up"); } else { diff --git a/lib/style.dart b/lib/style.dart index e69de29..8b13789 100644 --- a/lib/style.dart +++ b/lib/style.dart @@ -0,0 +1 @@ + diff --git a/pubspec.lock b/pubspec.lock index 5312221..47fa2ef 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,42 +7,42 @@ packages: name: agora_rtc_engine url: "https://pub.dartlang.org" source: hosted - version: "3.3.2" + version: "3.3.3" async: dependency: transitive description: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.5.0-nullsafety.1" + version: "2.5.0" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety.1" + version: "2.1.0" characters: dependency: transitive description: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety.3" + version: "1.1.0" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.2.0-nullsafety.1" + version: "1.2.0" clock: dependency: transitive description: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety.1" + version: "1.1.0" cloud_firestore: dependency: "direct main" description: @@ -70,7 +70,7 @@ packages: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.15.0-nullsafety.3" + version: "1.15.0" convert: dependency: transitive description: @@ -91,7 +91,7 @@ packages: name: cupertino_icons url: "https://pub.dartlang.org" source: hosted - version: "1.0.0" + version: "1.0.2" date_time_picker: dependency: "direct main" description: @@ -112,21 +112,21 @@ packages: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.2.0-nullsafety.1" + version: "1.2.0" ffi: dependency: transitive description: name: ffi url: "https://pub.dartlang.org" source: hosted - version: "0.1.3" + version: "1.0.0" file: dependency: transitive description: name: file url: "https://pub.dartlang.org" source: hosted - version: "5.2.1" + version: "6.1.0" firebase_auth: dependency: "direct main" description: @@ -276,7 +276,7 @@ packages: source: hosted version: "1.1.6" intl: - dependency: transitive + dependency: "direct main" description: name: intl url: "https://pub.dartlang.org" @@ -295,7 +295,7 @@ packages: name: js url: "https://pub.dartlang.org" source: hosted - version: "0.6.2" + version: "0.6.3" json_annotation: dependency: transitive description: @@ -309,7 +309,7 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.10-nullsafety.1" + version: "0.12.10" material_segmented_control: dependency: "direct main" description: @@ -323,7 +323,7 @@ packages: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.3" + version: "1.3.0" modal_progress_hud: dependency: "direct main" description: @@ -337,7 +337,7 @@ packages: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.0-nullsafety.1" + version: "1.8.0" path_provider: dependency: "direct main" description: @@ -372,14 +372,14 @@ packages: name: path_provider_windows url: "https://pub.dartlang.org" source: hosted - version: "0.0.4+3" + version: "0.0.5" pedantic: dependency: transitive description: name: pedantic url: "https://pub.dartlang.org" source: hosted - version: "1.9.2" + version: "1.11.0" permission_handler: dependency: "direct main" description: @@ -407,7 +407,7 @@ packages: name: platform url: "https://pub.dartlang.org" source: hosted - version: "2.2.1" + version: "3.0.0" plugin_platform_interface: dependency: transitive description: @@ -421,7 +421,7 @@ packages: name: process url: "https://pub.dartlang.org" source: hosted - version: "3.0.13" + version: "4.2.1" quiver: dependency: transitive description: @@ -482,42 +482,42 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.0-nullsafety.2" + version: "1.8.0" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.10.0-nullsafety.1" + version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety.1" + version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety.1" + version: "1.1.0" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.2.0-nullsafety.1" + version: "1.2.0" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.19-nullsafety.2" + version: "0.2.19" timeago: dependency: "direct main" description: @@ -531,14 +531,14 @@ packages: name: toggle_switch url: "https://pub.dartlang.org" source: hosted - version: "0.1.8" + version: "0.1.9" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.3" + version: "1.3.0" uuid: dependency: "direct main" description: @@ -552,14 +552,14 @@ packages: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety.3" + version: "2.1.0" win32: dependency: transitive description: name: win32 url: "https://pub.dartlang.org" source: hosted - version: "1.7.4+1" + version: "2.0.5" xdg_directories: dependency: transitive description: @@ -568,5 +568,5 @@ packages: source: hosted version: "0.1.2" sdks: - dart: ">=2.10.0 <2.11.0" - flutter: ">=1.20.0 <2.0.0" + dart: ">=2.12.0 <3.0.0" + flutter: ">=1.20.0" diff --git a/pubspec.yaml b/pubspec.yaml index 0b6952f..36a5e3f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -49,6 +49,7 @@ dependencies: timeago: ^2.0.30 flutter_dotenv: ^3.1.0 agora_rtc_engine: ^3.1.3 + intl: ^0.16.1 dev_dependencies: flutter_test: