From 6ebdb39760363f2e454241be9e60af2973e7dfa0 Mon Sep 17 00:00:00 2001 From: 2211260 <2211260@hs-mannheim.de> Date: Fri, 2 Jun 2023 18:35:07 +0200 Subject: [PATCH] feat: adjust search styling --- .../components/founded_search_component.dart | 121 ++++++++++-------- 1 file changed, 65 insertions(+), 56 deletions(-) diff --git a/lib/android/components/founded_search_component.dart b/lib/android/components/founded_search_component.dart index 6c8f838..9b68f32 100644 --- a/lib/android/components/founded_search_component.dart +++ b/lib/android/components/founded_search_component.dart @@ -54,64 +54,73 @@ class _SearchFoodComponentState extends State { @override Widget build(BuildContext context) { return Container( - padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 16), - decoration: - const BoxDecoration(color: Color.fromARGB(234, 234, 123, 5)), - child: WrapSuper( - spacing: 32, - wrapType: WrapType.balanced, - wrapFit: WrapFit.larger, - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - width: MediaQuery.of(context).size.width * 0.6, - child: Text( - widget.food.name, - maxLines: 1, - overflow: TextOverflow.ellipsis, - softWrap: false, - style: const TextStyle( - color: Colors.black, - fontWeight: FontWeight.bold, - fontSize: 20.0), + padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 16), + margin: const EdgeInsets.only(top:8), + decoration: BoxDecoration( + color: Colors.lightGreen, + borderRadius: BorderRadius.circular(5), // Rounded corners with 5px radius + ), + child: WrapSuper( + spacing: 32, + wrapType: WrapType.balanced, + wrapFit: WrapFit.larger, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + width: MediaQuery.of(context).size.width * 0.8, + child: Text( + widget.food.name, + maxLines: 2, + overflow: TextOverflow.ellipsis, + softWrap: false, + style: const TextStyle( + color: Colors.black, + fontWeight: FontWeight.bold, + fontSize: 20.0, ), ), - SizedBox( - width: MediaQuery.of(context).size.width * 0.6, - child: Text( - "${widget.food.fatg} 100g " - "${widget.food.calories} 100g " - "${widget.food.carbohydrateg.toString()} 100g", - maxLines: 1, - overflow: TextOverflow.ellipsis, - softWrap: false, - style: const TextStyle( - color: Colors.black, - fontWeight: FontWeight.bold, - fontSize: 20.0), - ), - ), - ], - ), - ElevatedButton( - onPressed: () async { - storeFood(); - }, - style: ElevatedButton.styleFrom( - foregroundColor: Colors.white, - backgroundColor: Colors.green, - shadowColor: Colors.greenAccent, - elevation: 3, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(32.0)), - maximumSize: Size( - MediaQuery.of(context).size.width * 0.2, 36), //////// HERE ), - child: const Text('+'), - ) - ], - )); + SizedBox( + width: MediaQuery.of(context).size.width * 0.8, + child: Text( + "${widget.food.calories} kcal/100g", + maxLines: 1, + overflow: TextOverflow.ellipsis, + softWrap: false, + style: const TextStyle( + color: Colors.black, + fontWeight: FontWeight.bold, + fontSize: 20.0, + ), + ), + ), + ], + ), + ElevatedButton( + onPressed: () async { + storeFood(); + }, + style: ElevatedButton.styleFrom( + foregroundColor: Colors.white, + backgroundColor: Colors.green, + shadowColor: Colors.greenAccent, + elevation: 3, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(32.0), + ), + ), + child: const Text( + '+', + style: TextStyle( + fontSize: 25 + ), + ), + ), + ], + ), + ); + } }