mirror of
https://github.com/krille-chan/fluffychat
synced 2024-09-10 06:25:15 +00:00
refactor: Display better command hints
This commit is contained in:
parent
e6a1fcb5b6
commit
ee6ba0de84
2 changed files with 23 additions and 1 deletions
|
@ -2,6 +2,28 @@
|
||||||
|
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
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) {
|
String commandHint(L10n l10n, String command) {
|
||||||
switch (command) {
|
switch (command) {
|
||||||
case "ban":
|
case "ban":
|
||||||
|
|
|
@ -236,7 +236,7 @@ class InputBar extends StatelessWidget {
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'/$command',
|
commandExample(command),
|
||||||
style: const TextStyle(fontFamily: 'monospace'),
|
style: const TextStyle(fontFamily: 'monospace'),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
|
|
Loading…
Reference in a new issue