From a87eac5470328ca30512138fde8712320c673c0e Mon Sep 17 00:00:00 2001 From: Carlos Nihelton Date: Mon, 19 Aug 2024 17:30:38 -0300 Subject: [PATCH] The fix: let the input field remove all spaces Using Flutter built-in facilities instead of handcrafting code to trim spaces when the field changes. --- .../lib/pages/subscribe_now/subscribe_now_widgets.dart | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gui/packages/ubuntupro/lib/pages/subscribe_now/subscribe_now_widgets.dart b/gui/packages/ubuntupro/lib/pages/subscribe_now/subscribe_now_widgets.dart index 5587db278..685e8e1bc 100644 --- a/gui/packages/ubuntupro/lib/pages/subscribe_now/subscribe_now_widgets.dart +++ b/gui/packages/ubuntupro/lib/pages/subscribe_now/subscribe_now_widgets.dart @@ -1,5 +1,6 @@ import 'package:dart_either/dart_either.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:yaru/yaru.dart'; import '../../core/either_value_notifier.dart'; @@ -78,6 +79,10 @@ class _ProTokenInputFieldState extends State { children: [ Expanded( child: TextField( + inputFormatters: [ + // This ignores all sorts of (Unicode) whitespaces (not only at the ends). + FilteringTextInputFormatter.deny(RegExp(r'\s')), + ], autofocus: false, controller: _controller, decoration: InputDecoration(