Search code examples
iosflutterdartmobilepadding

Remove row padding on flutter


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,
                              ),
                            ),
                          ],
                        )),
                  ])),
        ],
      ),
    );
  }
}

my expectation is to move text into left close to the image


Solution

  • Hide or remove mainAxisAlignment: MainAxisAlignment.spaceBetween, under Row.

    enter image description here