chore: add ability to set status in settings
This commit is contained in:
parent
f16e1126ab
commit
c180dc25ff
2 changed files with 49 additions and 0 deletions
|
|
@ -207,6 +207,36 @@ class SettingsController extends State<Settings> {
|
|||
// Pangea#
|
||||
}
|
||||
|
||||
// #Pangea
|
||||
void setStatus() async {
|
||||
final client = Matrix.of(context).client;
|
||||
final currentPresence = await client.fetchCurrentPresence(client.userID!);
|
||||
final input = await showTextInputDialog(
|
||||
useRootNavigator: false,
|
||||
context: context,
|
||||
title: L10n.of(context).setStatus,
|
||||
message: L10n.of(context).leaveEmptyToClearStatus,
|
||||
okLabel: L10n.of(context).ok,
|
||||
cancelLabel: L10n.of(context).cancel,
|
||||
hintText: L10n.of(context).statusExampleMessage,
|
||||
maxLines: 6,
|
||||
minLines: 1,
|
||||
maxLength: 255,
|
||||
initialText: currentPresence.statusMsg,
|
||||
);
|
||||
if (input == null) return;
|
||||
if (!mounted) return;
|
||||
await showFutureLoadingDialog(
|
||||
context: context,
|
||||
future: () => client.setPresence(
|
||||
client.userID!,
|
||||
PresenceType.online,
|
||||
statusMsg: input,
|
||||
),
|
||||
);
|
||||
}
|
||||
// Pangea#
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final client = Matrix.of(context).client;
|
||||
|
|
|
|||
|
|
@ -165,6 +165,25 @@ class SettingsView extends StatelessWidget {
|
|||
// style: const TextStyle(fontSize: 12),
|
||||
),
|
||||
),
|
||||
// #Pangea
|
||||
TextButton.icon(
|
||||
onPressed: controller.setStatus,
|
||||
icon: const Icon(
|
||||
Icons.add,
|
||||
size: 14,
|
||||
),
|
||||
style: TextButton.styleFrom(
|
||||
foregroundColor:
|
||||
theme.colorScheme.secondary,
|
||||
iconColor: theme.colorScheme.secondary,
|
||||
),
|
||||
label: Text(
|
||||
L10n.of(context).setStatus,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
// Pangea#
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue