|
|
|
@ -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,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|