forked from eatvio/eatvio_app
fix(chat): image and clear search bar
This commit is contained in:
@@ -59,23 +59,29 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
centerTitle: false,
|
||||
title: Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 40,
|
||||
height: 40,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFFEBF4FF),
|
||||
shape: BoxShape.circle,
|
||||
if (state.chatRoom.users['to_chat_user']!.profilePhotoUrl != null)
|
||||
CircleAvatar(
|
||||
radius: 20,
|
||||
foregroundImage: NetworkImage(state.chatRoom.users['to_chat_user']!.profilePhotoUrl!),
|
||||
),
|
||||
child: Text(
|
||||
state.chatRoom.users['to_chat_user']!.name.split(' ').first[0] + state.chatRoom.users['to_chat_user']!.name.split(' ')[1][0],
|
||||
style: TextStyle(
|
||||
color: Color(0xFF7F9CF5),
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 20,
|
||||
if (state.chatRoom.users['to_chat_user']!.profilePhotoUrl == null)
|
||||
Container(
|
||||
width: 40,
|
||||
height: 40,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFFEBF4FF),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Text(
|
||||
state.chatRoom.users['to_chat_user']!.name.split(' ').first[0] + state.chatRoom.users['to_chat_user']!.name.split(' ')[1][0],
|
||||
style: TextStyle(
|
||||
color: Color(0xFF7F9CF5),
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 20,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 16),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
|
||||
@@ -39,6 +39,7 @@ class _ChatSelectScreenState extends State<ChatSelectScreen> {
|
||||
title: Padding(
|
||||
padding: const EdgeInsets.only(top: 8),
|
||||
child: ChatSearchBarWidget(
|
||||
onSuffixIconTap: () => context.read<ChatSelectCubit>().getChatRooms(),
|
||||
onChanged: (query) {
|
||||
if (query.length > 2) {
|
||||
EasyDebounce.debounce(
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:eatvio_app/core/app_export.dart';
|
||||
import 'package:eatvio_app/features/chat/presentation/bloc/chat_select_cubit/chat_select_cubit.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ChatSearchBarWidget extends StatelessWidget {
|
||||
@@ -25,6 +26,7 @@ class ChatSearchBarWidget extends StatelessWidget {
|
||||
this.filled = true,
|
||||
this.validator,
|
||||
this.onChanged,
|
||||
required this.onSuffixIconTap,
|
||||
}) : super(key: key);
|
||||
|
||||
final Alignment? alignment;
|
||||
@@ -69,6 +71,8 @@ class ChatSearchBarWidget extends StatelessWidget {
|
||||
|
||||
final Function(String)? onChanged;
|
||||
|
||||
final Function() onSuffixIconTap;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return searchViewWidget(context);
|
||||
@@ -111,7 +115,10 @@ class ChatSearchBarWidget extends StatelessWidget {
|
||||
),
|
||||
suffixIcon: suffix ??
|
||||
IconButton(
|
||||
onPressed: () => controller!.clear(),
|
||||
onPressed: () {
|
||||
controller!.clear();
|
||||
onSuffixIconTap();
|
||||
},
|
||||
icon: Icon(
|
||||
Icons.clear,
|
||||
color: Colors.grey.shade600,
|
||||
|
||||
Reference in New Issue
Block a user