Format 6-digit codes (#239)

This commit is contained in:
Vishnu Mohandas 2023-09-08 18:49:09 +05:30 committed by GitHub
commit 7456b0a2e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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;
}
}