fix: State problem when not changing emote name

This commit is contained in:
krille-chan 2025-11-20 19:24:15 +01:00
commit b625249ff8
No known key found for this signature in database
2 changed files with 2 additions and 3 deletions

View file

@ -135,11 +135,12 @@ class EmotesSettingsController extends State<EmotesSettings> {
void submitImageAction( void submitImageAction(
String oldImageCode, String oldImageCode,
String imageCode,
ImagePackImageContent image, ImagePackImageContent image,
TextEditingController controller, TextEditingController controller,
) { ) {
controller.text = controller.text.trim().replaceAll(' ', '-'); controller.text = controller.text.trim().replaceAll(' ', '-');
final imageCode = controller.text;
if (imageCode == oldImageCode) return;
if (pack!.images.keys.any((k) => k == imageCode && k != oldImageCode)) { if (pack!.images.keys.any((k) => k == imageCode && k != oldImageCode)) {
controller.text = oldImageCode; controller.text = oldImageCode;
showOkAlertDialog( showOkAlertDialog(

View file

@ -135,7 +135,6 @@ class EmotesSettingsView extends StatelessWidget {
onInvoke: (i) { onInvoke: (i) {
controller.submitImageAction( controller.submitImageAction(
imageCode, imageCode,
textEditingController.text,
image, image,
textEditingController, textEditingController,
); );
@ -165,7 +164,6 @@ class EmotesSettingsView extends StatelessWidget {
onSubmitted: (s) => onSubmitted: (s) =>
controller.submitImageAction( controller.submitImageAction(
imageCode, imageCode,
s,
image, image,
textEditingController, textEditingController,
), ),