как мне анимировать цвет и радиус на SliverPersistentHeaderDelegate? - PullRequest
0 голосов
/ 19 июня 2020

Сейчас я меняю цвет и радиус вот так, это нехорошо.

borderRadius внезапно изменил 30 на 0, я хочу поменять, например, 30,29,28 .. на 0 .. также цвет изменится, как это

 class SliverDelegate extends SliverPersistentHeaderDelegate {
  final double expandedHeight;

  SliverDelegate({
    @required this.expandedHeight
  });

  @override
  Widget build(
      BuildContext context, double shrinkOffset, bool overlapsContent) {
    final double topBar = CustomSize.topPadding(context);
    final appBarSize = expandedHeight - shrinkOffset;
    final proportion = 2 - (expandedHeight / appBarSize);
    final percent = proportion < 0 || proportion > 1 ? 0.0 : proportion;

    final double borderRadius = percent > 0 ? 30.0 : 0.0;
    final Color backgroundColor = percent > 0 ? Colors.white:Colors.black;
    final Brightness brightness = percent > 0 ?Brightness.dark:Brightness.light;
...