Skip to content

Commit 73308fe

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

File tree

1 file changed

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

1 file changed

+11
-12
lines changed

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

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -120,19 +120,18 @@ 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 =
124+
(component.componentProperties as HeadingProperties).level;
124125
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-
}
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+
};
136135
return Padding(
137136
padding: const EdgeInsets.symmetric(vertical: 2.0, horizontal: 4.0),
138137
child: Text(text, style: style),

0 commit comments

Comments
 (0)