|
|
|
@ -1,3 +1,5 @@
|
|
|
|
|
|
|
|
import 'dart:convert';
|
|
|
|
|
|
|
|
|
|
|
|
import 'package:easy_localization/easy_localization.dart';
|
|
|
|
import 'package:easy_localization/easy_localization.dart';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
@ -7,7 +9,6 @@ import 'package:mohem_flutter_app/app_state/app_state.dart';
|
|
|
|
import 'package:mohem_flutter_app/classes/colors.dart';
|
|
|
|
import 'package:mohem_flutter_app/classes/colors.dart';
|
|
|
|
import 'package:mohem_flutter_app/config/routes.dart';
|
|
|
|
import 'package:mohem_flutter_app/config/routes.dart';
|
|
|
|
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
|
|
|
|
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
|
|
|
|
import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
|
|
|
|
|
|
|
|
import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
|
|
|
|
import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
|
|
|
|
import 'package:mohem_flutter_app/widgets/bottom_sheet.dart';
|
|
|
|
import 'package:mohem_flutter_app/widgets/bottom_sheet.dart';
|
|
|
|
import 'package:mohem_flutter_app/widgets/bottom_sheets/search_employee_bottom_sheet.dart';
|
|
|
|
import 'package:mohem_flutter_app/widgets/bottom_sheets/search_employee_bottom_sheet.dart';
|
|
|
|
@ -113,35 +114,41 @@ class _ChatHomeScreenState extends State<ChatHomeScreen> {
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
mainAxisSize: MainAxisSize.max,
|
|
|
|
mainAxisSize: MainAxisSize.max,
|
|
|
|
children: <Widget>[
|
|
|
|
children: <Widget>[
|
|
|
|
if (m.searchedChats![index].unreadMessageCount! > 0)
|
|
|
|
// if (m.searchedChats![index].unreadMessageCount != null)
|
|
|
|
Flexible(
|
|
|
|
// Flexible(
|
|
|
|
child: Container(
|
|
|
|
// child: Container(
|
|
|
|
padding: EdgeInsets.zero,
|
|
|
|
// padding: EdgeInsets.zero,
|
|
|
|
alignment: Alignment.centerRight,
|
|
|
|
// alignment: Alignment.centerRight,
|
|
|
|
width: 18,
|
|
|
|
// width: 18,
|
|
|
|
height: 18,
|
|
|
|
// height: 18,
|
|
|
|
decoration: const BoxDecoration(
|
|
|
|
// decoration: const BoxDecoration(
|
|
|
|
color: MyColors.redColor,
|
|
|
|
// color: MyColors.redColor,
|
|
|
|
borderRadius: BorderRadius.all(
|
|
|
|
// borderRadius: BorderRadius.all(
|
|
|
|
Radius.circular(20),
|
|
|
|
// Radius.circular(20),
|
|
|
|
),
|
|
|
|
// ),
|
|
|
|
),
|
|
|
|
// ),
|
|
|
|
child: (m.searchedChats![index].unreadMessageCount!.toString())
|
|
|
|
// child: (m.searchedChats![index].unreadMessageCount!.toString())
|
|
|
|
.toText10(
|
|
|
|
// .toText10(
|
|
|
|
color: MyColors.white,
|
|
|
|
// color: MyColors.white,
|
|
|
|
)
|
|
|
|
// )
|
|
|
|
.center,
|
|
|
|
// .center,
|
|
|
|
),
|
|
|
|
// ),
|
|
|
|
),
|
|
|
|
// ),
|
|
|
|
Flexible(
|
|
|
|
Flexible(
|
|
|
|
child: IconButton(
|
|
|
|
child: IconButton(
|
|
|
|
alignment: Alignment.centerRight,
|
|
|
|
alignment: Alignment.centerRight,
|
|
|
|
padding: EdgeInsets.zero,
|
|
|
|
padding: EdgeInsets.zero,
|
|
|
|
icon: Icon(m.searchedChats![index].isFav! ? Icons.star_sharp : Icons.star_border),
|
|
|
|
icon: Icon(m.searchedChats![index].isFav != null && m.searchedChats![index].isFav == false ? Icons.star_sharp : Icons.star_sharp),
|
|
|
|
color: m.searchedChats![index].isFav! ? MyColors.yellowColor : MyColors.grey35Color,
|
|
|
|
color: m.searchedChats![index].isFav != null && m.searchedChats![index].isFav == true ? MyColors.yellowColor : MyColors.grey35Color,
|
|
|
|
onPressed: () {
|
|
|
|
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!);
|
|
|
|
if (m.searchedChats![index].isFav == null || m.searchedChats![index].isFav == false) {
|
|
|
|
|
|
|
|
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!);
|
|
|
|
|
|
|
|
} else{
|
|
|
|
|
|
|
|
m.favoriteUser(userID: AppState().chatDetails!.response!.id!, targetUserID: m.searchedChats![index].id!);
|
|
|
|
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|