Skip to content

Gesture detector not working in children widgets #6

@vladislove80

Description

@vladislove80

There are list of widgets:

 var testList = [
      GestureDetector(
        onTap: (){
          print('SCREEN 1');
        },
        child: Container(
          width: double.maxFinite,
          height: double.maxFinite,
          child: Center(
            child: Text('SCREEN 1'),
          ),
        ),
      ),
      GestureDetector(
        onTap: (){
          print('SCREEN 2');
        },
        child: Container(
          color: Colors.white38,
          width: double.maxFinite,
          height: double.maxFinite,
          child: Center(
            child: Text('SCREEN 2'),
          ),
        ),
      ),
    ];

Trying to:

class Sample2 extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    final height = MediaQuery.of(context).size.height / 2;
    return Scaffold(
      appBar: AppBar(
        title: Text('PageView Cube Transition'),
      ),
      body: Center(
        child: SizedBox(
          height: height,
          child: CubePageView(
            children: testList;
          ),
        ),
      ),
    );
  }
}

Cube transition between widgets is working fine but onTap in GestureDetectors doesn't fire.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions