Closed stephanie-finch closed 6 months ago
Thanks @ritheshSalyan for working on this! @SachinGanesh wondering if there's anything blocking from accepting the merge request? We have a lot of screenshots we'd like to generate more easily.
@stephanie-finch PR Already merged.
@SachinGanesh Oh, was styling with Theme.of(context) supposed to be fixed with the merge request? We still have the same issue even when using screenshot v1.2.3 (with Flutter 2.2.3, Dart 2.13.4) so wanted to double check whether that's expected or if this issue seems too hard to get fixed.
Thanks!
What work for me is directly use GoogleFonts.montserratTextTheme().bodyText1!.copyWith
InheritedTheme.captureAll
work for me below is example
final image = await ScreenshotController() .captureFromWidget(InheritedTheme.captureAll( context, YourWidget( child : xxx ), ))
Had a similar problem: when using Theme.of(context).colorScheme.primary
, the color in the screenshot would be different.
InheritedTheme.captureAll
work for me below is examplefinal image = await ScreenshotController() .captureFromWidget(InheritedTheme.captureAll( context, YourWidget( child : xxx ), ))
This helped! @acike thank you!
Text styling in my screenshot goes bananas when I style with
Theme.of(context).textTheme.*
but the screenshot will look okay if I hardcode text styles. This was reproducible in our iOS and Android emulators withFlutter v2.0.6
andscreenshot: ^1.2
. Examples below, let us know if there's anything else that'll be useful to provide for debugging!Hardcoded Text Style Example What screenshot looks like when we are hardcoding text style (which is correct and matches what widget looks like in app):
Broken Styling Using Theme Example When using
Theme.of(context).textTheme
:In case it's useful, this is how we're capturing:
font in pubspec.yaml