From 3676120baae9d4f827de36501a3872dfcc2c91ba Mon Sep 17 00:00:00 2001 From: Angelo Silvestre Date: Thu, 16 May 2024 20:52:12 -0300 Subject: [PATCH] [SuperEditor][DemoApp] Fix content being deleted on iOS textfield demo (Resolves #2006) (#2008) --- .../lib/demos/supertextfield/_mobile_textfield_demo.dart | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/super_editor/example/lib/demos/supertextfield/_mobile_textfield_demo.dart b/super_editor/example/lib/demos/supertextfield/_mobile_textfield_demo.dart index 0627c8c4a..e97be4b6c 100644 --- a/super_editor/example/lib/demos/supertextfield/_mobile_textfield_demo.dart +++ b/super_editor/example/lib/demos/supertextfield/_mobile_textfield_demo.dart @@ -28,6 +28,7 @@ class _MobileSuperTextFieldDemoState extends State { late ImeAttributedTextEditingController _textController; _TextFieldSizeMode _sizeMode = _TextFieldSizeMode.short; + late MobileTextFieldDemoConfig _demoConfig; bool _showDebugPaint = false; @@ -47,6 +48,8 @@ class _MobileSuperTextFieldDemoState extends State { text: widget.initialText.copyText(0), ), ); + + _demoConfig = _createDemoConfig(); } @override @@ -110,7 +113,7 @@ class _MobileSuperTextFieldDemoState extends State { child: TapRegion( groupId: widget.textFieldTapRegionGroupId, onTapOutside: (_) => widget.textFieldFocusNode.unfocus(), - child: widget.createTextField(_createDemoConfig()), + child: widget.createTextField(_demoConfig), ), ), ), @@ -162,6 +165,8 @@ class _MobileSuperTextFieldDemoState extends State { } else if (newIndex == 3) { _sizeMode = _TextFieldSizeMode.empty; } + + _demoConfig = _createDemoConfig(); }); }, ),