mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-26 06:49:22 +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 ErrorLevel { NONE, MINOR, MAJOR }
|
||||||
enum _OlderMessagesLevel { NONE, LOADING, NO_MORE_AVAILABLE }
|
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 {
|
class ConversationScreen extends StatefulWidget {
|
||||||
final int conversationID;
|
final int conversationID;
|
||||||
|
|
||||||
@ -109,6 +81,33 @@ class _ConversationScreenState extends SafeState<ConversationScreen> {
|
|||||||
|
|
||||||
showEmojiContainer() => setState(() => _showEmojiPicker = true);
|
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
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
@ -402,13 +401,13 @@ class _ConversationScreenState extends SafeState<ConversationScreen> {
|
|||||||
|
|
||||||
/// Send new message form
|
/// Send new message form
|
||||||
Widget _buildSendMessageForm() => Container(
|
Widget _buildSendMessageForm() => Container(
|
||||||
padding: EdgeInsets.all(10),
|
padding: EdgeInsets.fromLTRB(10, 5, 10, 5),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: !_isSendingMessage ? _sendFileMessage : null,
|
onTap: !_isSendingMessage ? _sendFileMessage : null,
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: EdgeInsets.all(10),
|
padding: EdgeInsets.all(6),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
gradient:
|
gradient:
|
||||||
_isSendingMessage ? _disabledGradient : _fabGradient,
|
_isSendingMessage ? _disabledGradient : _fabGradient,
|
||||||
@ -448,7 +447,7 @@ class _ConversationScreenState extends SafeState<ConversationScreen> {
|
|||||||
const Radius.circular(50.0),
|
const Radius.circular(50.0),
|
||||||
),
|
),
|
||||||
borderSide: BorderSide.none),
|
borderSide: BorderSide.none),
|
||||||
contentPadding: EdgeInsets.fromLTRB(20, 10, 32, 10),
|
contentPadding: EdgeInsets.fromLTRB(20, 8, 32, 8),
|
||||||
filled: true,
|
filled: true,
|
||||||
fillColor: _separatorColor,
|
fillColor: _separatorColor,
|
||||||
),
|
),
|
||||||
@ -476,20 +475,21 @@ class _ConversationScreenState extends SafeState<ConversationScreen> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Container(
|
SizedBox(width: 5),
|
||||||
margin: EdgeInsets.only(left: 10),
|
GestureDetector(
|
||||||
|
onTap: _isMessageValid ? _submitTextMessage : null,
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.all(8),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
gradient: _isWriting ? _fabGradient : _disabledGradient,
|
gradient: !_isMessageValid ? _disabledGradient : _fabGradient,
|
||||||
shape: BoxShape.circle,
|
shape: BoxShape.circle,
|
||||||
),
|
),
|
||||||
child: IconButton(
|
child: Icon(
|
||||||
icon: Icon(
|
|
||||||
Icons.send,
|
Icons.send,
|
||||||
size: 15,
|
|
||||||
color: darkTheme() ? Colors.black : Colors.white,
|
color: darkTheme() ? Colors.black : Colors.white,
|
||||||
),
|
),
|
||||||
onPressed: _isWriting ? _submitTextMessage : null,
|
),
|
||||||
))
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -523,7 +523,6 @@ class _ConversationScreenState extends SafeState<ConversationScreen> {
|
|||||||
: null,
|
: null,
|
||||||
),
|
),
|
||||||
_messages.length == 0 ? _buildNoMessagesNotice() : _buildMessagesList(),
|
_messages.length == 0 ? _buildNoMessagesNotice() : _buildMessagesList(),
|
||||||
Divider(),
|
|
||||||
_buildSendMessageForm(),
|
_buildSendMessageForm(),
|
||||||
_showEmojiPicker ? _buildEmojiContainer() : Container(),
|
_showEmojiPicker ? _buildEmojiContainer() : Container(),
|
||||||
],
|
],
|
||||||
|
Loading…
Reference in New Issue
Block a user