Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,12 @@ import 'package:widgetbook_annotation/widgetbook_annotation.dart' as widgetbook;
Widget buildStreamSplitButtonPlayground(BuildContext context) {
final icons = context.streamIcons;

final style = context.knobs.object.dropdown(
label: 'Style',
options: StreamButtonStyle.values,
initialOption: StreamButtonStyle.secondary,
final variant = context.knobs.object.dropdown(
label: 'Variant',
options: StreamSplitButtonVariant.values,
initialOption: StreamSplitButtonVariant.regular,
labelBuilder: (option) => option.name,
description: 'Split button visual style variant.',
);

final type = context.knobs.object.dropdown(
label: 'Type',
options: StreamButtonType.values,
initialOption: StreamButtonType.solid,
labelBuilder: (option) => option.name,
description: 'Split button type variant. Outline draws one border around both halves.',
description: 'Split button color scheme variant.',
);

final caretUp = context.knobs.boolean(
Expand Down Expand Up @@ -59,13 +51,12 @@ Widget buildStreamSplitButtonPlayground(BuildContext context) {
child: _MaybeBadged(
showErrorBadge: showErrorBadge,
child: StreamSplitButton.icon(
icon: Icon(icons.voiceFill),
leadingIcon: Icon(icons.voiceFill),
trailingIcon: Icon(caretUp ? icons.caretUp : icons.caretDown),
style: style,
type: type,
tooltip: 'Mute',
variant: variant,
leadingTooltip: 'Mute',
trailingTooltip: 'Audio settings',
onPressed: leadingEnabled ? () {} : null,
onLeadingPressed: leadingEnabled ? () {} : null,
onTrailingPressed: trailingEnabled ? () {} : null,
),
),
Expand Down Expand Up @@ -94,7 +85,7 @@ Widget buildStreamSplitButtonShowcase(BuildContext context) {
crossAxisAlignment: CrossAxisAlignment.start,
spacing: spacing.xl,
children: const [
_StyleTypeMatrixSection(),
_VariantSection(),
_DisabledSection(),
_CallControlSection(),
],
Expand All @@ -103,37 +94,35 @@ Widget buildStreamSplitButtonShowcase(BuildContext context) {
);
}

class _StyleTypeMatrixSection extends StatelessWidget {
const _StyleTypeMatrixSection();
class _VariantSection extends StatelessWidget {
const _VariantSection();

@override
Widget build(BuildContext context) {
final icons = context.streamIcons;
final spacing = context.streamSpacing;

return _ExampleCard(
title: 'Style × type',
title: 'Variants',
description: 'The surface resolves from the same button style the halves use, so the two never drift apart.',
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
spacing: spacing.md,
children: [
for (final style in StreamButtonStyle.values)
for (final variant in StreamSplitButtonVariant.values)
Row(
spacing: spacing.md,
children: [
SizedBox(width: 88, child: Text(style.name)),
for (final type in StreamButtonType.values)
StreamSplitButton.icon(
icon: Icon(icons.voiceFill),
trailingIcon: Icon(icons.caretDown),
style: style,
type: type,
tooltip: 'Mute',
trailingTooltip: 'Audio settings',
onPressed: () {},
onTrailingPressed: () {},
),
SizedBox(width: 88, child: Text(variant.name)),
StreamSplitButton.icon(
leadingIcon: Icon(icons.voiceFill),
trailingIcon: Icon(icons.caretDown),
variant: variant,
leadingTooltip: 'Mute',
trailingTooltip: 'Audio settings',
onLeadingPressed: () {},
onTrailingPressed: () {},
),
],
),
],
Expand Down Expand Up @@ -165,10 +154,9 @@ class _DisabledSection extends StatelessWidget {
spacing: spacing.xs,
children: [
StreamSplitButton.icon(
icon: Icon(icons.voiceFill),
leadingIcon: Icon(icons.voiceFill),
trailingIcon: Icon(icons.caretDown),
style: StreamButtonStyle.secondary,
onPressed: leading ? () {} : null,
onLeadingPressed: leading ? () {} : null,
onTrailingPressed: trailing ? () {} : null,
),
Text(label),
Expand Down Expand Up @@ -204,12 +192,12 @@ class _CallControlSectionState extends State<_CallControlSection> {
child: _MaybeBadged(
showErrorBadge: true,
child: StreamSplitButton.icon(
icon: Icon(_isMuted ? icons.voiceOffFill : icons.voiceFill),
leadingIcon: Icon(_isMuted ? icons.voiceOffFill : icons.voiceFill),
trailingIcon: Icon(_isSettingsOpen ? icons.caretUp : icons.caretDown),
style: _isMuted ? StreamButtonStyle.destructive : StreamButtonStyle.secondary,
tooltip: _isMuted ? 'Unmute' : 'Mute',
variant: _isMuted ? StreamSplitButtonVariant.destructive : StreamSplitButtonVariant.regular,
leadingTooltip: _isMuted ? 'Unmute' : 'Mute',
trailingTooltip: 'Audio settings',
onPressed: () => setState(() => _isMuted = !_isMuted),
onLeadingPressed: () => setState(() => _isMuted = !_isMuted),
onTrailingPressed: () => setState(() => _isSettingsOpen = !_isSettingsOpen),
),
),
Expand Down
5 changes: 4 additions & 1 deletion packages/stream_core_flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@

- Added `StreamColorScheme.backgroundOverlayDarkStrong`, the design system's `background/core/overlay-dark-strong` token. A heavier version of `backgroundOverlayDark`, for content that has to stay legible on top of arbitrary imagery or video.
- Added `StreamReactions.onReactionLongPressed`, reporting the long-pressed `StreamReactionsItem` — or `null` for the cluster/overflow chip. When null, the chips register no long-press gesture, leaving it to an ancestor.
- Added `StreamSplitButton`.
- Added `StreamSplitButton`, in the two variants the design covers —
`StreamSplitButtonVariant.regular` and `.destructive`. Each variant carries
its own `StreamSplitButtonStyle` on `StreamSplitButtonThemeData`, so the two
can be themed independently.
- Refreshed the icon set from the design tokens and added 44 icons, including a
filled variant for many existing icons: `blurFill`, `boltFill`,
`cameraFlipFill`, `captionFill`, `caretDown`, `caretUp`, `copyFill`,
Expand Down
Loading
Loading