Dropsource / monarch

Monarch is a tool for building Flutter widgets in isolation. It makes it easy to build, test and debug complex UIs.
https://monarchapp.io
MIT License
433 stars 22 forks source link

@MonarchTheme isDefault not working for me #88

Closed philipmjohnson closed 1 year ago

philipmjohnson commented 1 year ago

I have annotated one of my themes to be the default following the instructions:

@MonarchTheme('Green Forest: Light', isDefault: true)
ThemeData get greenForestLight => FlexThemeData.light(
      scheme: FlexScheme.green,
      surfaceMode: FlexSurfaceMode.levelSurfacesLowScaffold,
      blendLevel: 7,
      subThemesData: const FlexSubThemesData(
        blendOnLevel: 10,
        blendOnColors: false,
        useTextTheme: true,
      ),
      visualDensity: FlexColorScheme.comfortablePlatformDensity,
      // To use the playground font, add GoogleFonts package and uncomment
      fontFamily: GoogleFonts.notoSans().fontFamily,
    );

I notice that my themes appear at the bottom of the dropdown list of themes, and that my desired default theme is not selected by default (instead, it is the first theme in the list, Material Light).

Am I doing something wrong? My pubspec.yml:

name: ggc_app
description: Geo Garden Club app
publish_to: 'none'
version: 1.0.0+1
environment:
  sdk: '>=2.18.4 <3.0.0'
dependencies:
  flutter:
    sdk: flutter
  flutter_localizations:
    sdk: flutter
  # Theme stuff
  flutter_native_splash: ^2.2.14
  flex_color_scheme: ^7.0.3
  badges: ^3.0.3
  flutter_markdown: ^0.6.13
  # The next three provide forms.
  flutter_form_builder: ^7.7.0
  form_builder_validators: ^8.4.0
  intl: ^0.17.0
  # State management
  flutter_riverpod: ^2.0.2
  # Firebase
  firebase_core: ^2.4.1
  firebase_auth: ^4.2.10
  cloud_firestore: ^4.3.1
  firebase_ui_auth: ^1.1.7
  logger: ^1.1.0
  freezed_annotation: ^2.2.0
  json_annotation: ^4.8.0
  cached_network_image: ^3.2.3
  go_router: ^6.5.5
  google_fonts: ^4.0.3
  monarch_annotations: ^1.0.2

dev_dependencies:
  flutter_test:
    sdk: flutter
  flutter_lints: ^2.0.0
  build_runner: ^2.1.11
  freezed: ^2.3.2
  json_serializable: ^6.6.1
  monarch: ^3.0.0
  flutter_gen: ^5.3.0

flutter_native_splash:
  image: assets/images/ggc.png
  color: "#43b02a"

flutter:
  uses-material-design: true
  # Enable generation of localized Strings from arb files.
  generate: true
  assets:
    - assets/images/
    - assets/initialData/

Flutter Doctor:

$ flutter doctor                                                                    10:20:14
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.7.11, on macOS 13.2.1 22D68 darwin-arm64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.3)
[✓] IntelliJ IDEA Ultimate Edition (version 2023.1)
[✓] Connected device (3 available)
[✓] HTTP Host Availability

• No issues found!
fertrig commented 1 year ago

I can reproduce this issue. You are not doing anything wrong. The MonarchTheme.isDefault flag is not working.

I am thinking of deprecating this flag instead of fixing this issue. In the near future, we will introduce story configurations. A story configuration would let you declare many things at the story level, like:

philipmjohnson commented 1 year ago

That sounds like a nice solution. I look forward to the availability of story configurations!