diff --git a/lib/android/components/card_component.dart b/lib/android/components/card_component.dart index 11dd02b..9665103 100644 --- a/lib/android/components/card_component.dart +++ b/lib/android/components/card_component.dart @@ -1,6 +1,7 @@ import 'package:basic_utils/basic_utils.dart'; import 'package:flutter/material.dart'; import 'package:flutter_dotenv/flutter_dotenv.dart'; +import '../config/format_helper.dart'; import '../models/food.dart'; import '../pages/nav_pages/search_food.dart'; @@ -102,13 +103,6 @@ class _CardComponentState extends State { } return resultMap; } - - String getFoodListStringByFood(String foodName, int count, int calories){ - int maxWidth = 35; - String limitedText = foodName.length > maxWidth ? "${foodName.substring(0, maxWidth - 3)} ... $count x $calories kcal" : "$foodName $count x $calories kcal"; - return limitedText; - } - @override Widget build(BuildContext context) { return Card( diff --git a/lib/android/config/format_helper.dart b/lib/android/config/format_helper.dart new file mode 100644 index 0000000..76297ee --- /dev/null +++ b/lib/android/config/format_helper.dart @@ -0,0 +1,5 @@ +String getFoodListStringByFood(String foodName, int count, int calories){ + int maxWidth = 35; + String limitedText = foodName.length > maxWidth ? "${foodName.substring(0, maxWidth - 3)} ... $count x $calories kcal" : "$foodName $count x $calories kcal"; + return limitedText; +}