Re-add mention functionality
This commit is contained in:
parent
b57326628c
commit
9d0bf230e1
2 changed files with 104 additions and 103 deletions
|
|
@ -63,13 +63,11 @@ abstract class AppConfig {
|
|||
path: '/krille-chan/fluffychat/issues/new',
|
||||
);
|
||||
// #Pangea
|
||||
// static bool renderHtml = true;
|
||||
static const bool enableSentry = true;
|
||||
static const String sentryDns =
|
||||
'https://8591d0d863b646feb4f3dda7e5dcab38@o256755.ingest.sentry.io/5243143';
|
||||
static bool renderHtml = false;
|
||||
// static bool renderHtml = true;
|
||||
// Pangea#
|
||||
static bool renderHtml = true;
|
||||
static bool hideRedactedEvents = false;
|
||||
static bool hideUnknownEvents = true;
|
||||
static bool hideUnimportantStateEvents = true;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,13 @@
|
|||
import 'package:emojis/emoji.dart';
|
||||
import 'package:fluffychat/config/app_config.dart';
|
||||
import 'package:fluffychat/pages/chat/command_hints.dart';
|
||||
import 'package:fluffychat/pangea/widgets/igc/pangea_text_controller.dart';
|
||||
import 'package:fluffychat/utils/platform_infos.dart';
|
||||
import 'package:fluffychat/widgets/avatar.dart';
|
||||
import 'package:fluffychat/widgets/mxc_image.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:flutter_typeahead/flutter_typeahead.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
import 'package:pasteboard/pasteboard.dart';
|
||||
|
|
@ -217,6 +221,7 @@ class InputBar extends StatelessWidget {
|
|||
}
|
||||
}
|
||||
}
|
||||
print("ret length: ${ret.length}");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -225,106 +230,104 @@ class InputBar extends StatelessWidget {
|
|||
Map<String, String?> suggestion,
|
||||
Client? client,
|
||||
) {
|
||||
// #Pangea
|
||||
// const size = 30.0;
|
||||
// const padding = EdgeInsets.all(4.0);
|
||||
// if (suggestion['type'] == 'command') {
|
||||
// final command = suggestion['name']!;
|
||||
// final hint = commandHint(L10n.of(context)!, command);
|
||||
// return Tooltip(
|
||||
// message: hint,
|
||||
// waitDuration: const Duration(days: 1), // don't show on hover
|
||||
// child: Container(
|
||||
// padding: padding,
|
||||
// child: Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// children: [
|
||||
// Text(
|
||||
// commandExample(command),
|
||||
// style: const TextStyle(fontFamily: 'monospace'),
|
||||
// ),
|
||||
// Text(
|
||||
// hint,
|
||||
// maxLines: 1,
|
||||
// overflow: TextOverflow.ellipsis,
|
||||
// style: Theme.of(context).textTheme.bodySmall,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// if (suggestion['type'] == 'emoji') {
|
||||
// final label = suggestion['label']!;
|
||||
// return Tooltip(
|
||||
// message: label,
|
||||
// waitDuration: const Duration(days: 1), // don't show on hover
|
||||
// child: Container(
|
||||
// padding: padding,
|
||||
// child: Text(label, style: const TextStyle(fontFamily: 'monospace')),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// if (suggestion['type'] == 'emote') {
|
||||
// return Container(
|
||||
// padding: padding,
|
||||
// child: Row(
|
||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
||||
// children: <Widget>[
|
||||
// MxcImage(
|
||||
// // ensure proper ordering ...
|
||||
// key: ValueKey(suggestion['name']),
|
||||
// uri: suggestion['mxc'] is String
|
||||
// ? Uri.parse(suggestion['mxc'] ?? '')
|
||||
// : null,
|
||||
// width: size,
|
||||
// height: size,
|
||||
// ),
|
||||
// const SizedBox(width: 6),
|
||||
// Text(suggestion['name']!),
|
||||
// Expanded(
|
||||
// child: Align(
|
||||
// alignment: Alignment.centerRight,
|
||||
// child: Opacity(
|
||||
// opacity: suggestion['pack_avatar_url'] != null ? 0.8 : 0.5,
|
||||
// child: suggestion['pack_avatar_url'] != null
|
||||
// ? Avatar(
|
||||
// mxContent: Uri.tryParse(
|
||||
// suggestion.tryGet<String>('pack_avatar_url') ?? '',
|
||||
// ),
|
||||
// name: suggestion.tryGet<String>('pack_display_name'),
|
||||
// size: size * 0.9,
|
||||
// client: client,
|
||||
// )
|
||||
// : Text(suggestion['pack_display_name']!),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// if (suggestion['type'] == 'user' || suggestion['type'] == 'room') {
|
||||
// final url = Uri.parse(suggestion['avatar_url'] ?? '');
|
||||
// return Container(
|
||||
// padding: padding,
|
||||
// child: Row(
|
||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
||||
// children: <Widget>[
|
||||
// Avatar(
|
||||
// mxContent: url,
|
||||
// name: suggestion.tryGet<String>('displayname') ??
|
||||
// suggestion.tryGet<String>('mxid'),
|
||||
// size: size,
|
||||
// client: client,
|
||||
// ),
|
||||
// const SizedBox(width: 6),
|
||||
// Text(suggestion['displayname'] ?? suggestion['mxid']!),
|
||||
// ],
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// Pangea#
|
||||
const size = 30.0;
|
||||
const padding = EdgeInsets.all(4.0);
|
||||
if (suggestion['type'] == 'command') {
|
||||
final command = suggestion['name']!;
|
||||
final hint = commandHint(L10n.of(context)!, command);
|
||||
return Tooltip(
|
||||
message: hint,
|
||||
waitDuration: const Duration(days: 1), // don't show on hover
|
||||
child: Container(
|
||||
padding: padding,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
commandExample(command),
|
||||
style: const TextStyle(fontFamily: 'monospace'),
|
||||
),
|
||||
Text(
|
||||
hint,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: Theme.of(context).textTheme.bodySmall,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
if (suggestion['type'] == 'emoji') {
|
||||
final label = suggestion['label']!;
|
||||
return Tooltip(
|
||||
message: label,
|
||||
waitDuration: const Duration(days: 1), // don't show on hover
|
||||
child: Container(
|
||||
padding: padding,
|
||||
child: Text(label, style: const TextStyle(fontFamily: 'monospace')),
|
||||
),
|
||||
);
|
||||
}
|
||||
if (suggestion['type'] == 'emote') {
|
||||
return Container(
|
||||
padding: padding,
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
MxcImage(
|
||||
// ensure proper ordering ...
|
||||
key: ValueKey(suggestion['name']),
|
||||
uri: suggestion['mxc'] is String
|
||||
? Uri.parse(suggestion['mxc'] ?? '')
|
||||
: null,
|
||||
width: size,
|
||||
height: size,
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(suggestion['name']!),
|
||||
Expanded(
|
||||
child: Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: Opacity(
|
||||
opacity: suggestion['pack_avatar_url'] != null ? 0.8 : 0.5,
|
||||
child: suggestion['pack_avatar_url'] != null
|
||||
? Avatar(
|
||||
mxContent: Uri.tryParse(
|
||||
suggestion.tryGet<String>('pack_avatar_url') ?? '',
|
||||
),
|
||||
name: suggestion.tryGet<String>('pack_display_name'),
|
||||
size: size * 0.9,
|
||||
client: client,
|
||||
)
|
||||
: Text(suggestion['pack_display_name']!),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
if (suggestion['type'] == 'user' || suggestion['type'] == 'room') {
|
||||
final url = Uri.parse(suggestion['avatar_url'] ?? '');
|
||||
return Container(
|
||||
padding: padding,
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Avatar(
|
||||
mxContent: url,
|
||||
name: suggestion.tryGet<String>('displayname') ??
|
||||
suggestion.tryGet<String>('mxid'),
|
||||
size: size,
|
||||
client: client,
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(suggestion['displayname'] ?? suggestion['mxid']!),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue