feat: format helper
parent
53d69b22d5
commit
0fd7def1e4
|
@ -1,6 +1,7 @@
|
||||||
import 'package:basic_utils/basic_utils.dart';
|
import 'package:basic_utils/basic_utils.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||||
|
import '../config/format_helper.dart';
|
||||||
import '../models/food.dart';
|
import '../models/food.dart';
|
||||||
import '../pages/nav_pages/search_food.dart';
|
import '../pages/nav_pages/search_food.dart';
|
||||||
|
|
||||||
|
@ -102,13 +103,6 @@ class _CardComponentState extends State<CardComponent> {
|
||||||
}
|
}
|
||||||
return resultMap;
|
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
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Card(
|
return Card(
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
Loading…
Reference in New Issue