Home > Back-end >  Move container to the left
Move container to the left

Time:08-09

I want the container to be in the left side but i am always getting in the center of the screen. I tried using alignment and also used row,column but nothing worked.

Widget _guitarChord(BuildContext context) {
  return GestureDetector(
    child: Container(
     
      height: 200,
      width: 250,
      decoration: const BoxDecoration(
          borderRadius: BorderRadius.all(Radius.circular(12)),
          image: DecorationImage(
              image: AssetImage('images/worship.jpg'), fit: BoxFit.cover)),
    ),
    onTap: () {},
  );
}

CodePudding user response:

I use your method as a child in a column in my body. Pay attention you should add these codes in your column before your children. avoid using of Center widget

 body: Column(
    mainAxisAlignment: MainAxisAlignment.center,
    crossAxisAlignment: CrossAxisAlignment.start,
    children: [
      _guitarChord(context),
      const Text('KM flutter',style: TextStyle(fontSize: 25),),
    ],
  ),
  • Related