feat: format helper

feature/chart-progress-page
98spag 2023-05-30 17:12:42 +02:00
parent 53d69b22d5
commit 0fd7def1e4
2 changed files with 6 additions and 7 deletions

View File

@ -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<CardComponent> {
}
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(

View File

@ -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;
}