scroll_loop_auto_scroll 0.0.2 copy "scroll_loop_auto_scroll: ^0.0.2" to clipboard
scroll_loop_auto_scroll: ^0.0.2 copied to clipboard

outdated

This widget automatically scrolls the custom child widget to an infinite loop.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:scroll_loop_auto_scroll/scroll_loop_auto_scroll.dart';

void main() => runApp(const MyApp());

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);
  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
        title: 'Scroll Loop Auto Scroll',
        debugShowCheckedModeBanner: false,
        home: HomePage());
  }
}

class HomePage extends StatefulWidget {
  const HomePage({Key? key}) : super(key: key);

  @override
  State<HomePage> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Padding(
          padding: const EdgeInsets.all(10.0),
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              //Example 1
              const ScrollLoopAutoScroll(
                child: Text(
                  'Very long text that bleeds out of the rendering space',
                  style: TextStyle(fontSize: 20),
                ),
                scrollDirection: Axis.horizontal,
              ),
              const SizedBox(
                height: 40,
              ),
              //Example 2
              SizedBox(
                height: 199,
                child: ScrollLoopAutoScroll(
                  scrollDirection: Axis.vertical,
                  child: Column(
                    children: [
                      Container(
                        height: 80,
                        width: MediaQuery.of(context).size.width - 40,
                        color: Colors.green,
                        alignment: Alignment.center,
                        child: const Text(
                          'ONE',
                          style: TextStyle(
                              color: Colors.white,
                              fontSize: 20,
                              fontWeight: FontWeight.bold),
                        ),
                      ),
                      Container(
                        height: 80,
                        width: MediaQuery.of(context).size.width - 40,
                        color: Colors.red,
                        alignment: Alignment.center,
                        child: const Text(
                          'FOR',
                          style: TextStyle(
                              color: Colors.white,
                              fontSize: 20,
                              fontWeight: FontWeight.bold),
                        ),
                      ),
                      Container(
                        height: 80,
                        width: MediaQuery.of(context).size.width - 40,
                        color: Colors.blue,
                        alignment: Alignment.center,
                        child: const Text(
                          'ALL',
                          style: TextStyle(
                              color: Colors.white,
                              fontSize: 20,
                              fontWeight: FontWeight.bold),
                        ),
                      ),
                      Container(
                        height: 80,
                        width: MediaQuery.of(context).size.width - 40,
                        color: Colors.orange,
                        alignment: Alignment.center,
                        child: const Text(
                          'AND',
                          style: TextStyle(
                              color: Colors.white,
                              fontSize: 20,
                              fontWeight: FontWeight.bold),
                        ),
                      ),
                      Container(
                        height: 80,
                        width: MediaQuery.of(context).size.width - 40,
                        color: Colors.blue,
                        alignment: Alignment.center,
                        child: const Text(
                          'ALL',
                          style: TextStyle(
                              color: Colors.white,
                              fontSize: 20,
                              fontWeight: FontWeight.bold),
                        ),
                      ),
                      Container(
                        height: 80,
                        width: MediaQuery.of(context).size.width - 40,
                        color: Colors.red,
                        alignment: Alignment.center,
                        child: const Text(
                          'FOR',
                          style: TextStyle(
                              color: Colors.white,
                              fontSize: 20,
                              fontWeight: FontWeight.bold),
                        ),
                      ),
                      Container(
                        height: 80,
                        width: MediaQuery.of(context).size.width - 40,
                        color: Colors.green,
                        alignment: Alignment.center,
                        child: const Text(
                          'ONE',
                          style: TextStyle(
                              color: Colors.white,
                              fontSize: 20,
                              fontWeight: FontWeight.bold),
                        ),
                      ),
                    ],
                  ),
                ),
              ),
              const SizedBox(
                height: 40,
              ),
              //Example 3
              SizedBox(
                width: MediaQuery.of(context).size.width - 40,
                child: ScrollLoopAutoScroll(
                  scrollDirection: Axis.horizontal,
                  child: Row(
                    children: [
                      Container(
                        height: 80,
                        width: MediaQuery.of(context).size.width / 2,
                        color: Colors.green,
                        alignment: Alignment.center,
                        child: const Text(
                          'ONE',
                          style: TextStyle(
                              color: Colors.white,
                              fontSize: 20,
                              fontWeight: FontWeight.bold),
                        ),
                      ),
                      Container(
                        height: 80,
                        width: MediaQuery.of(context).size.width / 2,
                        color: Colors.red,
                        alignment: Alignment.center,
                        child: const Text(
                          'FOR',
                          style: TextStyle(
                              color: Colors.white,
                              fontSize: 20,
                              fontWeight: FontWeight.bold),
                        ),
                      ),
                      Container(
                        height: 80,
                        width: MediaQuery.of(context).size.width / 2,
                        color: Colors.blue,
                        alignment: Alignment.center,
                        child: const Text(
                          'ALL',
                          style: TextStyle(
                              color: Colors.white,
                              fontSize: 20,
                              fontWeight: FontWeight.bold),
                        ),
                      ),
                      Container(
                        height: 80,
                        width: MediaQuery.of(context).size.width / 2,
                        color: Colors.orange,
                        alignment: Alignment.center,
                        child: const Text(
                          'AND',
                          style: TextStyle(
                              color: Colors.white,
                              fontSize: 20,
                              fontWeight: FontWeight.bold),
                        ),
                      ),
                      Container(
                        height: 80,
                        width: MediaQuery.of(context).size.width / 2,
                        color: Colors.blue,
                        alignment: Alignment.center,
                        child: const Text(
                          'ALL',
                          style: TextStyle(
                              color: Colors.white,
                              fontSize: 20,
                              fontWeight: FontWeight.bold),
                        ),
                      ),
                      Container(
                        height: 80,
                        width: MediaQuery.of(context).size.width / 2,
                        color: Colors.red,
                        alignment: Alignment.center,
                        child: const Text(
                          'FOR',
                          style: TextStyle(
                              color: Colors.white,
                              fontSize: 20,
                              fontWeight: FontWeight.bold),
                        ),
                      ),
                      Container(
                        height: 80,
                        width: MediaQuery.of(context).size.width / 2,
                        color: Colors.green,
                        alignment: Alignment.center,
                        child: const Text(
                          'ONE',
                          style: TextStyle(
                              color: Colors.white,
                              fontSize: 20,
                              fontWeight: FontWeight.bold),
                        ),
                      ),
                    ],
                  ),
                ),
              )
            ],
          ),
        ),
      ),
    );
  }
}
110
likes
0
points
3.15k
downloads

Publisher

verified publishergappsolution.com

Weekly Downloads

This widget automatically scrolls the custom child widget to an infinite loop.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on scroll_loop_auto_scroll