From 3af6cc5bc6b693db53d24be75cd3d19efd7162e6 Mon Sep 17 00:00:00 2001 From: broodjeaap89 Date: Sat, 10 Jul 2021 21:45:01 +0200 Subject: [PATCH] added capitalize extension --- lib/entities/PizzaRecipe/Ingredient.dart | 2 +- lib/util.dart | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/entities/PizzaRecipe/Ingredient.dart b/lib/entities/PizzaRecipe/Ingredient.dart index 02cdd48..fddfd30 100644 --- a/lib/entities/PizzaRecipe/Ingredient.dart +++ b/lib/entities/PizzaRecipe/Ingredient.dart @@ -12,7 +12,7 @@ class Ingredient { Widget getIngredientWidget(int weight){ return Row( children: [ - Text("${this.name}: "), + Text("${this.name.capitalize()}: "), Text("${this.getAbsolute(weight)}$unit") ], ); diff --git a/lib/util.dart b/lib/util.dart index 285e5c2..5f712c1 100644 --- a/lib/util.dart +++ b/lib/util.dart @@ -19,4 +19,10 @@ Future> getRecipes() async { Future loadAsset(String path) async { return await rootBundle.loadString(path); +} + +extension StringExtensions on String { + String capitalize() { + return this[0].toUpperCase() + this.substring(1); + } } \ No newline at end of file