Skip to content

Commit a95a16f

Browse files
committed
Minor PR improvements
1 parent ac323c0 commit a95a16f

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

packages/stream_core_flutter/lib/src/components/controls/stream_command_chip.dart

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,23 +81,24 @@ class DefaultStreamCommandChip extends StatelessWidget {
8181
final effectiveBackgroundColor = chipTheme.backgroundColor ?? defaults.backgroundColor;
8282
final effectiveLabelColor = chipTheme.labelColor ?? defaults.labelColor;
8383
final effectiveIconColor = chipTheme.iconColor ?? defaults.iconColor;
84+
final effectiveMinHeight = chipTheme.minHeight ?? defaults.minHeight;
8485

8586
return Container(
8687
padding: defaults.padding,
8788
decoration: BoxDecoration(
8889
color: effectiveBackgroundColor,
8990
borderRadius: defaults.borderRadius,
9091
),
91-
constraints: const BoxConstraints(minHeight: 24),
92+
constraints: BoxConstraints(minHeight: effectiveMinHeight),
9293
child: Row(
9394
mainAxisSize: MainAxisSize.min,
95+
spacing: defaults.spacing.xxxs,
9496
children: [
9597
Icon(
9698
context.streamIcons.thunder,
9799
size: 12,
98100
color: effectiveIconColor,
99101
),
100-
SizedBox(width: defaults.spacing.xxxs),
101102
MediaQuery.withNoTextScaling(
102103
child: Text(
103104
props.label,
@@ -106,8 +107,7 @@ class DefaultStreamCommandChip extends StatelessWidget {
106107
maxLines: 1,
107108
),
108109
),
109-
if (props.onDismiss != null) ...[
110-
SizedBox(width: defaults.spacing.xxxs),
110+
if (props.onDismiss != null)
111111
GestureDetector(
112112
onTap: props.onDismiss,
113113
behavior: HitTestBehavior.opaque,
@@ -121,7 +121,6 @@ class DefaultStreamCommandChip extends StatelessWidget {
121121
),
122122
),
123123
),
124-
],
125124
],
126125
),
127126
);
@@ -137,6 +136,7 @@ class _StreamCommandChipDefaults {
137136
late final _colorScheme = _context.streamColorScheme;
138137
late final _textTheme = _context.streamTextTheme;
139138
late final spacing = _context.streamSpacing;
139+
late final _radius = _context.streamRadius;
140140

141141
Color get backgroundColor => _colorScheme.backgroundInverse;
142142

@@ -146,10 +146,12 @@ class _StreamCommandChipDefaults {
146146

147147
TextStyle get labelStyle => _textTheme.metadataEmphasis;
148148

149+
double get minHeight => 24;
150+
149151
EdgeInsetsGeometry get padding => EdgeInsets.symmetric(
150152
horizontal: spacing.xs,
151153
vertical: spacing.xxxs,
152154
);
153155

154-
BorderRadius get borderRadius => const BorderRadius.all(Radius.circular(9999));
156+
BorderRadius get borderRadius => BorderRadius.all(_radius.max);
155157
}

packages/stream_core_flutter/lib/src/theme/components/stream_command_chip_theme.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ class StreamCommandChipThemeData with _$StreamCommandChipThemeData {
5555
this.backgroundColor,
5656
this.labelColor,
5757
this.iconColor,
58+
this.minHeight,
5859
});
5960

6061
/// The background color of the chip.
@@ -66,6 +67,9 @@ class StreamCommandChipThemeData with _$StreamCommandChipThemeData {
6667
/// The color of the leading and trailing icons.
6768
final Color? iconColor;
6869

70+
/// The minimum height of the chip.
71+
final double? minHeight;
72+
6973
/// Linearly interpolate between two [StreamCommandChipThemeData] objects.
7074
static StreamCommandChipThemeData? lerp(
7175
StreamCommandChipThemeData? a,

packages/stream_core_flutter/lib/src/theme/components/stream_command_chip_theme.g.theme.dart

Lines changed: 7 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)