mirror of
https://github.com/Linloir/Simple-TCP-Client.git
synced 2025-12-18 17:28:11 +08:00
Improvements:
- Ctrl + Enter send message
This commit is contained in:
parent
4366a49466
commit
04f57dfb8a
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* @Author : Linloir
|
* @Author : Linloir
|
||||||
* @Date : 2022-10-14 17:54:30
|
* @Date : 2022-10-14 17:54:30
|
||||||
* @LastEditTime : 2022-10-19 23:33:25
|
* @LastEditTime : 2022-10-20 11:18:48
|
||||||
* @Description :
|
* @Description :
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -9,6 +9,7 @@ import 'dart:convert';
|
|||||||
|
|
||||||
import 'package:file_picker/file_picker.dart';
|
import 'package:file_picker/file_picker.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:formz/formz.dart';
|
import 'package:formz/formz.dart';
|
||||||
import 'package:path/path.dart';
|
import 'package:path/path.dart';
|
||||||
@ -43,26 +44,39 @@ class InputBox extends StatelessWidget {
|
|||||||
listener: (context, state) {
|
listener: (context, state) {
|
||||||
_controller.clear();
|
_controller.clear();
|
||||||
},
|
},
|
||||||
child: Container(
|
child: BlocBuilder<MessageInputCubit, MessageInputState>(
|
||||||
constraints: const BoxConstraints(maxHeight: 120),
|
builder:(context, state) {
|
||||||
child: Builder(
|
return Container(
|
||||||
builder: (context) => TextField(
|
constraints: const BoxConstraints(maxHeight: 120),
|
||||||
controller: _controller,
|
child: Builder(
|
||||||
onChanged: (value) {
|
builder: (context) => CallbackShortcuts(
|
||||||
context.read<MessageInputCubit>().onInputChange(MessageInput.dirty(value));
|
bindings: {
|
||||||
},
|
const SingleActivator(LogicalKeyboardKey.enter, control: true): () {
|
||||||
maxLines: null,
|
if(state.status == FormzStatus.valid) {
|
||||||
decoration: const InputDecoration(
|
context.read<MessageInputCubit>().onSubmission();
|
||||||
border: UnderlineInputBorder(
|
}
|
||||||
borderSide: BorderSide(
|
}
|
||||||
width: 1.0
|
},
|
||||||
)
|
child: TextField(
|
||||||
|
controller: _controller,
|
||||||
|
onChanged: (value) {
|
||||||
|
context.read<MessageInputCubit>().onInputChange(MessageInput.dirty(value));
|
||||||
|
},
|
||||||
|
maxLines: null,
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
border: UnderlineInputBorder(
|
||||||
|
borderSide: BorderSide(
|
||||||
|
width: 1.0
|
||||||
|
)
|
||||||
|
),
|
||||||
|
hintText: 'Input message here'
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
hintText: 'Input message here'
|
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
),
|
}
|
||||||
)
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 8.0,),
|
const SizedBox(width: 8.0,),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user