Format 6-digit codes (#239)
This commit is contained in:
commit
7456b0a2e7
1 changed files with 9 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue