i have an animatedSwitcher but with effect of swip left and right, i reach that by using Two widget: a PageView builder with a transparent background and an animatedSwitcher. inside a stack i can swip smoothly between widgets.
the problem is the widgets of animatedSwitcher are scrollable but the PageView builder is above the animatedSwitcher so i cant scroll up and down widget of animatedSwitcher. (are not clickable in general).
the aim is to reach the same result as the gif down below. but without a pageview builder.
any suggestion will be helpful and thanks.
the code:
int selectedPage = 0;
PageController _controller = PageController();
@override
Widget build(BuildContext context) {
List<Widget> _pages = [
Container(color: Colors.blue),
Container(color: Colors.red),
];
return Stack(
alignment: Alignment.center,
children: <Widget>[
AnimatedSwitcher(
duration: const Duration(milliseconds: 300),
child: Container(
key: ValueKey(_pages[selectedPage]),
child: _pages[selectedPage],
),
),
PageView.builder(
onPageChanged: (value) {
setState(() {
selectedPage = value;
});
},
controller: _controller,
physics: const ClampingScrollPhysics(),
itemCount: _pages.length,
itemBuilder: (context, index) {
return Container();
},
),
],
);
}