0

I have created this page.

I have made some navigation by routes. But the problem is I want to change the position of my IconButton to the Center bottom of the page. That's why I am using the alignment parameter but as soon as I use that parameter my navigation stops working. But my Icon comes to my desired location but onPress function stop working.

I have the alignment code in the image. Please guide what's wrong.

Thanks

Entire Code

      Container(
          width: 100,
          height: 100,
          alignment: Alignment(0, 50),

          child: IconButton(
              icon: Icon(Icons.play_circle_filled),
              color: Colors.yellow[900],
              iconSize: 80,
              onPressed: () {
                Navigator.pushNamed(context, '/Second');
              }),

Highlighted alignment codes

Claudio Redi
  • 67,454
  • 15
  • 130
  • 155
Raj Jain
  • 15
  • 4
  • I don't see any parameter in your code.. where is that?... Also, can you paste the code here instead of sharing a screen capture? – Claudio Redi Jul 29 '20 at 15:06
  • @ClaudioRedi In a Column, I have pass Container as the children and under the containter i have the pass IconButton as its child. The problem is as soon as i am putting Alignment property under the container or IconButton my onPressed function stop working. if i remove the alignment property it again starts working – Raj Jain Jul 29 '20 at 15:29
  • @ClaudioRedi I have added the codes there, I can't add the entire codes as it says i have reformat it. Please check the image to see the entire codes – Raj Jain Jul 29 '20 at 15:30
  • What do you mean with "stop working"? Do you get any error? I don't see how aligment could affect navigation. – Claudio Redi Jul 29 '20 at 16:58
  • @ClaudioRedi no it doesn't throw any error. It's just when you click it won't navigate. onPress function doesn't work if the alignment is used. – Raj Jain Jul 30 '20 at 15:15

0 Answers0