I’m trying to create a top bar using a Container with a horizontal LinearGradient background and a Row of widgets inside it.
However, even though I’m using Alignment.centerLeft to Alignment.centerRight, the gradient does not appear to connect exactly in the center. It looks slightly shifted towards the right.
Here is my code:
child: Container(
height: 65.hp, // using flutter_screenutil
decoration: const BoxDecoration(
gradient: LinearGradient(
colors: [
kGradientFirstColor,
kGradientSecondColor,
],
begin: Alignment.centerLeft,
end: Alignment.centerRight,
),
),
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 16.wp, vertical: 10.hp),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Row(
children: [
Padding(
padding: EdgeInsets.only(bottom: 4.hp),
child: SvgPicture.asset(
"assets/images/svg/home_hamburger_svg.svg",
width: 24.hp,
height: 24.hp,
),
),
SizedBox(width: 10.wp),
SvgPicture.asset(
"assets/images/svg/my_prop_ai_header.svg",
width: 111.wp,
height: 22.wp,
),
],
),
Row(
children: [
SvgPicture.asset(
"assets/images/svg/heart_svg.svg",
width: 24.wp,
height: 24.hp,
),
SizedBox(width: 20.wp),
SvgPicture.asset(
"assets/images/svg/bell_svg.svg",
width: 24.wp,
height: 24.hp,
),
],
),
],
),
),
)