fab_scroll_animator 1.0.0 copy "fab_scroll_animator: ^1.0.0" to clipboard
fab_scroll_animator: ^1.0.0 copied to clipboard

Add native Flutter animation to the FloatingActionButton when scrolling a ListView or GridView.

example/lib/main.dart

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

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

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(title: 'Flutter Demo', theme: ThemeData(colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), useMaterial3: true), home: const MyHomePage(title: 'Flutter Demo Home Page'));
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  final ScrollController _listViewController = ScrollController();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(backgroundColor: Theme.of(context).colorScheme.inversePrimary, title: Text(widget.title)),
      body: Scrollbar(
        controller: _listViewController,
        child: ListView.builder(
          controller: _listViewController,
          itemCount: 130,
          itemBuilder: (context, index) {
            return ListTile(title: Text("LLLLoooonnnngggg title $index"));
          },
        ),
      ),
      floatingActionButton: FABScrollAnimator(scrollController: _listViewController, onScroll: (isExtended) => FloatingActionButton.extended(isExtended: isExtended, backgroundColor: Colors.orange, icon: const Icon(Icons.add, color: Colors.white), label: const Text('LLLLoooonnnngggg Text', style: TextStyle(color: Colors.white)), onPressed: () async {})),
    );
  }
}
3
likes
140
points
24
downloads

Publisher

unverified uploader

Weekly Downloads

Add native Flutter animation to the FloatingActionButton when scrolling a ListView or GridView.

Repository (GitHub)
View/report issues

Topics

#scroll #animator #fab #floatingactionbutton

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on fab_scroll_animator