feat: commands ui

This commit is contained in:
Deven Joshi
2020-10-23 13:58:21 +05:30
parent c7fb3a229f
commit 00828eb0e2
+36 -21
View File
@@ -415,30 +415,44 @@ class MessageInputState extends State<MessageInput> {
child: ListView(
padding: const EdgeInsets.all(0),
shrinkWrap: true,
children: commands
.map(
(c) => ListTile(
title: Text.rich(
TextSpan(
text: '${c.name}',
style: TextStyle(fontWeight: FontWeight.bold),
children: [
TextSpan(
text: ' ${c.args}',
style: TextStyle(
fontWeight: FontWeight.w300,
),
children: [
Padding(
padding: const EdgeInsets.all(4.0),
child: Row(
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: Icon(StreamIcons.lightning, color: StreamChatTheme.of(context).accentColor),
),
Text('Instant Commands')
],
),
),
...commands
.map(
(c) => ListTile(
title: Text.rich(
TextSpan(
text: '${c.name}',
style: TextStyle(fontWeight: FontWeight.bold),
children: [
TextSpan(
text: ' ${c.args}',
style: TextStyle(
fontWeight: FontWeight.w300,
),
],
),
),
],
),
subtitle: Text(c.description),
onTap: () {
_setCommand(c);
},
),
)
.toList(),
subtitle: Text(c.description),
onTap: () {
_setCommand(c);
},
),
)
.toList(),
],
),
),
),
@@ -544,6 +558,7 @@ class MessageInputState extends State<MessageInput> {
setState(() {
_chosenCommand = c;
_commandEnabled = true;
_messageIsPresent = false;
});
_commandsOverlay?.remove();
_commandsOverlay = null;