Remove message bubbles

This commit is contained in:
Christian Pauly 2020-09-19 16:21:57 +02:00
parent 8547422f80
commit 7b1262f355
5 changed files with 31 additions and 46 deletions

View File

@ -1,4 +1,3 @@
import 'package:bubble/bubble.dart';
import 'package:famedlysdk/famedlysdk.dart'; import 'package:famedlysdk/famedlysdk.dart';
import 'package:fluffychat/utils/app_route.dart'; import 'package:fluffychat/utils/app_route.dart';
import 'package:fluffychat/views/image_view.dart'; import 'package:fluffychat/views/image_view.dart';
@ -71,11 +70,8 @@ class _ImageBubbleState extends State<ImageBubble> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Bubble( return ClipRRect(
padding: BubbleEdges.all(0), borderRadius: BorderRadius.circular(widget.radius),
radius: Radius.circular(widget.radius),
color: widget.backgroundColor ?? Theme.of(context).secondaryHeaderColor,
elevation: 0,
child: Container( child: Container(
height: widget.maxSize ? 300 : null, height: widget.maxSize ? 300 : null,
width: widget.maxSize ? 400 : null, width: widget.maxSize ? 400 : null,

View File

@ -1,4 +1,3 @@
import 'package:bubble/bubble.dart';
import 'package:famedlysdk/famedlysdk.dart'; import 'package:famedlysdk/famedlysdk.dart';
import 'package:fluffychat/components/dialogs/simple_dialogs.dart'; import 'package:fluffychat/components/dialogs/simple_dialogs.dart';
import 'package:fluffychat/components/message_content.dart'; import 'package:fluffychat/components/message_content.dart';
@ -9,7 +8,6 @@ import 'package:fluffychat/utils/event_extension.dart';
import 'package:fluffychat/utils/string_color.dart'; import 'package:fluffychat/utils/string_color.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../adaptive_page_layout.dart';
import '../avatar.dart'; import '../avatar.dart';
import '../matrix.dart'; import '../matrix.dart';
import '../message_reactions.dart'; import '../message_reactions.dart';
@ -56,9 +54,6 @@ class Message extends StatelessWidget {
[EventTypes.Message, EventTypes.Sticker].contains(nextEvent.type) [EventTypes.Message, EventTypes.Sticker].contains(nextEvent.type)
? nextEvent.sender.id == event.sender.id ? nextEvent.sender.id == event.sender.id
: false; : false;
var nip = sameSender
? BubbleNip.no
: ownMessage ? BubbleNip.rightBottom : BubbleNip.leftBottom;
var textColor = ownMessage var textColor = ownMessage
? Colors.white ? Colors.white
: Theme.of(context).brightness == Brightness.dark : Theme.of(context).brightness == Brightness.dark
@ -70,7 +65,7 @@ class Message extends StatelessWidget {
final displayEvent = event.getDisplayEvent(timeline); final displayEvent = event.getDisplayEvent(timeline);
if (event.showThumbnail) { if (event.showThumbnail) {
color = Theme.of(context).scaffoldBackgroundColor.withOpacity(0.66); color = Theme.of(context).scaffoldBackgroundColor;
textColor = Theme.of(context).textTheme.bodyText2.color; textColor = Theme.of(context).textTheme.bodyText2.color;
} else if (ownMessage) { } else if (ownMessage) {
color = displayEvent.status == -1 color = displayEvent.status == -1
@ -78,18 +73,19 @@ class Message extends StatelessWidget {
: Theme.of(context).primaryColor; : Theme.of(context).primaryColor;
} }
final radius = 16.0;
var rowChildren = <Widget>[ var rowChildren = <Widget>[
Expanded( Expanded(
child: Bubble( child: Container(
elevation: 0,
radius: Radius.circular(8),
alignment: alignment, alignment: alignment,
margin: BubbleEdges.symmetric(horizontal: 4),
color: color,
nip: nip,
child: Container( child: Container(
constraints: margin: const EdgeInsets.symmetric(horizontal: 8),
BoxConstraints(maxWidth: AdaptivePageLayout.defaultMinWidth), padding: const EdgeInsets.symmetric(vertical: 6, horizontal: 10),
decoration: BoxDecoration(
color: color,
borderRadius: BorderRadius.circular(radius),
),
child: Stack( child: Stack(
children: <Widget>[ children: <Widget>[
Column( Column(
@ -220,15 +216,12 @@ class Message extends StatelessWidget {
onTap: !useMouse && longPressSelect ? () => null : () => onSelect(event), onTap: !useMouse && longPressSelect ? () => null : () => onSelect(event),
splashColor: Theme.of(context).primaryColor.withAlpha(100), splashColor: Theme.of(context).primaryColor.withAlpha(100),
onLongPress: !longPressSelect ? null : () => onSelect(event), onLongPress: !longPressSelect ? null : () => onSelect(event),
child: AnimatedContainer( child: Container(
duration: Duration(milliseconds: 300),
curve: Curves.fastOutSlowIn,
color: selected color: selected
? Theme.of(context).primaryColor.withAlpha(100) ? Theme.of(context).primaryColor.withAlpha(100)
: Theme.of(context).primaryColor.withAlpha(0), : Theme.of(context).primaryColor.withAlpha(0),
child: Padding( child: Padding(
padding: EdgeInsets.only( padding: EdgeInsets.only(left: 8.0, right: 8.0, bottom: 8.0),
left: 8.0, right: 8.0, bottom: sameSender ? 4.0 : 8.0),
child: container, child: container,
), ),
), ),
@ -262,22 +255,25 @@ class _MetaRow extends StatelessWidget {
style: TextStyle( style: TextStyle(
fontSize: 11, fontSize: 11,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: displayname.color, color: displayname.color.withAlpha(200),
), ),
), ),
if (showDisplayname) SizedBox(width: 4), if (showDisplayname) SizedBox(width: 4),
Text( Text(
event.originServerTs.localizedTime(context), event.originServerTs.localizedTime(context),
style: TextStyle( style: TextStyle(
color: color, color: color.withAlpha(200),
fontSize: 11, fontSize: 11,
), ),
), ),
if (event.hasAggregatedEvents(timeline, RelationshipTypes.Edit)) if (event.hasAggregatedEvents(timeline, RelationshipTypes.Edit))
Icon( Padding(
Icons.edit, padding: const EdgeInsets.only(left: 2.0),
size: 12, child: Icon(
color: color, Icons.edit,
size: 12,
color: color,
),
), ),
if (ownMessage) SizedBox(width: 2), if (ownMessage) SizedBox(width: 2),
if (ownMessage) if (ownMessage)

View File

@ -1,4 +1,3 @@
import 'package:bubble/bubble.dart';
import 'package:famedlysdk/famedlysdk.dart'; import 'package:famedlysdk/famedlysdk.dart';
import 'package:fluffychat/l10n/l10n.dart'; import 'package:fluffychat/l10n/l10n.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -14,12 +13,14 @@ class StateMessage extends StatelessWidget {
padding: const EdgeInsets.only( padding: const EdgeInsets.only(
left: 8.0, left: 8.0,
right: 8.0, right: 8.0,
bottom: 8.0, bottom: 16.0,
), ),
child: Bubble( child: Container(
elevation: 0,
color: Theme.of(context).backgroundColor.withOpacity(0.66),
alignment: Alignment.center, alignment: Alignment.center,
decoration: BoxDecoration(
color: Theme.of(context).backgroundColor.withOpacity(0.66),
borderRadius: BorderRadius.circular(7),
),
child: Text( child: Text(
event.getLocalizedBody(L10n.of(context)), event.getLocalizedBody(L10n.of(context)),
textAlign: TextAlign.center, textAlign: TextAlign.center,

View File

@ -71,13 +71,6 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.0.1" version: "3.0.1"
bubble:
dependency: "direct main"
description:
name: bubble
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.9+1"
cached_network_image: cached_network_image:
dependency: "direct main" dependency: "direct main"
description: description:
@ -187,8 +180,8 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
path: "." path: "."
ref: "510de0530434e392a281f197f77a9c49349e7fc2" ref: "864cbfa9068f5bb285336ca73ab2551204e62044"
resolved-ref: "510de0530434e392a281f197f77a9c49349e7fc2" resolved-ref: "864cbfa9068f5bb285336ca73ab2551204e62044"
url: "https://gitlab.com/famedly/famedlysdk.git" url: "https://gitlab.com/famedly/famedlysdk.git"
source: git source: git
version: "0.0.1" version: "0.0.1"

View File

@ -30,7 +30,6 @@ dependencies:
ref: 864cbfa9068f5bb285336ca73ab2551204e62044 ref: 864cbfa9068f5bb285336ca73ab2551204e62044
localstorage: ^3.0.1+4 localstorage: ^3.0.1+4
bubble: ^1.1.9+1
memoryfilepicker: ^0.1.3 memoryfilepicker: ^0.1.3
url_launcher: ^5.4.1 url_launcher: ^5.4.1
url_launcher_web: ^0.1.0 url_launcher_web: ^0.1.0