hideable_widget 1.0.4
hideable_widget: ^1.0.4 copied to clipboard
Hideable Widget package helps to make any static widget hideable while scrolling.
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),
],
),
);
}
}