Skip to content

Setting FlashTheme ignores fontStyle, fontSize, fontWeight of contentStyle #49

Closed

Description

@tmaihoff

When I set a FlashTheme I expect it to be applied to the FlashBars down the widget tree.

But when I set the contentStyle, only the color is respected. Other attributes like fontStyle, fontSize and fontWeight are ignored.

See the following example:

class FlashTest extends StatelessWidget {
  const FlashTest({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return FlashTheme(
      flashBarTheme: const FlashBarThemeData(
        contentStyle: TextStyle(
          color: Colors.green,
          fontStyle: FontStyle.italic,
          fontSize: 8,
          fontWeight: FontWeight.bold,
        ),
      ),
      child: Builder(
        builder: (context) {
          return TextButton(
            child: const Text('show flashbar'),
            onPressed: () => context.showFlashBar(
              content: const Text('content'),
            ),
          );
        },
      ),
    );
  }
}

This produces the following FlashBar. As you can see, only the green color is set:
WhatsApp Image 2022-07-18 at 17 29 52

However, when I set the same contentStyle directly in the showFlashBarmethod, it works as expected:

            onPressed: () => context.showFlashBar(
              content: const Text('content'),
              contentStyle: const TextStyle(
                color: Colors.green,
                fontStyle: FontStyle.italic,
                fontSize: 8,
                fontWeight: FontWeight.bold,
              ),
            ),

WhatsApp Image 2022-07-18 at 17 29 52 (1)

Any idea?

Activity

  1. sososdk commented on Jul 19, 2022

    @sososdk
    Owner

    Fixed in 2.0.3+3.

  2. added a commit that references this issue on Jul 19, 2022
    aecadd9
  3. tmaihoff commented on Jul 23, 2022

    @tmaihoff
    Author

    thanks for the quick fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions