@@ -120,19 +120,17 @@ class _ExampleViewState extends State<ExampleView> {
120
120
children,
121
121
) {
122
122
final text = properties['text' ] as String ? ?? '' ;
123
- final level = properties[ 'level' ] as String ? ;
123
+ final level = (component.componentProperties as HeadingProperties ).level ;
124
124
TextStyle ? style;
125
- if (level != null ) {
126
- style = switch (level) {
127
- '1' => Theme .of (context).textTheme.headlineSmall,
128
- '2' => Theme .of (context).textTheme.titleLarge,
129
- '3' => Theme .of (context).textTheme.titleMedium,
130
- '4' => Theme .of (context).textTheme.bodyLarge,
131
- '5' => Theme .of (context).textTheme.bodyMedium,
132
- '6' => Theme .of (context).textTheme.bodySmall,
133
- _ => Theme .of (context).textTheme.bodyMedium,
134
- };
135
- }
125
+ style = switch (level) {
126
+ '1' => Theme .of (context).textTheme.headlineSmall,
127
+ '2' => Theme .of (context).textTheme.titleLarge,
128
+ '3' => Theme .of (context).textTheme.titleMedium,
129
+ '4' => Theme .of (context).textTheme.bodyLarge,
130
+ '5' => Theme .of (context).textTheme.bodyMedium,
131
+ '6' => Theme .of (context).textTheme.bodySmall,
132
+ _ => Theme .of (context).textTheme.bodyMedium,
133
+ };
136
134
return Padding (
137
135
padding: const EdgeInsets .symmetric (vertical: 2.0 , horizontal: 4.0 ),
138
136
child: Text (text, style: style),
0 commit comments