Hello im new at mobile mobile developers, and here i got confused by the padding that appears between image and text on my code. mostly i try the code that explained in youtube and the internet and for this problem i still can not find the solution
here are my code
class listBerita extends StatelessWidget {
const listBerita({super.key});
@override
Widget build(BuildContext context) {
return Padding(
padding: EdgeInsets.all(10.0),
child: Column(
children: [
Container(
width: 336,
height: 80,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(10),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Image.network(
"https://loremflickr.com/320/240",
height: 80,
width: 80,
),
Padding(
padding: const EdgeInsets.all(5),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Kategori",
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w700,
color: Colors.blue,
),
),
SizedBox(height: 10),
Text(
"Lorem ipsum dolor sit.",
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w700,
// color: Colors.blue,
),
),
SizedBox(height: 5),
Text(
"Author • 23 Mei 2023",
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w400,
// color: Colors.blue,
),
),
],
)),
])),
],
),
);
}
}
3
Answers
Try to padding: const EdgeInsets.only(top: 10,bottom: 10,left: 10,right: 10),
Also you may wanna learn responsive design so give this measures depended on device width and height .
Hide or remove
mainAxisAlignment: MainAxisAlignment.spaceBetween
, under Row.Output:
I changed the padding in the section with the texts on the right from all to only. If you want your text to approach the picture, you can give a larger number to the right: value.
I hope I have helped. Enjoy your work.