title: animated switcher children not clickable - flutter
body: <p>i have a clickable content in my switcher pages. the buttons doesnt work.</p>
  <p>i have three questions:</p>
  <p>1- is this the right way to use animated switcher with list view builder to make it switched with fade animation?</p>
  <p>2- how to make the content of animated switcher clickable</p>
  <p>3- there is another way to use fade transition with list view builder ?</p>
  <p>any suggestions will be helpful.
  thanks for your help</p>
  <p>the code below:</p>
  <pre><code>import 'package:flutter/material.dart';
  
  class MicroExam extends StatefulWidget {
    const MicroExam({Key? key}) : super(key: key);
  
    @override
    _MicroExamState createState() =&gt; _MicroExamState();
  }
  
  List&lt;Widget&gt; _pages = [
    Center(
      child: GestureDetector(
          onTap: () {
            print('red');
          },
          child: Container(
            color: Colors.red,
            width: 237.34,
            height: 44.74,
          )),
    ),
    Center(
      child: GestureDetector(
          onTap: () {
            print('blue');
          },
          child: Container(
            color: Colors.blue,
            width: 237.34,
            height: 44.74,
          )),
    )
  ];
  
  int selectedPage = 0;
  
  class _MicroExamState extends State&lt;MicroExam&gt; with TickerProviderStateMixin {
    PageController _controller = PageController();
  
    @override
    Widget build(BuildContext context) {
      return SafeArea(
        child: Scaffold(
          body: Stack(
            children: [
              AnimatedSwitcher(
                duration: const Duration(milliseconds: 300),
                child: Container(
                  key: ValueKey(_pages[selectedPage]),
                  child: _pages[selectedPage],
                ),
              ),
              Center(
                child: PageView.builder(
                  onPageChanged: (value) {
                    setState(() {
                      selectedPage = value;
                    });
                  },
                  controller: _controller,
                  physics: const BouncingScrollPhysics(),
                  itemCount: _pages.length,
                  itemBuilder: (context, index) {
                    return Container(
                      width: MediaQuery.of(context).size.width,
                      height: MediaQuery.of(context).size.height,
                    );
                  },
                ),
              ),
              // )
            ],
          ),
        ),
      );
    }
  }
  </code></pre>