Iteo/theme_tailor

Nested theme is getting generated of dynamic type

Closed this issue · 3 comments

As you can see below final dynamic buttonTheme; of dynamic type is being generated.

// ignore_for_file: unused_element, unused_field

import 'package:client_flutter/barrel.dart';

part 'button_theme.tailor.dart';

@TailorComponent(themes: [])
class _$ButtonTheme {
  static const List<TextStyle> textStyle = [];
  static const List<Color> color = [];
  static const List<double> height = [];
}
// ignore_for_file: unused_element, unused_field

import 'package:client_flutter/barrel.dart';

part 'theme.tailor.dart';

@TailorComponent(themes: [])
class _$GluTheme {
  static const List<GluButtonTheme> buttonTheme = [];
}

class GluTheme extends ThemeExtension<GluTheme> with DiagnosticableTreeMixin {
  const GluTheme({
    required this.buttonTheme,
  });

  final dynamic buttonTheme;

  @override
  GluTheme copyWith({
    dynamic buttonTheme,
  }) {
    return GluTheme(
      buttonTheme: buttonTheme ?? this.buttonTheme,
    );
  }

@Rongix Much appretiated.

If the 'GluButtonThem' is generated by Tailor, it is required to annotate it with '@themeExtension'annotation to hint the generator that it is not yet generated

Here is a full example, maybe we could explain it a bit better in the docs; let me know if it works for you
https://github.localhost/#nesting-generated-themeextensions-modular-themes--designsystems

@Rongix Thanks for replying mate. I will close this request as its working as expected. The issue was related to how I was using build_runner.