zoom_view 0.0.1 copy "zoom_view: ^0.0.1" to clipboard
zoom_view: ^0.0.1 copied to clipboard

Widget that allows both zooming and scrolling a `ListView` or other `Scrollable`s

Widget that allows both zooming and scrolling a ListView or other Scrollables

Features #

Scroll a ListView while it is zoomed in with fling velocity

Usage #

Using ListView #

import 'package:zoom_view/zoom_view.dart';


void main() {
  runApp(const MyApp());
}

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

class _MyAppState extends State<MyApp> {
  ScrollController controller = ScrollController();
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        home:  Scaffold(
          body: ZoomListView(
            child: ListView.builder(
                physics: const NeverScrollableScrollPhysics(),
                controller: controller,
                itemCount: 10000,
                itemBuilder: (context, index) {
                  return Center(
                      child: Text("text $index")
                  );
                }
            ),
          ),
        )
    );
  }
}

note that the controller argument most be set, and the the physics must be set to NeverScrollableScrollPhysics

Using some other scrolling list #


class ZoomViewExample extends StatefulWidget {
  const ZoomViewExample({super.key});

  @override
  State<ZoomViewExample> createState() => _ZoomViewExampleState();
}

class _ZoomViewExampleState extends State<ZoomViewExample> {
  ScrollController controller = ScrollController();
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        home:  Scaffold(
          body: ZoomView(
            controller: controller,
            child: ListView.builder(
                physics: const NeverScrollableScrollPhysics(),
                controller: controller,
                itemCount: 10000,
                itemBuilder: (context, index) {
                  return Center(
                      child: Text("text $index")
                  );
                }
            ),
          ),
        )
    );
  }
}


Note that here the controller is given both to the ZoomView and the list. Other Scrollables that use ScrollController should work as well. Make sure that NeverScrollableScrollPhysics ot some equivalent is set

3
likes
0
pub points
58%
popularity

Publisher

unverified uploader

Widget that allows both zooming and scrolling a `ListView` or other `Scrollable`s

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on zoom_view