From bffff57d28842e6ccd57a3a72ce27411f6972927 Mon Sep 17 00:00:00 2001 From: vishnukvmd Date: Fri, 8 Sep 2023 18:40:54 +0530 Subject: [PATCH] Format 6-digit codes --- lib/ui/code_widget.dart | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/ui/code_widget.dart b/lib/ui/code_widget.dart index 7c8617aa9..29cfe0005 100644 --- a/lib/ui/code_widget.dart +++ b/lib/ui/code_widget.dart @@ -206,7 +206,7 @@ class _CodeWidgetState extends State { return Material( type: MaterialType.transparency, child: Text( - value, + _getFormattedCode(value), style: const TextStyle(fontSize: 24), ), ); @@ -231,7 +231,7 @@ class _CodeWidgetState extends State { return Material( type: MaterialType.transparency, child: Text( - value, + _getFormattedCode(value), style: const TextStyle( fontSize: 18, color: Colors.grey, @@ -409,4 +409,11 @@ class _CodeWidgetState extends State { return context.l10n.error; } } + + String _getFormattedCode(String code) { + if (code.length == 6) { + return code.substring(0, 3) + " " + code.substring(3, 6); + } + return code; + } }