persistent_header_adaptive 2.1.0 persistent_header_adaptive: ^2.1.0 copied to clipboard
This ia a package that provide capability to create SliverPersistentHeader with intrinsic height
import 'package:example/header.dart';
import 'package:flutter/material.dart';
import 'package:persistent_header_adaptive/persistent_header_adaptive.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(
primarySwatch: Colors.blue,
),
home: const Homepage(),
);
}
}
class Homepage extends StatefulWidget {
const Homepage({super.key});
@override
State<Homepage> createState() => _HomepageState();
}
class _HomepageState extends State<Homepage> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: CustomScrollView(
slivers: [
const AdaptiveHeightSliverPersistentHeader(
initialHeight: 20,
floating: true,
child: Header(),
),
SliverList(
delegate: SliverChildBuilderDelegate(
(context, index) => Card(
margin: const EdgeInsets.all(20),
child: Padding(
padding: const EdgeInsets.all(20),
child: Text('card $index'),
),
),
childCount: 100,
),
),
],
),
),
);
}
}