added capitalize extension

This commit is contained in:
broodjeaap89 2021-07-10 21:45:01 +02:00
parent 6d9352485b
commit 3af6cc5bc6
2 changed files with 7 additions and 1 deletions

View file

@ -12,7 +12,7 @@ class Ingredient {
Widget getIngredientWidget(int weight){
return Row(
children: <Widget>[
Text("${this.name}: "),
Text("${this.name.capitalize()}: "),
Text("${this.getAbsolute(weight)}$unit")
],
);

View file

@ -19,4 +19,10 @@ Future<List<PizzaRecipe>> getRecipes() async {
Future<String> loadAsset(String path) async {
return await rootBundle.loadString(path);
}
extension StringExtensions on String {
String capitalize() {
return this[0].toUpperCase() + this.substring(1);
}
}