Design improvements
This commit is contained in:
parent
e5aa94bb62
commit
ec9e8fe5d4
10 changed files with 278 additions and 159 deletions
|
|
@ -9,6 +9,7 @@ import 'package:fluffychat/utils/event_extension.dart';
|
|||
import 'package:fluffychat/utils/string_color.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../adaptive_page_layout.dart';
|
||||
import '../avatar.dart';
|
||||
import '../matrix.dart';
|
||||
import 'state_message.dart';
|
||||
|
|
@ -74,74 +75,78 @@ class Message extends StatelessWidget {
|
|||
margin: BubbleEdges.symmetric(horizontal: 4),
|
||||
color: color,
|
||||
nip: nip,
|
||||
child: Stack(
|
||||
children: <Widget>[
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
if (event.isReply)
|
||||
FutureBuilder<Event>(
|
||||
future: event.getReplyEvent(timeline),
|
||||
builder: (BuildContext context, snapshot) {
|
||||
final replyEvent = snapshot.hasData
|
||||
? snapshot.data
|
||||
: Event(
|
||||
eventId: event.content['m.relates_to']
|
||||
['m.in_reply_to']['event_id'],
|
||||
content: {'msgtype': 'm.text', 'body': '...'},
|
||||
senderId: event.senderId,
|
||||
typeKey: 'm.room.message',
|
||||
room: event.room,
|
||||
roomId: event.roomId,
|
||||
status: 1,
|
||||
time: DateTime.now(),
|
||||
);
|
||||
return Container(
|
||||
margin: EdgeInsets.symmetric(vertical: 4.0),
|
||||
child:
|
||||
ReplyContent(replyEvent, lightText: ownMessage),
|
||||
);
|
||||
},
|
||||
),
|
||||
MessageContent(
|
||||
event,
|
||||
textColor: textColor,
|
||||
),
|
||||
if (event.type == EventTypes.Encrypted &&
|
||||
event.messageType == MessageTypes.BadEncrypted &&
|
||||
event.content['body'] == DecryptError.UNKNOWN_SESSION)
|
||||
RaisedButton(
|
||||
color: color.withAlpha(100),
|
||||
child: Text(
|
||||
L10n.of(context).requestPermission,
|
||||
style: TextStyle(color: textColor),
|
||||
child: Container(
|
||||
constraints:
|
||||
BoxConstraints(maxWidth: AdaptivePageLayout.defaultMinWidth),
|
||||
child: Stack(
|
||||
children: <Widget>[
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
if (event.isReply)
|
||||
FutureBuilder<Event>(
|
||||
future: event.getReplyEvent(timeline),
|
||||
builder: (BuildContext context, snapshot) {
|
||||
final replyEvent = snapshot.hasData
|
||||
? snapshot.data
|
||||
: Event(
|
||||
eventId: event.content['m.relates_to']
|
||||
['m.in_reply_to']['event_id'],
|
||||
content: {'msgtype': 'm.text', 'body': '...'},
|
||||
senderId: event.senderId,
|
||||
typeKey: 'm.room.message',
|
||||
room: event.room,
|
||||
roomId: event.roomId,
|
||||
status: 1,
|
||||
time: DateTime.now(),
|
||||
);
|
||||
return Container(
|
||||
margin: EdgeInsets.symmetric(vertical: 4.0),
|
||||
child:
|
||||
ReplyContent(replyEvent, lightText: ownMessage),
|
||||
);
|
||||
},
|
||||
),
|
||||
onPressed: () => SimpleDialogs(context)
|
||||
.tryRequestWithLoadingDialog(event.requestKey()),
|
||||
),
|
||||
SizedBox(height: 4),
|
||||
Opacity(
|
||||
opacity: 0,
|
||||
child: _MetaRow(
|
||||
MessageContent(
|
||||
event,
|
||||
ownMessage,
|
||||
textColor,
|
||||
textColor: textColor,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Positioned(
|
||||
bottom: 0,
|
||||
right: ownMessage ? 0 : null,
|
||||
left: !ownMessage ? 0 : null,
|
||||
child: _MetaRow(
|
||||
event,
|
||||
ownMessage,
|
||||
textColor,
|
||||
if (event.type == EventTypes.Encrypted &&
|
||||
event.messageType == MessageTypes.BadEncrypted &&
|
||||
event.content['body'] == DecryptError.UNKNOWN_SESSION)
|
||||
RaisedButton(
|
||||
color: color.withAlpha(100),
|
||||
child: Text(
|
||||
L10n.of(context).requestPermission,
|
||||
style: TextStyle(color: textColor),
|
||||
),
|
||||
onPressed: () => SimpleDialogs(context)
|
||||
.tryRequestWithLoadingDialog(event.requestKey()),
|
||||
),
|
||||
SizedBox(height: 4),
|
||||
Opacity(
|
||||
opacity: 0,
|
||||
child: _MetaRow(
|
||||
event,
|
||||
ownMessage,
|
||||
textColor,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
Positioned(
|
||||
bottom: 0,
|
||||
right: ownMessage ? 0 : null,
|
||||
left: !ownMessage ? 0 : null,
|
||||
child: _MetaRow(
|
||||
event,
|
||||
ownMessage,
|
||||
textColor,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue