Format 6-digit codes

This commit is contained in:
vishnukvmd 2023-09-08 18:40:54 +05:30
parent cdb615b0ba
commit bffff57d28

View file

@ -206,7 +206,7 @@ class _CodeWidgetState extends State<CodeWidget> {
return Material(
type: MaterialType.transparency,
child: Text(
value,
_getFormattedCode(value),
style: const TextStyle(fontSize: 24),
),
);
@ -231,7 +231,7 @@ class _CodeWidgetState extends State<CodeWidget> {
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<CodeWidget> {
return context.l10n.error;
}
}
String _getFormattedCode(String code) {
if (code.length == 6) {
return code.substring(0, 3) + " " + code.substring(3, 6);
}
return code;
}
}