This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
class TitleBar extends SliverPersistentHeaderDelegate { | |
const TitleBar(this.height, this.topPadding); | |
final double height; | |
final double topPadding; | |
@override | |
double get minExtent => height + topPadding; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:flutter/rendering.dart'; | |
class _CacheHeight extends SingleChildRenderObjectWidget { | |
const _CacheHeight({ | |
super.key, | |
super.child, | |
required this.heights, | |
required this.index, | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
class SliverListDemo extends StatelessWidget { | |
const SliverListDemo({ super.key }); | |
@override | |
Widget build(BuildContext context) { | |
final List<int> itemHeights = <int>[1, 3, 5, 1, 3, 2, 4, 2, 1, 4, 1]; // # of calendars per item | |
return Scaffold( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
class CalendarSlivers extends StatelessWidget { | |
const CalendarSlivers({ | |
super.key, | |
required this.startColor, | |
required this.endColor, | |
}); | |
final Color startColor; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
const List<double> itemHeights = <double>[ | |
600, 300, 800, 40, 400, 50, 80, 60, 50, 40, 40, 300, 400, 50, 800, 200, 30, | |
500, 80, 700, 40, 160, 50, 400, 80, 200, 500, 100, 80, 40, 200, 60, 600, | |
]; | |
class ItemSlivers extends StatelessWidget { | |
const ItemSlivers({ | |
super.key, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This version of the SliverAppBar iOS large title snap demo is similar to | |
// snap.dart but uses a pair of SliverPersistentHeaders for the title | |
// and large title. This makes the layout simpler and obviates the ClipBox | |
// widget. | |
// | |
// Problems: | |
// - Same as snap.dart per the ScrollController and desktop. | |
// - To package this approach up as a single Sliver, SliverMainAxisGroup is needed. | |
// - It seems like the stretchConfiguration property should be on LargeTitleBar, since that's | |
// the one we want to stretch (plus scaling upon stretching...) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
// This widget clips its bottom-aligned child. When the ClipBox's | |
// height gets continually smaller, the child appears to be | |
// moving upwards - the top of the is increasingly clipped while | |
// the bottom remains visible. | |
class ClipBox extends StatelessWidget { | |
const ClipBox({ super.key, required this.child }); | |
final Widget child; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://gist.github.com/HansMuller/dab66f5d34225ad8499ad285e69b6160 | |
// The goal here is for the 'ClipBoxDemo' text widget to appear to scroll upwards | |
// and be clipped by its Container, as the height of its Container is reduced. | |
import 'package:flutter/material.dart'; | |
class ClipBoxDemo extends StatelessWidget { | |
const ClipBoxDemo({ super.key }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/widgets.dart'; | |
class Application with WidgetsBindingObserver { | |
final Widget home; | |
final Function onLaunch; | |
final Function onTerminate; | |
Application({ | |
@required this.home, | |
this.onLaunch, |