- Unfoces input box when click image
This commit is contained in:
Linloir 2022-10-23 13:14:48 +08:00
parent cda708bfc8
commit bf499f2434
No known key found for this signature in database
GPG Key ID: 58EEB209A0F2C366
3 changed files with 11 additions and 4 deletions

View File

@ -1,7 +1,7 @@
/*
* @Author : Linloir
* @Date : 2022-10-13 14:03:56
* @LastEditTime : 2022-10-22 22:46:18
* @LastEditTime : 2022-10-23 13:07:08
* @Description :
*/
@ -38,8 +38,11 @@ class ChatCubit extends Cubit<ChatState> {
late final StreamSubscription subscription;
final Map<String, StreamSubscription> messageSendSubscriptionMap = {};
final Map<String, StreamSubscription> fileFetchSubscriptionMap = {};
final FocusNode inputNode = FocusNode();
void unFocus() {
inputNode.unfocus();
}
Future<void> addMessage(Message message) async {
var msg = message;

View File

@ -1,14 +1,16 @@
/*
* @Author : Linloir
* @Date : 2022-10-14 17:04:20
* @LastEditTime : 2022-10-23 11:35:10
* @LastEditTime : 2022-10-23 13:00:51
* @Description :
*/
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:photo_view/photo_view.dart';
import 'package:tcp_client/chat/cubit/chat_cubit.dart';
import 'package:tcp_client/chat/model/chat_history.dart';
class ImageBox extends StatelessWidget {
@ -37,6 +39,7 @@ class ImageBox extends StatelessWidget {
child: InkWell(
splashColor: Colors.white.withOpacity(0.1),
onTap: (){
context.read<ChatCubit>().unFocus();
var image = history.preCachedImage?.image ?? Image.memory(base64.decode(history.message.contentDecoded)).image;
Navigator.of(context).push(MaterialPageRoute(
builder:(context) {

View File

@ -1,7 +1,7 @@
/*
* @Author : Linloir
* @Date : 2022-10-14 17:54:30
* @LastEditTime : 2022-10-23 10:13:22
* @LastEditTime : 2022-10-23 13:03:12
* @Description :
*/
@ -67,6 +67,7 @@ class InputBox extends StatelessWidget {
onChanged: (value) {
context.read<MessageInputCubit>().onInputChange(MessageInput.dirty(value));
},
focusNode: context.read<ChatCubit>().inputNode,
maxLines: null,
decoration: const InputDecoration(
border: UnderlineInputBorder(