diff --git a/lib/shared/SystemConsts.dart b/lib/shared/SystemConsts.dart index 461bdbe..5b2a49f 100644 --- a/lib/shared/SystemConsts.dart +++ b/lib/shared/SystemConsts.dart @@ -1,3 +1,3 @@ mixin SystemConsts { - static String version = '1.0.2'; + static String version = '1.0.3'; } diff --git a/lib/shared/my_converter.dart b/lib/shared/my_converter.dart index e13c22d..579b7f3 100644 --- a/lib/shared/my_converter.dart +++ b/lib/shared/my_converter.dart @@ -20,6 +20,8 @@ class _MyConverterState extends State { final TextEditingController doubleUrlEn = TextEditingController(); final TextEditingController doubleUrlDe = TextEditingController(); + late List controllers; + bool base64EnError = false; bool base64DeError = false; bool base64UrlEnError = false; @@ -34,6 +36,12 @@ class _MyConverterState extends State { double _sizeX = 500; + @override + void initState() { + super.initState(); + controllers = [base64En, base64De, base64UrlEn, base64UrlDe, urlEn, urlDe, doubleUrlEn, doubleUrlDe]; + } + @override Widget build(BuildContext context) { _sizeX = MediaQuery.of(context).size.width; @@ -100,7 +108,7 @@ class _MyConverterState extends State { OutlinedButton( onPressed: error ? null : () { Clipboard.setData(ClipboardData(text: controller.text)); - // todo: unselect all text fields + clearSelection(); controller.selection = TextSelection(baseOffset: 0, extentOffset: controller.value.text.length); }, style: buttonStyle, @@ -127,6 +135,7 @@ class _MyConverterState extends State { readOnly: true, controller: controller, onTap: () { + clearSelection(); controller.selection = TextSelection(baseOffset: 0, extentOffset: controller.value.text.length); }, ), @@ -218,4 +227,10 @@ class _MyConverterState extends State { doubleUrlEnError = false; doubleUrlDeError = false; } + + clearSelection() { + for (var c in controllers) { + c.selection = const TextSelection(baseOffset: 0, extentOffset: 0); + } + } }