persistent_header_adaptive 2.1.0 copy "persistent_header_adaptive: ^2.1.0" to clipboard
persistent_header_adaptive: ^2.1.0 copied to clipboard

This ia a package that provide capability to create SliverPersistentHeader with intrinsic height

example/lib/main.dart

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,
              ),
            ),
          ],
        ),
      ),
    );
  }
}
6
likes
130
pub points
85%
popularity

Publisher

verified publishercamillobucciarelli.it

This ia a package that provide capability to create SliverPersistentHeader with intrinsic height

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

flutter

More

Packages that depend on persistent_header_adaptive