flutter stack widget clip Behavior: Clip. None, second widget alignment is outside first widget onTap: notworking

289 views Asked by At

I would like to using stack to a Dart in a given position using on Tap, exactly like this (In flutter). example:

flutter stack widget clip Behavior: Clip. None, first widget on Tap: working when used second widget alignment is outside first widget then its on Tap: notworking.

Stack(
        alignment: Alignment.bottomCenter,
         clipBehavior: Clip.none,
        children: [   
Container(
            width: double.infinity,
            height: MediaQuery.of(context).size.height / 3,
            padding: const EdgeInsets.all(16),
            decoration: BoxDecoration(
              color: Theme.of(context).colorScheme.outline.withAlpha(600),
              borderRadius: BorderRadius.circular(10),
            ),
            child: Column(
            
              children: [
            
CommonElevatedButton(
              onPressed: () {
                print("hehe"); // This on tap in working fine
              },
              fullWidth: false,
              btnText: "Select photo",
            )
          ],
        ),
      ),
      Positioned(
        top:270,
        child: Row(
          children: [
            
            InkWell(
              onTap: () {}, //=> This on tap is not working
              child: Assets.images.icons.editIcon.svg(),
            )
          ],
        ),
      ),
    ],
  );

we are use Stack in dart same as I try use in second widget on tap event in alignment of outside of first widget and I show the widget UI in screen using property stack in Clip.none but this(second widget) on tap event not working how can I create this please help me...

1

There are 1 answers

0
Moony-Stary On

Replace your InkWell widget with GestureDetector and mention behavior as HitTestBehavior.translucent

 GestureDetector(
behavior:HitTestBehavior.translucent,