refactor: Display better command hints

This commit is contained in:
Krille 2024-05-03 15:57:05 +02:00
parent e6a1fcb5b6
commit ee6ba0de84
No known key found for this signature in database
GPG key ID: E067ECD60F1A0652
2 changed files with 23 additions and 1 deletions

View file

@ -2,6 +2,28 @@
import 'package:flutter_gen/gen_l10n/l10n.dart';
String commandExample(String command) {
switch (command) {
case 'markasdm':
case 'kick':
case 'dm':
case 'ban':
case 'unban':
case 'ignore':
case 'unignore':
case 'invite':
return '/$command <matrix-id>';
case 'html':
case 'sendraw':
case 'plain':
return '/$command <message>';
case 'op':
return '/$command <matrix-id> <power-level>';
default:
return '/$command';
}
}
String commandHint(L10n l10n, String command) {
switch (command) {
case "ban":

View file

@ -236,7 +236,7 @@ class InputBar extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'/$command',
commandExample(command),
style: const TextStyle(fontFamily: 'monospace'),
),
Text(