jamesblasco / modal_bottom_sheet

Flutter | Create advanced modal bottom sheets. Material, Cupertino or your own style
https://pub.dev/packages/modal_bottom_sheet
MIT License
1.89k stars 474 forks source link

iOS StatusBar color behaves wrong with CupertinoScaffold #66

Open kegesch opened 4 years ago

kegesch commented 4 years ago

The iOS status bar color should usually stay the same. However one I surround my CupertinoPageScaffold with CupertinoScaffold. It changes its default color to white (on white background).

CupertinoApp(
     home: CupertinoScaffold(
        body: CupertinoPageScaffold(
          child: Container(),
        ),
      ),
);

Although this works fine:

CupertinoApp(
     home: CupertinoPageScaffold(
       child: Container(),
     ),
);
sudo-ulmas commented 3 years ago

@kegesch have you found any solution for this

kegesch commented 3 years ago

@ulmas97 No, I ended up using my own Popup-Modal.

Coronon commented 1 year ago

This is still a big problem for me - why does this change the theming?

From the little experementing that I did this piece of code seems to cause the troubles: (located in the createPreviousRouteTheme method on _CupertinoModalTransition here)

previousRouteTheme = previousRouteTheme.copyWith(
        scaffoldBackgroundColor: ColorTween(
          begin: systemBackground,
          end: elevatedScaffoldBackgroundColor.resolveFrom(context),
        ).evaluate(animation),
        primaryColor: CupertinoColors.placeholderText.resolveFrom(context), // <- Simply overrides the primary color!
      );

// [...]

previousRouteTheme = previousRouteTheme.copyWith(
        barBackgroundColor: ColorTween(
          begin: barBackgroundColor,
          end: elevatedBarBackgroundColor.resolveFrom(context),
        ).evaluate(animation),
        primaryColor: CupertinoColors.placeholderText.resolveFrom(context), // <- Simply overrides the primary color!
      );

Why would the wrapper change the theming of its child (not the sheet) anyway?

PS: A quick fix for anyone having this problem is to simply comment out these two lines in the downloaded package in your pubcache folder. If you use VSCode you could simply use F12 to navigate to it.