Here is an example to get the next item on a vertical swipe.
Here is the complete code from main.dart file.
import 'package:flutter/material.dart';
main(List<String> args) {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@
override
Widget build(BuildContext context) {
return const MaterialApp(
home: Scaffold(body: MyverticalSwiper()),
);
}
}
class MyverticalSwiper extends StatelessWidget {
const MyverticalSwiper({Key? key}) : super(key: key);
@
override
Widget build(BuildContext context) {
return DefaultTabController(
length: 3,
initialIndex: 0,
child: RotatedBox(
quarterTurns: 1,
child: TabBarView(
children: [
Container(
color: Colors.red,
),
Container(
color: Colors.green,
),
Container(
color: Colors.blue,
),
],
),
),
);
}
}
Thanks,Srikanth