sliver_overfill_remaining 0.1.1 copy "sliver_overfill_remaining: ^0.1.1" to clipboard
sliver_overfill_remaining: ^0.1.1 copied to clipboard

A sliver that always fills the remaining space in the viewport, plus some extra height.

example/lib/main.dart

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

const sliverAppBarExpandedHeight = 300.0;
const sliverAppBarToolbarHeight = kToolbarHeight;
const sliverAppBarTabBarHeight = 50.0;
double get sliverAppBarFlexDelta =>
    sliverAppBarExpandedHeight -
    sliverAppBarToolbarHeight -
    sliverAppBarTabBarHeight;

void main() {
  runApp(MaterialApp(
    home: Scaffold(
      body: CustomScrollView(
        slivers: [
          const _SliverAppBar(),
          SliverOverfillRemaining(
            extraHeight: sliverAppBarFlexDelta,
            child: const Placeholder(),
          ),
        ],
      ),
    ),
  ));
}

class _SliverAppBar extends StatelessWidget {
  const _SliverAppBar();

  @override
  Widget build(BuildContext context) {
    return const SliverAppBar(
      pinned: true,
      floating: false,
      title: Text('sliver_overfill_remaining example'),
      backgroundColor: Colors.orange,
      toolbarHeight: sliverAppBarToolbarHeight,
      expandedHeight: sliverAppBarExpandedHeight,
      flexibleSpace: FlexibleSpaceBar(
        background: Placeholder(),
      ),
      bottom: PreferredSize(
        preferredSize: Size.fromHeight(sliverAppBarTabBarHeight),
        child: DefaultTabController(
          length: 1,
          child: TabBar(
            tabs: [
              Tab(
                text: 'This is the bottom tab bar',
              )
            ],
          ),
        ),
      ),
    );
  }
}
0
likes
150
points
22
downloads

Publisher

unverified uploader

Weekly Downloads

A sliver that always fills the remaining space in the viewport, plus some extra height.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, sliver_tools

More

Packages that depend on sliver_overfill_remaining