Horizontal Swipe for next item example

This Article is posted by seven.srikanth at 10/27/2021 6:57:28 PM



Here is an example of how to create an app where you will swipe for the next item. 
Here is the 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: 1,
      child: TabBarView(
        children: [
          Container(
            color: Colors.red,
          ),
          Container(
            color: Colors.green,
          ),
          Container(
            color: Colors.blue,
          ),
        ],
      ),
    );
  }
}
Thanks,
Srikanth

Tags:








0 Comments
Login to comment.
Recent Comments












© 2018 - Fluttercentral | Email to me - seven.srikanth@gmail.com