appBarExpansionPercent property

double get appBarExpansionPercent

When you are in sliver AppBar you may want to get current percent 0.0 -> Expanded 1.0 -> Collapsed to toolbar

Implementation

double get appBarExpansionPercent {
  final settings =
      dependOnInheritedWidgetOfExactType<FlexibleSpaceBarSettings>();
  assert(settings != null);
  if (settings != null) {
    final deltaExtent = settings.maxExtent - settings.minExtent;

    return (1.0 - (settings.currentExtent - settings.minExtent) / deltaExtent)
        .clamp(0.0, 1.0);
  }
  return 0;
}