mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-22 12:59:21 +00:00
Improve send message form
This commit is contained in:
parent
e638398b2e
commit
e35a0d2fd4
@ -33,34 +33,6 @@ import 'package:mime/mime.dart';
|
||||
enum ErrorLevel { NONE, MINOR, MAJOR }
|
||||
enum _OlderMessagesLevel { NONE, LOADING, NO_MORE_AVAILABLE }
|
||||
|
||||
Color get _senderColor =>
|
||||
darkTheme() ? Color(0xff2b343b) : Colors.green.shade900;
|
||||
|
||||
Color get _receiverColor =>
|
||||
darkTheme() ? Color(0xff1e2225) : Colors.grey.shade600;
|
||||
|
||||
const _greyColor = Color(0xff8f8f8f);
|
||||
|
||||
Color get _gradientColorStart => darkTheme() ? Color(0xff00b6f3) : Colors.green;
|
||||
|
||||
Color get _gradientColorEnd =>
|
||||
darkTheme() ? Color(0xff0184dc) : Colors.greenAccent;
|
||||
|
||||
Color get _separatorColor =>
|
||||
darkTheme() ? Color(0xff272c35) : Color(0xffBEBEBE);
|
||||
|
||||
LinearGradient get _fabGradient => LinearGradient(
|
||||
colors: [_gradientColorStart, _gradientColorEnd],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
);
|
||||
|
||||
LinearGradient get _disabledGradient => LinearGradient(
|
||||
colors: [_greyColor, _receiverColor],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
);
|
||||
|
||||
class ConversationScreen extends StatefulWidget {
|
||||
final int conversationID;
|
||||
|
||||
@ -109,6 +81,33 @@ class _ConversationScreenState extends SafeState<ConversationScreen> {
|
||||
|
||||
showEmojiContainer() => setState(() => _showEmojiPicker = true);
|
||||
|
||||
// Colors definition
|
||||
Color get _receiverColor =>
|
||||
darkTheme() ? Color(0xff3a3d40) : Colors.grey.shade600;
|
||||
|
||||
Color get _greyColor => Color(0xff8f8f8f);
|
||||
|
||||
Color get _gradientColorStart =>
|
||||
darkTheme() ? Color(0xff00b6f3) : Colors.green;
|
||||
|
||||
Color get _gradientColorEnd =>
|
||||
darkTheme() ? Color(0xff0184dc) : Colors.greenAccent;
|
||||
|
||||
Color get _separatorColor =>
|
||||
darkTheme() ? Color(0xff272c35) : Color(0xffBEBEBE);
|
||||
|
||||
LinearGradient get _fabGradient => LinearGradient(
|
||||
colors: [_gradientColorStart, _gradientColorEnd],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
);
|
||||
|
||||
LinearGradient get _disabledGradient => LinearGradient(
|
||||
colors: [_greyColor, _receiverColor],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
);
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
@ -402,13 +401,13 @@ class _ConversationScreenState extends SafeState<ConversationScreen> {
|
||||
|
||||
/// Send new message form
|
||||
Widget _buildSendMessageForm() => Container(
|
||||
padding: EdgeInsets.all(10),
|
||||
padding: EdgeInsets.fromLTRB(10, 5, 10, 5),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
GestureDetector(
|
||||
onTap: !_isSendingMessage ? _sendFileMessage : null,
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(10),
|
||||
padding: EdgeInsets.all(6),
|
||||
decoration: BoxDecoration(
|
||||
gradient:
|
||||
_isSendingMessage ? _disabledGradient : _fabGradient,
|
||||
@ -448,7 +447,7 @@ class _ConversationScreenState extends SafeState<ConversationScreen> {
|
||||
const Radius.circular(50.0),
|
||||
),
|
||||
borderSide: BorderSide.none),
|
||||
contentPadding: EdgeInsets.fromLTRB(20, 10, 32, 10),
|
||||
contentPadding: EdgeInsets.fromLTRB(20, 8, 32, 8),
|
||||
filled: true,
|
||||
fillColor: _separatorColor,
|
||||
),
|
||||
@ -476,20 +475,21 @@ class _ConversationScreenState extends SafeState<ConversationScreen> {
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 10),
|
||||
SizedBox(width: 5),
|
||||
GestureDetector(
|
||||
onTap: _isMessageValid ? _submitTextMessage : null,
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
gradient: _isWriting ? _fabGradient : _disabledGradient,
|
||||
gradient: !_isMessageValid ? _disabledGradient : _fabGradient,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: IconButton(
|
||||
icon: Icon(
|
||||
child: Icon(
|
||||
Icons.send,
|
||||
size: 15,
|
||||
color: darkTheme() ? Colors.black : Colors.white,
|
||||
),
|
||||
onPressed: _isWriting ? _submitTextMessage : null,
|
||||
))
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
@ -523,7 +523,6 @@ class _ConversationScreenState extends SafeState<ConversationScreen> {
|
||||
: null,
|
||||
),
|
||||
_messages.length == 0 ? _buildNoMessagesNotice() : _buildMessagesList(),
|
||||
Divider(),
|
||||
_buildSendMessageForm(),
|
||||
_showEmojiPicker ? _buildEmojiContainer() : Container(),
|
||||
],
|
||||
|
Loading…
Reference in New Issue
Block a user