feat: adjust search styling

pull/5/head
2211260 2023-06-02 18:35:07 +02:00
parent d131e1263c
commit 6ebdb39760
1 changed files with 65 additions and 56 deletions

View File

@ -54,64 +54,73 @@ class _SearchFoodComponentState extends State<SearchedFoodComponent> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 16), padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 16),
decoration: margin: const EdgeInsets.only(top:8),
const BoxDecoration(color: Color.fromARGB(234, 234, 123, 5)), decoration: BoxDecoration(
child: WrapSuper( color: Colors.lightGreen,
spacing: 32, borderRadius: BorderRadius.circular(5), // Rounded corners with 5px radius
wrapType: WrapType.balanced, ),
wrapFit: WrapFit.larger, child: WrapSuper(
children: [ spacing: 32,
Column( wrapType: WrapType.balanced,
crossAxisAlignment: CrossAxisAlignment.start, wrapFit: WrapFit.larger,
children: [ children: [
SizedBox( Column(
width: MediaQuery.of(context).size.width * 0.6, crossAxisAlignment: CrossAxisAlignment.start,
child: Text( children: [
widget.food.name, SizedBox(
maxLines: 1, width: MediaQuery.of(context).size.width * 0.8,
overflow: TextOverflow.ellipsis, child: Text(
softWrap: false, widget.food.name,
style: const TextStyle( maxLines: 2,
color: Colors.black, overflow: TextOverflow.ellipsis,
fontWeight: FontWeight.bold, softWrap: false,
fontSize: 20.0), 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
),
),
),
],
),
);
} }
} }