Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. # Sliver Header {{tag>flutter sliver header}} {{ http://snappyimages.nextwavesrl.netdna-cdn.com/img/27a25ffc732ceac02846a872ef15ca72.png?300}} ```dart class _SliverAppBarDelegate extends SliverPersistentHeaderDelegate { _SliverAppBarDelegate({ @required this.minHeight, @required this.maxHeight, @required this.child, }); final double minHeight; final double maxHeight; final Widget child; @override double get minExtent => minHeight; @override double get maxExtent => math.max(maxHeight, minHeight); @override Widget build( BuildContext context, double shrinkOffset, bool overlapsContent) { return new SizedBox.expand(child: child); } @override bool shouldRebuild(_SliverAppBarDelegate oldDelegate) { return maxHeight != oldDelegate.maxHeight || minHeight != oldDelegate.minHeight || child != oldDelegate.child; } } ... SliverPersistentHeader makeHeader(String headerText) { return SliverPersistentHeader( pinned: true, delegate: _SliverAppBarDelegate( minHeight: 60.0, maxHeight: 200.0, child: Container( color: Colors.lightBlue, child: Center(child: Text(headerText))), ), ); } ... makeHeader('Header Section 1'), ``` ## 출처 - https://medium.com/flutter/slivers-demystified-6ff68ab0296f open/sliver-header.txt Last modified: 2024/10/05 06:15by 127.0.0.1