fix: State problem when not changing emote name
This commit is contained in:
parent
ed945311d9
commit
b625249ff8
2 changed files with 2 additions and 3 deletions
|
|
@ -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(
|
||||||
|
|
|
||||||
|
|
@ -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,
|
||||||
),
|
),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue