|
|
|
@ -43,147 +43,149 @@ class _ChatHomeScreenState extends State<ChatHomeScreen> {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Scaffold(
|
|
|
|
return Scaffold(
|
|
|
|
backgroundColor: MyColors.white,
|
|
|
|
backgroundColor: MyColors.white,
|
|
|
|
body: Consumer<ChatProviderModel>(builder: (BuildContext context, ChatProviderModel m, Widget? child) {
|
|
|
|
body: Consumer<ChatProviderModel>(
|
|
|
|
return m.isLoading
|
|
|
|
builder: (BuildContext context, ChatProviderModel m, Widget? child) {
|
|
|
|
? ChatHomeShimmer()
|
|
|
|
return m.isLoading
|
|
|
|
: ListView(
|
|
|
|
? ChatHomeShimmer()
|
|
|
|
shrinkWrap: true,
|
|
|
|
: ListView(
|
|
|
|
physics: const AlwaysScrollableScrollPhysics(),
|
|
|
|
shrinkWrap: true,
|
|
|
|
children: [
|
|
|
|
physics: const AlwaysScrollableScrollPhysics(),
|
|
|
|
Padding(
|
|
|
|
children: <Widget>[
|
|
|
|
padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 20),
|
|
|
|
Padding(
|
|
|
|
child: TextField(
|
|
|
|
padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 20),
|
|
|
|
onChanged: (String val) {
|
|
|
|
child: TextField(
|
|
|
|
m.filter(val);
|
|
|
|
onChanged: (String val) {
|
|
|
|
},
|
|
|
|
m.filter(val);
|
|
|
|
decoration: InputDecoration(
|
|
|
|
},
|
|
|
|
border: OutlineInputBorder(
|
|
|
|
decoration: InputDecoration(
|
|
|
|
borderRadius: BorderRadius.circular(5),
|
|
|
|
border: OutlineInputBorder(
|
|
|
|
borderSide: const BorderSide(
|
|
|
|
borderRadius: BorderRadius.circular(5),
|
|
|
|
color: Color(0xFFE5E5E5),
|
|
|
|
borderSide: const BorderSide(
|
|
|
|
|
|
|
|
color: Color(0xFFE5E5E5),
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
focusedBorder: OutlineInputBorder(
|
|
|
|
focusedBorder: OutlineInputBorder(
|
|
|
|
borderRadius: BorderRadius.circular(5),
|
|
|
|
borderRadius: BorderRadius.circular(5),
|
|
|
|
borderSide: const BorderSide(
|
|
|
|
borderSide: const BorderSide(
|
|
|
|
color: Color(0xFFE5E5E5),
|
|
|
|
color: Color(0xFFE5E5E5),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
enabledBorder: OutlineInputBorder(
|
|
|
|
enabledBorder: OutlineInputBorder(
|
|
|
|
borderRadius: BorderRadius.circular(5),
|
|
|
|
borderRadius: BorderRadius.circular(5),
|
|
|
|
borderSide: const BorderSide(
|
|
|
|
borderSide: const BorderSide(
|
|
|
|
color: Color(0xFFE5E5E5),
|
|
|
|
color: Color(0xFFE5E5E5),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
contentPadding: const EdgeInsets.symmetric(horizontal: 15, vertical: 10),
|
|
|
|
|
|
|
|
hintText: LocaleKeys.searchfromchat.tr(),
|
|
|
|
|
|
|
|
hintStyle: const TextStyle(color: MyColors.lightTextColor, fontStyle: FontStyle.italic),
|
|
|
|
|
|
|
|
filled: true,
|
|
|
|
|
|
|
|
fillColor: const Color(0xFFF7F7F7),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
contentPadding: const EdgeInsets.symmetric(horizontal: 15, vertical: 10),
|
|
|
|
|
|
|
|
hintText: LocaleKeys.searchfromchat.tr(),
|
|
|
|
|
|
|
|
hintStyle: const TextStyle(color: MyColors.lightTextColor, fontStyle: FontStyle.italic),
|
|
|
|
|
|
|
|
filled: true,
|
|
|
|
|
|
|
|
fillColor: const Color(0xFFF7F7F7),
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
if (m.searchedChats != null)
|
|
|
|
if (m.searchedChats != null)
|
|
|
|
ListView.separated(
|
|
|
|
ListView.separated(
|
|
|
|
itemCount: m.searchedChats!.length,
|
|
|
|
itemCount: m.searchedChats!.length,
|
|
|
|
padding: const EdgeInsets.only(bottom: 80),
|
|
|
|
padding: const EdgeInsets.only(bottom: 80),
|
|
|
|
shrinkWrap: true,
|
|
|
|
shrinkWrap: true,
|
|
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
return SizedBox(
|
|
|
|
return SizedBox(
|
|
|
|
height: 55,
|
|
|
|
height: 55,
|
|
|
|
child: ListTile(
|
|
|
|
child: ListTile(
|
|
|
|
leading: Stack(
|
|
|
|
leading: Stack(
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
SvgPicture.asset(
|
|
|
|
SvgPicture.asset(
|
|
|
|
"assets/images/user.svg",
|
|
|
|
"assets/images/user.svg",
|
|
|
|
height: 48,
|
|
|
|
height: 48,
|
|
|
|
width: 48,
|
|
|
|
width: 48,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
Positioned(
|
|
|
|
|
|
|
|
right: 5,
|
|
|
|
|
|
|
|
bottom: 1,
|
|
|
|
|
|
|
|
child: Container(
|
|
|
|
|
|
|
|
width: 10,
|
|
|
|
|
|
|
|
height: 10,
|
|
|
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
|
|
|
color: m.searchedChats![index].userStatus == 1 ? MyColors.green2DColor : Colors.red,
|
|
|
|
|
|
|
|
borderRadius: const BorderRadius.all(
|
|
|
|
|
|
|
|
Radius.circular(10),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
Positioned(
|
|
|
|
],
|
|
|
|
right: 5,
|
|
|
|
),
|
|
|
|
bottom: 1,
|
|
|
|
title: (m.searchedChats![index].userName ?? "").toText14(color: MyColors.darkTextColor),
|
|
|
|
child: Container(
|
|
|
|
// subtitle: (m.searchedChats![index].isTyping == true ? "Typing ..." : "").toText11(color: MyColors.normalTextColor),
|
|
|
|
width: 10,
|
|
|
|
trailing: SizedBox(
|
|
|
|
height: 10,
|
|
|
|
width: 60,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
child: Row(
|
|
|
|
color: m.searchedChats![index].userStatus == 1 ? MyColors.green2DColor : Colors.red,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
borderRadius: const BorderRadius.all(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
Radius.circular(10),
|
|
|
|
mainAxisSize: MainAxisSize.max,
|
|
|
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
|
|
|
if (m.searchedChats![index].unreadMessageCount! > 0)
|
|
|
|
|
|
|
|
Flexible(
|
|
|
|
|
|
|
|
child: Container(
|
|
|
|
|
|
|
|
padding: EdgeInsets.zero,
|
|
|
|
|
|
|
|
alignment: Alignment.centerRight,
|
|
|
|
|
|
|
|
width: 18,
|
|
|
|
|
|
|
|
height: 18,
|
|
|
|
|
|
|
|
decoration: const BoxDecoration(
|
|
|
|
|
|
|
|
color: MyColors.redColor,
|
|
|
|
|
|
|
|
borderRadius: BorderRadius.all(
|
|
|
|
|
|
|
|
Radius.circular(20),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
child: (m.searchedChats![index].unreadMessageCount!.toString())
|
|
|
|
|
|
|
|
.toText10(
|
|
|
|
|
|
|
|
color: MyColors.white,
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
.center,
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Flexible(
|
|
|
|
|
|
|
|
child: IconButton(
|
|
|
|
|
|
|
|
alignment: Alignment.centerRight,
|
|
|
|
|
|
|
|
padding: EdgeInsets.zero,
|
|
|
|
|
|
|
|
icon: Icon(m.searchedChats![index].isFav! ? Icons.star : Icons.star_border),
|
|
|
|
|
|
|
|
color: m.searchedChats![index].isFav! ? MyColors.yellowColor : MyColors.grey35Color,
|
|
|
|
|
|
|
|
onPressed: () {
|
|
|
|
|
|
|
|
if (m.searchedChats![index].isFav!) m.unFavoriteUser(userID: AppState().chatDetails!.response!.id!, targetUserID: m.searchedChats![index].id!);
|
|
|
|
|
|
|
|
if (!m.searchedChats![index].isFav!) m.favoriteUser(userID: AppState().chatDetails!.response!.id!, targetUserID: m.searchedChats![index].id!);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
)
|
|
|
|
)
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
title: (m.searchedChats![index].userName ?? "").toText14(color: MyColors.darkTextColor),
|
|
|
|
|
|
|
|
// subtitle: (m.searchedChats![index].isTyping == true ? "Typing ..." : "").toText11(color: MyColors.normalTextColor),
|
|
|
|
|
|
|
|
trailing: SizedBox(
|
|
|
|
|
|
|
|
width: 60,
|
|
|
|
|
|
|
|
child: Row(
|
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
|
|
|
|
mainAxisSize: MainAxisSize.max,
|
|
|
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
|
|
|
if (m.searchedChats![index].unreadMessageCount! > 0)
|
|
|
|
|
|
|
|
Flexible(
|
|
|
|
|
|
|
|
child: Container(
|
|
|
|
|
|
|
|
padding: EdgeInsets.zero,
|
|
|
|
|
|
|
|
alignment: Alignment.centerRight,
|
|
|
|
|
|
|
|
width: 18,
|
|
|
|
|
|
|
|
height: 18,
|
|
|
|
|
|
|
|
decoration: const BoxDecoration(
|
|
|
|
|
|
|
|
color: MyColors.redColor,
|
|
|
|
|
|
|
|
borderRadius: BorderRadius.all(
|
|
|
|
|
|
|
|
Radius.circular(20),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
child: (m.searchedChats![index].unreadMessageCount!.toString())
|
|
|
|
|
|
|
|
.toText10(
|
|
|
|
|
|
|
|
color: MyColors.white,
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
.center,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
Flexible(
|
|
|
|
|
|
|
|
child: IconButton(
|
|
|
|
|
|
|
|
alignment: Alignment.centerRight,
|
|
|
|
|
|
|
|
padding: EdgeInsets.zero,
|
|
|
|
|
|
|
|
icon: Icon(m.searchedChats![index].isFav! ? Icons.star : Icons.star_border),
|
|
|
|
|
|
|
|
color: m.searchedChats![index].isFav! ? MyColors.yellowColor : MyColors.grey35Color,
|
|
|
|
|
|
|
|
onPressed: () {
|
|
|
|
|
|
|
|
if (m.searchedChats![index].isFav!) m.unFavoriteUser(userID: AppState().chatDetails!.response!.id!, targetUserID: m.searchedChats![index].id!);
|
|
|
|
|
|
|
|
if (!m.searchedChats![index].isFav!) m.favoriteUser(userID: AppState().chatDetails!.response!.id!, targetUserID: m.searchedChats![index].id!);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
minVerticalPadding: 0,
|
|
|
|
|
|
|
|
onTap: () {
|
|
|
|
|
|
|
|
Navigator.pushNamed(
|
|
|
|
|
|
|
|
context,
|
|
|
|
|
|
|
|
AppRoutes.chatDetailed,
|
|
|
|
|
|
|
|
arguments: {"targetUser": m.searchedChats![index]},
|
|
|
|
|
|
|
|
).then((value) {
|
|
|
|
|
|
|
|
m.clearSelections();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
onLongPress: () {},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
minVerticalPadding: 0,
|
|
|
|
);
|
|
|
|
onTap: () {
|
|
|
|
},
|
|
|
|
Navigator.pushNamed(
|
|
|
|
separatorBuilder: (BuildContext context, int index) => const Padding(
|
|
|
|
context,
|
|
|
|
padding: EdgeInsets.only(right: 10, left: 70),
|
|
|
|
AppRoutes.chatDetailed,
|
|
|
|
child: Divider(
|
|
|
|
arguments: {"targetUser": m.searchedChats![index]},
|
|
|
|
color: Color(0xFFE5E5E5),
|
|
|
|
).then((value) {
|
|
|
|
|
|
|
|
m.clearSelections();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
onLongPress: () {},
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
separatorBuilder: (BuildContext context, int index) => const Padding(
|
|
|
|
|
|
|
|
padding: EdgeInsets.only(right: 10, left: 70),
|
|
|
|
|
|
|
|
child: Divider(
|
|
|
|
|
|
|
|
color: Color(0xFFE5E5E5),
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
);
|
|
|
|
);
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
),
|
|
|
|
floatingActionButton: FloatingActionButton(
|
|
|
|
floatingActionButton: FloatingActionButton(
|
|
|
|
child: Container(
|
|
|
|
child: Container(
|
|
|
|
width: 60,
|
|
|
|
width: 60,
|
|
|
|
|