David Foie Gras
David Foie Gras

Reputation: 2070

Flutter how to remove default padding from stack positioned

CODE:

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      resizeToAvoidBottomInset: false,
      backgroundColor: Colors.blue,
      body: SafeArea(
        child: SingleChildScrollView(
          physics: ClampingScrollPhysics(),
          child: Align(
            alignment: Alignment.center,
            child: Container(
              width: Get.width,
              height: Get.width * 16 / 9,
              child: Stack(
                children: [
                  Positioned(top: 16, left: 16, child: BackButton()),
                  Positioned(
                    left: 0,
                    bottom: 0,
                    child: IconButton(
                      padding: EdgeInsets.symmetric(vertical: 0, horizontal: 0),
                      icon: Icon(
                        Icons.delete_forever,
                        color: Colors.greenAccent,
                        size: 32,
                      ),
                      onPressed: () {
                      },
                    ),
                  ),
                ],
              ),
            ),
          ),
        ),
      ),
    );
  }

enter image description here

There is some margin on IconButton.

I think IconButton should be tight on bottom left.

How to remove margin IconButton and screen side?

Upvotes: 0

Views: 972

Answers (1)

Lalit Thakare
Lalit Thakare

Reputation: 63

Actually it's the default padding of the Icon Button only... That is, the stack is placing the button at bottom left but icon in the button is padded by default.

You can try using Gesture detector with that icon as a child... You will get different result... Please correct me if i am wrong..

Upvotes: 2

Related Questions