modal_bottom_sheet icon indicating copy to clipboard operation
modal_bottom_sheet copied to clipboard

Improve fidelity for CupertinoBottomSheet

Open bierbaumtim opened this issue 2 years ago • 1 comments

This PR is a reworked version of #44 .

This PR adds the changes discussed in #41 and #138 .

The previousRoute is now wrapped with a CupertinoUserInterfaceLevel with CupertinoUserInterfaceLevel.elevated thus the CupertinoDynamicColors automatically uses the elevatedColor. The previousRoute is also wrapped with a new CupertinoTheme which enforces elevated colors and set primaryColor to gray which previously was done by the ColorFilter. This solution should result in a smoother animation.

The seconds change I made was to wrap the child of the modal with CupertinoUserInterfaceLevel and give it also an CupertinoUserInterfaceLevel.elevated.

bierbaumtim avatar Mar 27 '22 14:03 bierbaumtim

It seems like that the animation doesn't work. I assume it's due to the changing context during the animation but can't say for sure.

I added a scaffoldBackgroundColor as a fix:

      final scaffoldBackgroundColor =
          CupertinoDynamicColor.withBrightnessAndContrast(
        color: dynamicScaffoldBackgroundColor.color,
        darkColor: dynamicScaffoldBackgroundColor.darkColor,
        highContrastColor:
            dynamicScaffoldBackgroundColor.highContrastColor,
        darkHighContrastColor:
            dynamicScaffoldBackgroundColor.darkHighContrastColor,
      );


      previousRouteTheme = previousRouteTheme.copyWith(
        scaffoldBackgroundColor: ColorTween(
          begin: scaffoldBackgroundColor.resolveFrom(context),
          end: elevatedScaffoldBackgroundColor.resolveFrom(context),
        ).evaluate(animation),
      );

It did not work with

    final systemBackground = CupertinoDynamicColor.resolve(
      cTheme.scaffoldBackgroundColor,
      context,
    );

SimonVillage avatar Apr 04 '22 05:04 SimonVillage

I think that is is not animated because we are using CupertinoTheme widget, we should take care of the animation ourselves in a way similar to AnimatedTheme

jamesblasco avatar Sep 05 '22 10:09 jamesblasco