Correct toTitleCase function
This commit is contained in:
parent
66c320cfd4
commit
22137f66cf
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue