Merge branch 'krille/minor-fixes' into 'main'

Krille/minor fixes

See merge request famedly/fluffychat!571
This commit is contained in:
Krille Fear 2021-11-23 07:58:39 +00:00
commit f6699bf87f
6 changed files with 38 additions and 26 deletions

View File

@ -43,6 +43,7 @@ abstract class AppConfig {
static const bool hideTypingUsernames = false; static const bool hideTypingUsernames = false;
static const bool hideAllStateEvents = false; static const bool hideAllStateEvents = false;
static const String inviteLinkPrefix = 'https://matrix.to/#/'; static const String inviteLinkPrefix = 'https://matrix.to/#/';
static const String deepLinkPrefix = 'im.fluffychat://chat/';
static const String schemePrefix = 'matrix:'; static const String schemePrefix = 'matrix:';
static const String pushNotificationsChannelId = 'fluffychat_push'; static const String pushNotificationsChannelId = 'fluffychat_push';
static const String pushNotificationsChannelName = 'FluffyChat push channel'; static const String pushNotificationsChannelName = 'FluffyChat push channel';

View File

@ -135,7 +135,7 @@ abstract class FluffyThemes {
primary: FluffyThemes.lighten(AppConfig.chatColor, 0.33), primary: FluffyThemes.lighten(AppConfig.chatColor, 0.33),
secondary: FluffyThemes.lighten(AppConfig.chatColor, 0.33), secondary: FluffyThemes.lighten(AppConfig.chatColor, 0.33),
secondaryVariant: AppConfig.secondaryColor, secondaryVariant: AppConfig.secondaryColor,
surface: FluffyThemes.darken(AppConfig.chatColor, 0.4), surface: FluffyThemes.darken(AppConfig.chatColor, 0.35),
), ),
secondaryHeaderColor: Colors.blueGrey.shade900, secondaryHeaderColor: Colors.blueGrey.shade900,
textTheme: Typography.material2018().white.merge(fallbackTextTheme), textTheme: Typography.material2018().white.merge(fallbackTextTheme),

View File

@ -83,7 +83,10 @@ class ChatView extends StatelessWidget {
child: Row( child: Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
const Icon(Icons.report_outlined), const Icon(
Icons.shield_outlined,
color: Colors.red,
),
const SizedBox(width: 12), const SizedBox(width: 12),
Text(L10n.of(context).reportMessage), Text(L10n.of(context).reportMessage),
], ],
@ -331,7 +334,7 @@ class ChatView extends StatelessWidget {
.secondaryHeaderColor .secondaryHeaderColor
.withAlpha(100), .withAlpha(100),
clipBehavior: Clip.hardEdge, clipBehavior: Clip.hardEdge,
color: Theme.of(context).backgroundColor, color: Theme.of(context).appBarTheme.backgroundColor,
child: SafeArea( child: SafeArea(
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,

View File

@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/utils/date_time_extension.dart'; import 'package:fluffychat/utils/date_time_extension.dart';
import 'package:fluffychat/widgets/avatar.dart'; import 'package:fluffychat/widgets/avatar.dart';
@ -27,7 +28,7 @@ class EventInfoDialog extends StatelessWidget {
String get prettyJson { String get prettyJson {
const JsonDecoder decoder = JsonDecoder(); const JsonDecoder decoder = JsonDecoder();
const JsonEncoder encoder = JsonEncoder.withIndent(' '); const JsonEncoder encoder = JsonEncoder.withIndent(' ');
final object = decoder.convert(jsonEncode(event.toJson())); final object = decoder.convert(jsonEncode(event.toJson()));
return encoder.convert(object); return encoder.convert(object);
} }
@ -52,7 +53,7 @@ class EventInfoDialog extends StatelessWidget {
), ),
title: Text(L10n.of(context).sender), title: Text(L10n.of(context).sender),
subtitle: subtitle:
Text('${event.sender.calcDisplayname()} <${event.senderId}>'), Text('${event.sender.calcDisplayname()} [${event.senderId}]'),
), ),
ListTile( ListTile(
title: Text(L10n.of(context).time), title: Text(L10n.of(context).time),
@ -62,14 +63,17 @@ class EventInfoDialog extends StatelessWidget {
title: Text(L10n.of(context).messageType), title: Text(L10n.of(context).messageType),
subtitle: Text(event.humanreadableType), subtitle: Text(event.humanreadableType),
), ),
ListTile( ListTile(title: Text('${L10n.of(context).sourceCode}:')),
title: Text(L10n.of(context).sourceCode),
),
Padding( Padding(
padding: const EdgeInsets.all(12.0), padding: const EdgeInsets.all(12.0),
child: SingleChildScrollView( child: Material(
scrollDirection: Axis.horizontal, borderRadius: BorderRadius.circular(AppConfig.borderRadius),
child: Text(prettyJson), color: Theme.of(context).colorScheme.surface,
child: SingleChildScrollView(
padding: const EdgeInsets.all(8),
scrollDirection: Axis.horizontal,
child: SelectableText(prettyJson),
),
), ),
), ),
], ],

View File

@ -220,22 +220,25 @@ class Message extends StatelessWidget {
), ),
if (event.hasAggregatedEvents( if (event.hasAggregatedEvents(
timeline, RelationshipTypes.edit)) timeline, RelationshipTypes.edit))
Row( Padding(
mainAxisSize: MainAxisSize.min, padding: const EdgeInsets.only(top: 4.0),
children: [ child: Row(
Icon( mainAxisSize: MainAxisSize.min,
Icons.edit_outlined, children: [
color: textColor.withAlpha(164), Icon(
size: 14, Icons.edit_outlined,
),
Text(
' - ${displayEvent.originServerTs.localizedTimeShort(context)}',
style: TextStyle(
color: textColor.withAlpha(164), color: textColor.withAlpha(164),
fontSize: 12, size: 14,
), ),
), Text(
], ' - ${displayEvent.originServerTs.localizedTimeShort(context)}',
style: TextStyle(
color: textColor.withAlpha(164),
fontSize: 12,
),
),
],
),
), ),
], ],
), ),

View File

@ -20,7 +20,8 @@ class UrlLauncher {
const UrlLauncher(this.context, this.url); const UrlLauncher(this.context, this.url);
void launchUrl() { void launchUrl() {
if (url.toLowerCase().startsWith(AppConfig.inviteLinkPrefix) || if (url.toLowerCase().startsWith(AppConfig.deepLinkPrefix) ||
url.toLowerCase().startsWith(AppConfig.inviteLinkPrefix) ||
{'#', '@', '!', '+', '\$'}.contains(url[0]) || {'#', '@', '!', '+', '\$'}.contains(url[0]) ||
url.toLowerCase().startsWith(AppConfig.schemePrefix)) { url.toLowerCase().startsWith(AppConfig.schemePrefix)) {
return openMatrixToUrl(); return openMatrixToUrl();