Chat Count Api / Chat Token Updates / Chat Call UI

merge-requests/59/head
Aamir Muhammad 2 years ago
parent b7e4a6d149
commit 06e7a913da

@ -82,7 +82,7 @@ class _OutGoingCallState extends State<OutGoingCall> with SingleTickerProviderSt
Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
children: <Widget>[
Container(
margin: const EdgeInsets.all(21.0),
child: Container(

@ -30,7 +30,11 @@ class ChatBubble extends StatelessWidget {
Widget build(BuildContext context) {
return Padding(
// padding: EdgeInsets.zero,
padding: EdgeInsets.only(left: isCurrentUser ? 110 : 20, right: isCurrentUser ? 20 : 110, bottom: 9),
padding: EdgeInsets.only(
left: isCurrentUser ? 110 : 20,
right: isCurrentUser ? 20 : 110,
bottom: 9,
),
child: Align(
alignment: isCurrentUser ? Alignment.centerRight : Alignment.centerLeft,
@ -40,7 +44,9 @@ class ChatBubble extends StatelessWidget {
gradient: isCurrentUser
? null
: const LinearGradient(
transform: GradientRotation(.46),
transform: GradientRotation(
.46,
),
begin: Alignment.topRight,
end: Alignment.bottomLeft,
colors: <Color>[
@ -48,21 +54,33 @@ class ChatBubble extends StatelessWidget {
MyColors.gradiantStartColor,
],
),
borderRadius: BorderRadius.circular(10),
borderRadius: BorderRadius.circular(
10,
),
),
child: Padding(
padding: EdgeInsets.only(top: isReplied ? 8 : 5, right: 8, left: 8, bottom: 5),
padding: EdgeInsets.only(
top: isReplied ? 8 : 5,
right: 8,
left: 8,
bottom: 5,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
if (isReplied)
ClipRRect(
borderRadius: BorderRadius.circular(5.0),
borderRadius: BorderRadius.circular(
5.0,
),
child: Container(
decoration: BoxDecoration(
border: Border(
left: BorderSide(width: 6, color: isCurrentUser ? MyColors.gradiantStartColor : MyColors.white),
left: BorderSide(
width: 6,
color: isCurrentUser ? MyColors.gradiantStartColor : MyColors.white,
),
),
color: isCurrentUser ? MyColors.black.withOpacity(0.10) : MyColors.black.withOpacity(0.30),
),
@ -72,10 +90,29 @@ class ChatBubble extends StatelessWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
(userName).toText12(color: MyColors.gradiantStartColor, isBold: false).paddingOnly(right: 5, top: 5, bottom: 0, left: 5),
(userName)
.toText12(
color: MyColors.gradiantStartColor,
isBold: false,
)
.paddingOnly(
right: 5,
top: 5,
bottom: 0,
left: 5,
),
replyText
.toText10(color: isCurrentUser ? MyColors.grey71Color : MyColors.white.withOpacity(0.5), isBold: false, maxlines: 4)
.paddingOnly(right: 5, top: 5, bottom: 8, left: 5),
.toText10(
color: isCurrentUser ? MyColors.grey71Color : MyColors.white.withOpacity(0.5),
isBold: false,
maxlines: 4,
)
.paddingOnly(
right: 5,
top: 5,
bottom: 8,
left: 5,
),
],
),
),
@ -84,12 +121,16 @@ class ChatBubble extends StatelessWidget {
),
),
if (isReplied) 8.height,
text.toText12(color: isCurrentUser ? MyColors.grey57Color : MyColors.white),
text.toText12(
color: isCurrentUser ? MyColors.grey57Color : MyColors.white,
),
Row(
crossAxisAlignment: CrossAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.end,
children: [
dateTime.toText12(color: isCurrentUser ? MyColors.grey41Color.withOpacity(.5) : MyColors.white.withOpacity(0.7),),
children: <Widget>[
dateTime.toText12(
color: isCurrentUser ? MyColors.grey41Color.withOpacity(.5) : MyColors.white.withOpacity(0.7),
),
if (isCurrentUser) 5.width,
// if (isCurrentUser)
// Icon(

@ -132,7 +132,9 @@ class _ChatDetailScreenState extends State<ChatDetailScreen> {
userName: AppState().chatDetails!.response!.userName == m.userChatHistory[i].currentUserName.toString() ? "You" : m.userChatHistory[i].currentUserName.toString(),
),
onRightSwipe: () {
m.chatReply(m.userChatHistory[i]);
m.chatReply(
m.userChatHistory[i],
);
},
);
},
@ -156,7 +158,10 @@ class _ChatDetailScreenState extends State<ChatDetailScreen> {
? "You"
: m.repliedMsg.first.currentUserName.toString().replaceAll(".", " "))
.toText14(color: MyColors.lightGreenColor),
subtitle: (m.repliedMsg.isNotEmpty ? m.repliedMsg.first.contant! : "").toText12(color: MyColors.white, maxLine: 2),
subtitle: (m.repliedMsg.isNotEmpty ? m.repliedMsg.first.contant! : "").toText12(
color: MyColors.white,
maxLine: 2,
),
trailing: GestureDetector(
onTap: m.closeMe,
child: Container(
@ -183,7 +188,12 @@ class _ChatDetailScreenState extends State<ChatDetailScreen> {
margin: EdgeInsets.zero,
elevation: 0,
child: Padding(
padding: const EdgeInsets.only(left: 20, right: 20, top: 20, bottom: 0),
padding: const EdgeInsets.only(
left: 20,
right: 20,
top: 20,
bottom: 0,
),
child: Card(
margin: EdgeInsets.zero,
shape: RoundedRectangleBorder(
@ -217,13 +227,21 @@ class _ChatDetailScreenState extends State<ChatDetailScreen> {
controller: m.message,
decoration: InputDecoration(
hintText: m.isFileSelected ? m.selectedFile.path.split("/").last : LocaleKeys.typeheretoreply.tr(),
hintStyle: TextStyle(color: m.isFileSelected ? MyColors.darkTextColor : MyColors.grey98Color, fontSize: 14),
hintStyle: TextStyle(
color: m.isFileSelected ? MyColors.darkTextColor : MyColors.grey98Color,
fontSize: 14,
),
border: InputBorder.none,
focusedBorder: InputBorder.none,
enabledBorder: InputBorder.none,
errorBorder: InputBorder.none,
disabledBorder: InputBorder.none,
contentPadding: EdgeInsets.only(left: m.sFileType.isNotEmpty ? 10 : 20, right: m.sFileType.isNotEmpty ? 0 : 5, top: 20, bottom: 20),
contentPadding: EdgeInsets.only(
left: m.sFileType.isNotEmpty ? 10 : 20,
right: m.sFileType.isNotEmpty ? 0 : 5,
top: 20,
bottom: 20,
),
prefixIcon: m.sFileType.isNotEmpty
? Row(
mainAxisSize: MainAxisSize.min,
@ -267,7 +285,13 @@ class _ChatDetailScreenState extends State<ChatDetailScreen> {
color: MyColors.white,
),
),
("Clear").toText11(color: MyColors.redA3Color).paddingOnly(left: 4),
("Clear")
.toText11(
color: MyColors.redA3Color,
)
.paddingOnly(
left: 4,
),
],
),
onPressed: () async {
@ -299,12 +323,18 @@ class _ChatDetailScreenState extends State<ChatDetailScreen> {
width: 26,
),
onPressed: () {
m.sendChatMessage(userDetails["targetUser"].id, userDetails["targetUser"].userName, context);
m.sendChatMessage(
userDetails["targetUser"].id,
userDetails["targetUser"].userName,
context,
);
},
)
],
),
).paddingOnly(right: 20),
).paddingOnly(
right: 20,
),
),
),
),

@ -34,11 +34,8 @@ class _ChatHomeState extends State<ChatHome> {
// TODO: implement initState
super.initState();
data = Provider.of<ChatProviderModel>(context, listen: false);
data.getUserAutoLoginToken().then((value) {
data.getUserAutoLoginToken().then((Object? value) {
data.getUserRecentChats();
// var datae = [int.parse(AppState().memberInformationList!.eMPLOYEENUMBER.toString())];
// data.hubConnection.invoke("GetUserChatHistoryNotDeliveredAsync", args: [int.parse(AppState().memberInformationList!.eMPLOYEENUMBER.toString())]);
});
}
@ -73,14 +70,17 @@ class _ChatHomeState extends State<ChatHome> {
transform: GradientRotation(.83),
begin: Alignment.topRight,
end: Alignment.bottomLeft,
colors: [
colors: <Color>[
MyColors.gradiantEndColor,
MyColors.gradiantStartColor,
],
),
),
child: Row(
children: [myTab(LocaleKeys.mychats.tr(), 0), myTab(LocaleKeys.favorite.tr(), 1)],
children: <Widget>[
myTab(LocaleKeys.mychats.tr(), 0),
myTab(LocaleKeys.favorite.tr(), 1),
],
),
),
PageView(
@ -91,7 +91,10 @@ class _ChatHomeState extends State<ChatHome> {
tabIndex = pageIndex;
});
},
children: <Widget>[ChatHomeScreen(), ChatFavoriteUsersScreen()],
children: <Widget>[
ChatHomeScreen(),
ChatFavoriteUsersScreen(),
],
).expanded,
],
),
@ -104,7 +107,10 @@ class _ChatHomeState extends State<ChatHome> {
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
title.toText12(color: isSelected ? MyColors.white : MyColors.white.withOpacity(.74), isCenter: true),
title.toText12(
color: isSelected ? MyColors.white : MyColors.white.withOpacity(.74),
isCenter: true,
),
4.height,
Container(
height: 8,

@ -40,21 +40,41 @@ class _ChatHomeScreenState extends State<ChatHomeScreen> {
physics: const AlwaysScrollableScrollPhysics(),
children: <Widget>[
Padding(
padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 20),
padding: const EdgeInsets.symmetric(
vertical: 20,
horizontal: 20,
),
child: TextField(
controller: m.search,
onChanged: (String val) {
m.filter(val);
},
decoration: InputDecoration(
border: fieldBorder(radius: 5, color: 0xFFE5E5E5),
focusedBorder: fieldBorder(radius: 5, color: 0xFFE5E5E5),
enabledBorder: fieldBorder(radius: 5, color: 0xFFE5E5E5),
contentPadding: const EdgeInsets.symmetric(horizontal: 15, vertical: 10),
border: fieldBorder(
radius: 5,
color: 0xFFE5E5E5,
),
focusedBorder: fieldBorder(
radius: 5,
color: 0xFFE5E5E5,
),
enabledBorder: fieldBorder(
radius: 5,
color: 0xFFE5E5E5,
),
contentPadding: const EdgeInsets.symmetric(
horizontal: 15,
vertical: 10,
),
hintText: LocaleKeys.searchfromchat.tr(),
hintStyle: const TextStyle(color: MyColors.lightTextColor, fontStyle: FontStyle.italic),
hintStyle: const TextStyle(
color: MyColors.lightTextColor,
fontStyle: FontStyle.italic,
),
filled: true,
fillColor: const Color(0xFFF7F7F7),
fillColor: const Color(
0xFFF7F7F7,
),
suffixIcon: m.search.text.isNotEmpty
? IconButton(
onPressed: () {
@ -73,7 +93,9 @@ class _ChatHomeScreenState extends State<ChatHomeScreen> {
if (m.searchedChats != null)
ListView.separated(
itemCount: m.searchedChats!.length,
padding: const EdgeInsets.only(bottom: 80),
padding: const EdgeInsets.only(
bottom: 80,
),
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (BuildContext context, int index) {
@ -136,15 +158,26 @@ class _ChatHomeScreenState extends State<ChatHomeScreen> {
child: IconButton(
alignment: Alignment.centerRight,
padding: EdgeInsets.zero,
icon: Icon(m.searchedChats![index].isFav != null && m.searchedChats![index].isFav == false ? Icons.star_sharp : Icons.star_sharp),
icon: Icon(
m.searchedChats![index].isFav != null && m.searchedChats![index].isFav == false ? Icons.star_sharp : Icons.star_sharp,
),
color: m.searchedChats![index].isFav != null && m.searchedChats![index].isFav == true ? MyColors.yellowColor : MyColors.grey35Color,
onPressed: () {
if (m.searchedChats![index].isFav == null || m.searchedChats![index].isFav == false) {
m.favoriteUser(userID: AppState().chatDetails!.response!.id!, targetUserID: m.searchedChats![index].id!);
m.favoriteUser(
userID: AppState().chatDetails!.response!.id!,
targetUserID: m.searchedChats![index].id!,
);
} else if (m.searchedChats![index].isFav == true) {
m.unFavoriteUser(userID: AppState().chatDetails!.response!.id!, targetUserID: m.searchedChats![index].id!);
m.unFavoriteUser(
userID: AppState().chatDetails!.response!.id!,
targetUserID: m.searchedChats![index].id!,
);
} else {
m.favoriteUser(userID: AppState().chatDetails!.response!.id!, targetUserID: m.searchedChats![index].id!);
m.favoriteUser(
userID: AppState().chatDetails!.response!.id!,
targetUserID: m.searchedChats![index].id!,
);
}
},
),
@ -167,9 +200,14 @@ class _ChatHomeScreenState extends State<ChatHomeScreen> {
);
},
separatorBuilder: (BuildContext context, int index) => const Padding(
padding: EdgeInsets.only(right: 10, left: 70),
padding: EdgeInsets.only(
right: 10,
left: 70,
),
child: Divider(
color: Color(0xFFE5E5E5),
color: Color(
0xFFE5E5E5,
),
),
),
),
@ -217,9 +255,13 @@ class _ChatHomeScreenState extends State<ChatHomeScreen> {
OutlineInputBorder fieldBorder({required double radius, required int color}) {
return OutlineInputBorder(
borderRadius: BorderRadius.circular(radius),
borderRadius: BorderRadius.circular(
radius,
),
borderSide: BorderSide(
color: Color(color),
color: Color(
color,
),
),
);
}

@ -34,7 +34,7 @@ class ChatFavoriteUsersScreen extends StatelessWidget {
height: 55,
child: ListTile(
leading: Stack(
children: [
children: <Widget>[
SvgPicture.asset(
"assets/images/user.svg",
height: 48,
@ -56,14 +56,22 @@ class ChatFavoriteUsersScreen extends StatelessWidget {
)
],
),
title: (m.favUsersList![index].userName!.replaceFirst(".", " ").capitalizeFirstofEach ?? "").toText14(color: MyColors.darkTextColor),
title: (m.favUsersList![index].userName!.replaceFirst(".", " ").capitalizeFirstofEach ?? "").toText14(
color: MyColors.darkTextColor,
),
trailing: IconButton(
alignment: Alignment.centerRight,
padding: EdgeInsets.zero,
icon: Icon(m.favUsersList![index].isFav! ? Icons.star : Icons.star_border),
icon: Icon(
m.favUsersList![index].isFav! ? Icons.star : Icons.star_border,
),
color: m.favUsersList![index].isFav! ? MyColors.yellowColor : MyColors.grey35Color,
onPressed: () {
if (m.favUsersList![index].isFav!) m.unFavoriteUser(userID: AppState().chatDetails!.response!.id!, targetUserID: m.favUsersList![index].id!);
if (m.favUsersList![index].isFav!)
m.unFavoriteUser(
userID: AppState().chatDetails!.response!.id!,
targetUserID: m.favUsersList![index].id!,
);
},
),
minVerticalPadding: 0,
@ -82,7 +90,10 @@ class ChatFavoriteUsersScreen extends StatelessWidget {
);
},
separatorBuilder: (BuildContext context, int index) => const Padding(
padding: EdgeInsets.only(right: 10, left: 70),
padding: EdgeInsets.only(
right: 10,
left: 70,
),
child: Divider(
color: Color(
0xFFE5E5E5,

Loading…
Cancel
Save