Correct toTitleCase function

This commit is contained in:
Hillel Coren 2023-10-01 11:11:50 +03:00
parent 66c320cfd4
commit 22137f66cf
2 changed files with 4 additions and 4 deletions

View File

@ -265,8 +265,7 @@ class _CompanyGatewayEditState extends State<CompanyGatewayEdit>
.toList(),
),
SizedBox(height: 16),
for (var gatewayTypeId
in gateway?.options.keys ?? <String>[])
for (var gatewayTypeId in gateway?.options.keys ?? <String>[])
SwitchListTile(
title: Text(kGatewayTypes.containsKey(gatewayTypeId)
? localization

View File

@ -51,7 +51,8 @@ String toTitleCase(String text) {
return text.toUpperCase();
}
text = toSpaceCase(text.toLowerCase());
text = toSpaceCase(text);
final words = text.split(' ');
final capitalized = words.map((word) {
if (word == 'url') {
@ -63,7 +64,7 @@ String toTitleCase(String text) {
}
final first = word.substring(0, 1).toUpperCase();
final rest = word.substring(1);
final rest = word.substring(1).toLowerCase();
return '$first$rest';
});