From 4d70bee9a51c3d4a982663cffdafba5b9fa79b84 Mon Sep 17 00:00:00 2001 From: DevAdnani Date: Tue, 21 Sep 2021 17:38:28 +0530 Subject: [PATCH] keyboard issue fixed --- .../AltScreenHelpers/alt.profile.helper.dart | 2 +- .../landingService.notifier.dart | 16 +- .../helpers/ProfileHelper/profile.helper.dart | 4 +- lib/core/utils/posts.functions.dart | 593 +++++++++--------- lib/meta/screen/Chatscreen/chat.screen.dart | 1 - 5 files changed, 320 insertions(+), 296 deletions(-) diff --git a/lib/core/helpers/AltScreenHelpers/alt.profile.helper.dart b/lib/core/helpers/AltScreenHelpers/alt.profile.helper.dart index 9c6f3f6..3ea3458 100644 --- a/lib/core/helpers/AltScreenHelpers/alt.profile.helper.dart +++ b/lib/core/helpers/AltScreenHelpers/alt.profile.helper.dart @@ -378,7 +378,7 @@ class AltProfileHelper with ChangeNotifier { Widget status({BuildContext context, String userUid}) { return Center( child: Padding( - padding: EdgeInsets.only(top: 8.0, left: 40.0, right: 40.0), + padding: EdgeInsets.only(left: 40.0, right: 40.0), child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ diff --git a/lib/core/helpers/LandingHelpers/landingService.notifier.dart b/lib/core/helpers/LandingHelpers/landingService.notifier.dart index 97e2122..667d668 100644 --- a/lib/core/helpers/LandingHelpers/landingService.notifier.dart +++ b/lib/core/helpers/LandingHelpers/landingService.notifier.dart @@ -106,7 +106,7 @@ class LandingService with ChangeNotifier { builder: (context) { return Padding( padding: EdgeInsets.only( - bottom: MediaQuery.of(context).viewInsets.horizontal * 0.2), + bottom: MediaQuery.of(context).viewInsets.bottom), child: Container( height: MediaQuery.of(context).size.height * 0.30, width: MediaQuery.of(context).size.width, @@ -170,6 +170,9 @@ class LandingService with ChangeNotifier { context: context) .then((value) { if (value) { + userEmailController.clear(); + userPasswordController.clear(); + userNameController.clear(); if (Provider.of(context, listen: false) .isVerified) { @@ -239,7 +242,7 @@ class LandingService with ChangeNotifier { builder: (context) { return Padding( padding: EdgeInsets.only( - bottom: MediaQuery.of(context).viewInsets.horizontal * 0.3), + bottom: MediaQuery.of(context).viewInsets.bottom), child: Container( height: MediaQuery.of(context).size.height * 0.5, width: MediaQuery.of(context).size.width, @@ -371,6 +374,10 @@ class LandingService with ChangeNotifier { listen: false) .getUserAvatarUrl, 'userPassword': userPasswordController.text, + }).whenComplete(() { + userEmailController.clear(); + userPasswordController.clear(); + userNameController.clear(); }); } else { warningText( @@ -447,7 +454,7 @@ class LandingService with ChangeNotifier { builder: (context) { return Padding( padding: EdgeInsets.only( - bottom: MediaQuery.of(context).viewInsets.horizontal * 0.2), + bottom: MediaQuery.of(context).viewInsets.bottom), child: Container( height: MediaQuery.of(context).size.height * 0.25, width: MediaQuery.of(context).size.width, @@ -492,6 +499,9 @@ class LandingService with ChangeNotifier { context: context) .then((value) { if (value) { + userEmailController.clear(); + userPasswordController.clear(); + userNameController.clear(); warningText( context, 'Please Check Your Mail ID', 12.0); } else { diff --git a/lib/core/helpers/ProfileHelper/profile.helper.dart b/lib/core/helpers/ProfileHelper/profile.helper.dart index 3d23143..9b69de6 100644 --- a/lib/core/helpers/ProfileHelper/profile.helper.dart +++ b/lib/core/helpers/ProfileHelper/profile.helper.dart @@ -207,7 +207,7 @@ class ProfileHelpers with ChangeNotifier { Widget status({BuildContext context}) { return Center( child: Padding( - padding: EdgeInsets.only(top: 8.0, left: 40.0, right: 40.0), + padding: EdgeInsets.only(left: 40.0, right: 40.0), child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ @@ -306,7 +306,7 @@ class ProfileHelpers with ChangeNotifier { backgroundColor: redColor, child: Icon( EvaIcons.uploadOutline, - color: greenColor, + color: whiteColor, ), onPressed: () async { if (editBioController.text.isNotEmpty) { diff --git a/lib/core/utils/posts.functions.dart b/lib/core/utils/posts.functions.dart index 1f2677d..4512b67 100644 --- a/lib/core/utils/posts.functions.dart +++ b/lib/core/utils/posts.functions.dart @@ -84,13 +84,16 @@ class PostFunctions with ChangeNotifier { padding: const EdgeInsets.only( left: 12.0), child: TextField( - maxLines: 5, - textCapitalization: TextCapitalization.words, - inputFormatters: [ - LengthLimitingTextInputFormatter(100) - ], - maxLength: 100, - maxLengthEnforcement: MaxLengthEnforcement.enforced, + maxLines: 5, + textCapitalization: + TextCapitalization.words, + inputFormatters: [ + LengthLimitingTextInputFormatter( + 100) + ], + maxLength: 100, + maxLengthEnforcement: + MaxLengthEnforcement.enforced, controller: editCaptionController, decoration: InputDecoration( hintText: 'Edit your Caption', @@ -291,317 +294,329 @@ class PostFunctions with ChangeNotifier { context: context, isScrollControlled: true, builder: (context) { - return SingleChildScrollView( - child: Container( - height: MediaQuery.of(context).size.height * 0.75, - width: MediaQuery.of(context).size.width, - decoration: BoxDecoration( - color: blueGreyColor, - borderRadius: BorderRadius.only( - topLeft: Radius.circular(12.0), - topRight: Radius.circular(12.0), - ), - ), - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Padding( - padding: const EdgeInsets.symmetric(horizontal: 150.0), - child: Divider( - thickness: 4.0, - color: whiteColor, - ), + return Padding( + padding: EdgeInsets.only( + bottom: MediaQuery.of(context).viewInsets.bottom), + child: SingleChildScrollView( + child: Container( + height: MediaQuery.of(context).size.height * 0.60, + width: MediaQuery.of(context).size.width, + decoration: BoxDecoration( + color: blueGreyColor, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(12.0), + topRight: Radius.circular(12.0), ), - Container( - width: 110, - decoration: BoxDecoration( - border: Border.all(color: whiteColor), - borderRadius: BorderRadius.circular(12.0), + ), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Padding( + padding: const EdgeInsets.symmetric(horizontal: 150.0), + child: Divider( + thickness: 4.0, + color: whiteColor, + ), ), - child: Center( - child: Text( - 'Comments', - style: TextStyle( - color: blueColor, - fontSize: 16.0, - fontWeight: FontWeight.bold, + Container( + width: 110, + decoration: BoxDecoration( + border: Border.all(color: whiteColor), + borderRadius: BorderRadius.circular(12.0), + ), + child: Center( + child: Text( + 'Comments', + style: TextStyle( + color: blueColor, + fontSize: 16.0, + fontWeight: FontWeight.bold, + ), ), ), ), - ), - Container( - height: MediaQuery.of(context).size.height * 0.62, - width: MediaQuery.of(context).size.width, - child: StreamBuilder( - stream: FirebaseFirestore.instance - .collection('posts') - .doc(docId) - .collection('comments') - .orderBy('time') - .snapshots(), - builder: (context, snapshot) { - if (snapshot.connectionState == - ConnectionState.waiting) { - return Center( - child: CircularProgressIndicator(), - ); - } else { - return new ListView( - scrollDirection: Axis.vertical, - shrinkWrap: true, - children: snapshot.data.docs - .map((DocumentSnapshot documentSnapshot) { - return Container( - height: - MediaQuery.of(context).size.height * 0.10, - width: MediaQuery.of(context).size.width, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - GestureDetector( - onTap: () { - if (documentSnapshot - .data()['userUid'] != - Provider.of( - context, - listen: false) - .getUserUid) { - Navigator.pushReplacement( - context, - PageTransition( - child: AltProfile( - userUid: documentSnapshot - .data()['userUid'], - ), - type: PageTransitionType - .bottomToTop), - ); - } - }, - child: Padding( - padding: EdgeInsets.only( - top: 8.0, left: 10.0), - child: CircleAvatar( - backgroundColor: darkColor, - radius: 14, - backgroundImage: NetworkImage( - documentSnapshot - .data()['userImage']), - ), - ), - ), - Padding( - padding: const EdgeInsets.only( - left: 12.0, top: 8.0), - child: Container( - child: Text( - documentSnapshot.data()['userName'], - style: TextStyle( - color: whiteColor, - fontWeight: FontWeight.bold, - fontSize: 14.0, - ), - )), - ), - ], - ), - Container( - width: MediaQuery.of(context).size.width, - child: Row( + Container( + height: MediaQuery.of(context).size.height * 0.46, + width: MediaQuery.of(context).size.width, + child: StreamBuilder( + stream: FirebaseFirestore.instance + .collection('posts') + .doc(docId) + .collection('comments') + .orderBy('time') + .snapshots(), + builder: (context, snapshot) { + if (snapshot.connectionState == + ConnectionState.waiting) { + return Center( + child: CircularProgressIndicator(), + ); + } else { + return new ListView( + scrollDirection: Axis.vertical, + shrinkWrap: true, + children: snapshot.data.docs + .map((DocumentSnapshot documentSnapshot) { + return Container( + height: + MediaQuery.of(context).size.height * 0.10, + width: MediaQuery.of(context).size.width, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Row( children: [ - IconButton( - icon: Icon( - Icons - .arrow_forward_ios_outlined, - color: blueColor, - size: 22, + GestureDetector( + onTap: () { + if (documentSnapshot + .data()['userUid'] != + Provider.of( + context, + listen: false) + .getUserUid) { + Navigator.pushReplacement( + context, + PageTransition( + child: AltProfile( + userUid: + documentSnapshot + .data()[ + 'userUid'], + ), + type: PageTransitionType + .bottomToTop), + ); + } + }, + child: Padding( + padding: EdgeInsets.only( + top: 8.0, left: 10.0), + child: CircleAvatar( + backgroundColor: darkColor, + radius: 14, + backgroundImage: NetworkImage( + documentSnapshot + .data()['userImage']), ), - onPressed: () {}), - Container( - width: MediaQuery.of(context) - .size - .width * - 0.75, - child: Text( + ), + ), + Padding( + padding: const EdgeInsets.only( + left: 12.0, top: 8.0), + child: Container( + child: Text( documentSnapshot - .data()['comment'], + .data()['userName'], style: TextStyle( color: whiteColor, fontWeight: FontWeight.bold, fontSize: 14.0, ), - ), + )), ), - Provider.of(context, - listen: false) - .getUserUid == - documentSnapshot - .data()['userUid'] - ? IconButton( - icon: Icon( - FontAwesomeIcons.trash, - color: redColor, - size: 18, - ), - onPressed: () { - showDialog( - context: context, - builder: (context) { - return AlertDialog( - backgroundColor: - darkColor, - title: Text( - 'Delete The Comment', - style: TextStyle( - color: - whiteColor, - fontSize: - 16.0, - fontWeight: - FontWeight - .bold), - ), - actions: [ - MaterialButton( - onPressed: () { - Navigator.pop( - context); - }, - child: Text( - 'No', - style: TextStyle( - decoration: - TextDecoration - .underline, - color: - whiteColor, - fontSize: - 16.0, - fontWeight: - FontWeight - .bold), - ), + ], + ), + Container( + width: + MediaQuery.of(context).size.width, + child: Row( + children: [ + IconButton( + icon: Icon( + Icons + .arrow_forward_ios_outlined, + color: blueColor, + size: 22, + ), + onPressed: () {}), + Container( + width: MediaQuery.of(context) + .size + .width * + 0.75, + child: Text( + documentSnapshot + .data()['comment'], + style: TextStyle( + color: whiteColor, + fontWeight: FontWeight.bold, + fontSize: 14.0, + ), + ), + ), + Provider.of(context, + listen: false) + .getUserUid == + documentSnapshot + .data()['userUid'] + ? IconButton( + icon: Icon( + FontAwesomeIcons.trash, + color: redColor, + size: 18, + ), + onPressed: () { + showDialog( + context: context, + builder: (context) { + return AlertDialog( + backgroundColor: + darkColor, + title: Text( + 'Delete The Comment', + style: TextStyle( + color: + whiteColor, + fontSize: + 16.0, + fontWeight: + FontWeight + .bold), ), - MaterialButton( - color: redColor, - onPressed: () { - Provider.of( - context, - listen: - false) - .deleteUserComment( - cmtId: documentSnapshot - .data()[ - 'commentId'], - postId: - docId, - ) - .whenComplete( - () { + actions: [ + MaterialButton( + onPressed: + () { Navigator.pop( context); - }); - }, - child: Text( - 'Yes', - style: TextStyle( - color: - whiteColor, - fontSize: - 16.0, - fontWeight: - FontWeight - .bold), + }, + child: Text( + 'No', + style: TextStyle( + decoration: + TextDecoration + .underline, + color: + whiteColor, + fontSize: + 16.0, + fontWeight: + FontWeight.bold), + ), ), - ), - ], - ); - }); - }) - : Container( - width: 0, - height: 0, - ) - ], + MaterialButton( + color: + redColor, + onPressed: + () { + Provider.of( + context, + listen: + false) + .deleteUserComment( + cmtId: documentSnapshot + .data()[ + 'commentId'], + postId: + docId, + ) + .whenComplete( + () { + Navigator.pop( + context); + }); + }, + child: Text( + 'Yes', + style: TextStyle( + color: + whiteColor, + fontSize: + 16.0, + fontWeight: + FontWeight.bold), + ), + ), + ], + ); + }); + }) + : Container( + width: 0, + height: 0, + ) + ], + ), ), - ), - ], - ), - ); - }).toList(), - ); - } - }, + ], + ), + ); + }).toList(), + ); + } + }, + ), ), - ), - Container( - width: 400, - height: 50.0, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Container( - width: 300.0, - height: 20.0, - child: TextField( - textCapitalization: TextCapitalization.sentences, - decoration: InputDecoration( - hintText: 'Add Comment....', - hintStyle: TextStyle( + Container( + width: 400, + height: 50.0, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Container( + width: 300.0, + height: 20.0, + child: TextField( + textCapitalization: TextCapitalization.sentences, + decoration: InputDecoration( + hintText: 'Add Comment....', + hintStyle: TextStyle( + color: whiteColor, + fontSize: 16, + fontWeight: FontWeight.bold, + ), + ), + controller: commentController, + style: TextStyle( color: whiteColor, fontSize: 16, fontWeight: FontWeight.bold, ), ), - controller: commentController, - style: TextStyle( - color: whiteColor, - fontSize: 16, - fontWeight: FontWeight.bold, - ), ), - ), - FloatingActionButton( - backgroundColor: greenColor, - onPressed: () { - if (commentController.text.isNotEmpty) { - print('Adding Comment'); - var randomID = nanoid(10); + FloatingActionButton( + backgroundColor: greenColor, + onPressed: () { + if (commentController.text.isNotEmpty) { + print('Adding Comment'); + var randomID = nanoid(10); - addComment( - commentID: randomID, - context: context, - postId: snapshot.data()['postId'], - comment: commentController.text, - ).whenComplete(() { - commentController.clear(); - notifyListeners(); + addComment( + commentID: randomID, + context: context, + postId: snapshot.data()['postId'], + comment: commentController.text, + ).whenComplete(() { + commentController.clear(); + notifyListeners(); + Provider.of(context, + listen: false) + .warningText(context, + 'Comment Added Successfully', 16.0); + Navigator.pop(context); + Navigator.pop(context); + }); + } else { Provider.of(context, listen: false) - .warningText(context, - 'Comment Added Successfully', 16.0); - }); - } else { - Provider.of(context, - listen: false) - .warningText( - context, - 'Please Type Something In Order To Comment', - 16.0); - } - }, - child: Icon( - FontAwesomeIcons.comment, - color: whiteColor, - ), - ) - ], - ), - ) - ], + .warningText( + context, + 'Please Type Something In Order To Comment', + 16.0); + } + }, + child: Icon( + FontAwesomeIcons.comment, + color: whiteColor, + ), + ) + ], + ), + ) + ], + ), ), ), ); diff --git a/lib/meta/screen/Chatscreen/chat.screen.dart b/lib/meta/screen/Chatscreen/chat.screen.dart index 6005d8d..d3bfbc4 100644 --- a/lib/meta/screen/Chatscreen/chat.screen.dart +++ b/lib/meta/screen/Chatscreen/chat.screen.dart @@ -1,4 +1,3 @@ -import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/material.dart'; import 'package:flutter_windowmanager/flutter_windowmanager.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart';