Skip to content

Commit ac92e64

Browse files
committed
Clean up properties access.
1 parent d3276f6 commit ac92e64

File tree

1 file changed

+10
-12
lines changed
  • packages/spikes/gulf_client/example/lib

1 file changed

+10
-12
lines changed

packages/spikes/gulf_client/example/lib/main.dart

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -120,19 +120,17 @@ class _ExampleViewState extends State<ExampleView> {
120120
children,
121121
) {
122122
final text = properties['text'] as String? ?? '';
123-
final level = properties['level'] as String?;
123+
final level = (component.componentProperties as HeadingProperties).level;
124124
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+
};
136134
return Padding(
137135
padding: const EdgeInsets.symmetric(vertical: 2.0, horizontal: 4.0),
138136
child: Text(text, style: style),

0 commit comments

Comments
 (0)