Skip to content

Dashbook.dualTheme() doesn't assign any value to the variable theme #90

@bahag-desouzacastror

Description

@bahag-desouzacastror

Description

I'm trying to access the theme from dashbook and I started receiving null pointers. And them I realised that the constructor Dashbook.dualTheme doesn't assign any value to the variable theme.

This scenario works as expected

final dashbook = Dashbook(
    theme: BahagTheme.light,
  );

dashbook.storiesOf('Colors').decorator(CenterDecorator()).add(
        'Foundation',
        (context) => Padding(
          padding: const EdgeInsets.all(20.0),
          child: Column(
            children: [
              Text(
                'COLORS',
                style: dashbook.theme!.textTheme.headline1!
                    .copyWith(fontSize: 28, color: Colors.black),
              ),

This scenario doesn't work as expected

final dashbook = Dashbook.dualTheme(
    light: BahagTheme.light,
    dark: BahagTheme.dark,
  );

dashbook.storiesOf('Colors').decorator(CenterDecorator()).add(
        'Foundation',
        (context) => Padding(
          padding: const EdgeInsets.all(20.0),
          child: Column(
            children: [
              Text(
                'COLORS',
                style: dashbook.theme!.textTheme.headline1!
                    .copyWith(fontSize: 28, color: Colors.black),
              ),

Screenshot 2022-08-29 at 17 02 01

You can see in the printscreen that the private variable _dualTheme exists with both themes assigned, but the variable theme remains unassigned.

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