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(), .toList(),
), ),
SizedBox(height: 16), SizedBox(height: 16),
for (var gatewayTypeId for (var gatewayTypeId in gateway?.options.keys ?? <String>[])
in gateway?.options.keys ?? <String>[])
SwitchListTile( SwitchListTile(
title: Text(kGatewayTypes.containsKey(gatewayTypeId) title: Text(kGatewayTypes.containsKey(gatewayTypeId)
? localization ? localization

View File

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