From ef9fefd1da177c22a23fefd5c2649786ee86b604 Mon Sep 17 00:00:00 2001 From: tangenta Date: Mon, 7 Aug 2023 00:42:48 +0800 Subject: [PATCH] set initial text field value for renaming room --- lib/components/chat_room.dart | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/components/chat_room.dart b/lib/components/chat_room.dart index 8baf734..bf0ad67 100644 --- a/lib/components/chat_room.dart +++ b/lib/components/chat_room.dart @@ -736,13 +736,16 @@ class _ChatDetailButtonState extends State final theme = Theme.of(buildCtx); final dialogTextStyle = theme.textTheme.titleMedium! .copyWith(color: theme.textTheme.bodySmall!.color); - var newName = ""; + final comp.ChatRoomController chatRoomController = Get.find(); + final initVal = chatRoomController.getCurrentRoom()?.name; + var newName = initVal?? ""; return DialogRoute( context: buildCtx, builder: (context) { return AlertDialog( content: TextFormField( + initialValue: newName, validator: (value) { if (value == null || value.isEmpty) { return 'Please enter some text';