hideable_widget 1.0.4 copy "hideable_widget: ^1.0.4" to clipboard
hideable_widget: ^1.0.4 copied to clipboard

Hideable Widget package helps to make any static widget hideable while scrolling.

example/lib/main.dart

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

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Hideable Widget',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.orange),
        useMaterial3: true,
      ),
      home: const TestPage(),
    );
  }
}

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

  @override
  State<TestPage> createState() => _TestPageState();
}

class _TestPageState extends State<TestPage> {
  final scrollController = ScrollController();

  @override
  void dispose() {
    scrollController.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: PreferredSize(
        preferredSize: const Size(double.infinity, 56),
        child: HideableWidget(
          scrollController: scrollController,
          child: AppBar(
            title: const Text("Hideable Widget"),
            backgroundColor: Theme.of(context).colorScheme.inversePrimary,
          ),
        ),
      ),
      floatingActionButton: FloatingActionButton(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        onPressed: () {},
        tooltip: 'Create',
        child: const Icon(Icons.add),
      ),
      floatingActionButtonLocation: FloatingActionButtonLocation.endFloat,
      bottomNavigationBar: HideableWidget(
        scrollController: scrollController,
        child: BottomAppBar(
          color: Theme.of(context).colorScheme.inversePrimary,
          child: IconTheme(
            data: IconThemeData(color: Theme.of(context).colorScheme.onPrimary),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.spaceEvenly,
              children: <Widget>[
                IconButton(
                  tooltip: 'Home',
                  icon: const Icon(Icons.home),
                  onPressed: () {},
                ),
                IconButton(
                  tooltip: 'Search',
                  icon: const Icon(Icons.search),
                  onPressed: () {},
                ),
                IconButton(
                  tooltip: 'Favorite',
                  icon: const Icon(Icons.favorite),
                  onPressed: () {},
                ),
              ],
            ),
          ),
        ),
      ),
      body: ListView(
        controller: scrollController,
        physics: const ClampingScrollPhysics(),
        children: [
          ...List.generate(
            50,
            (index) => ListTile(
              title: Text("List item ${index + 1}"),
            ),
          ).toList(),
          const SizedBox(height: 100),
        ],
      ),
    );
  }
}
4
likes
160
points
28
downloads

Publisher

unverified uploader

Weekly Downloads

Hideable Widget package helps to make any static widget hideable while scrolling.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on hideable_widget