Skip to content
Open
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 @@ -18,6 +18,8 @@ import 'package:design_system_gallery/components/stream_online_indicator.dart'
as _design_system_gallery_components_stream_online_indicator;
import 'package:design_system_gallery/primitives/colors.dart'
as _design_system_gallery_primitives_colors;
import 'package:design_system_gallery/primitives/icons.dart'
as _design_system_gallery_primitives_icons;
import 'package:design_system_gallery/primitives/radius.dart'
as _design_system_gallery_primitives_radius;
import 'package:design_system_gallery/primitives/spacing.dart'
Expand Down Expand Up @@ -50,6 +52,21 @@ final directories = <_widgetbook.WidgetbookNode>[
),
],
),
_widgetbook.WidgetbookFolder(
name: 'Icons',
children: [
_widgetbook.WidgetbookComponent(
name: 'StreamIcons',
useCases: [
_widgetbook.WidgetbookUseCase(
name: 'All Icons',
builder: _design_system_gallery_primitives_icons
.buildStreamIconsShowcase,
),
],
),
],
),
_widgetbook.WidgetbookFolder(
name: 'Radius',
children: [
Expand Down
2 changes: 1 addition & 1 deletion apps/design_system_gallery/lib/app/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class _StreamLogo extends StatelessWidget {
@override
Widget build(BuildContext context) {
return const SvgIcon(
StreamIcons.logo,
StreamSvgIcons.logo,
size: 80,
);
}
Expand Down
2 changes: 1 addition & 1 deletion apps/design_system_gallery/lib/core/stream_icons.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:svg_icon_widget/svg_icon_widget.dart';

/// Stream icon assets used throughout the gallery.
abstract final class StreamIcons {
abstract final class StreamSvgIcons {
/// The Stream boat logo.
static const logo = SvgIconData(
'assets/stream_logo.svg',
Expand Down
97 changes: 97 additions & 0 deletions apps/design_system_gallery/lib/primitives/icons.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
import 'package:flutter/material.dart';
import 'package:stream_core_flutter/stream_core_flutter.dart';
import 'package:widgetbook_annotation/widgetbook_annotation.dart';

@UseCase(
name: 'All Icons',
type: StreamIcons,
path: '[App Foundation]/Primitives/Icons',
)
Widget buildStreamIconsShowcase(BuildContext context) {
return const IconsPage();
}

class IconsPage extends StatefulWidget {
const IconsPage({super.key});

@override
State<IconsPage> createState() => _IconsPageState();
}

class _IconsPageState extends State<IconsPage> {
final _searchController = TextEditingController();
var _searchQuery = '';

@override
void dispose() {
_searchController.dispose();
super.dispose();
}

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

final filteredIcons = streamIcons.allIcons.entries.where((entry) {
if (_searchQuery.isEmpty) return true;
return entry.key.toLowerCase().contains(_searchQuery.toLowerCase());
}).toList();

return SingleChildScrollView(
child: Column(
children: [
Padding(
padding: const EdgeInsets.all(16),
child: TextField(
controller: _searchController,
decoration: InputDecoration(
hintText: 'Search icons',
prefixIcon: const Icon(Icons.search),
suffixIcon: _searchQuery.isNotEmpty
? IconButton(
icon: const Icon(Icons.clear),
onPressed: () {
_searchController.clear();
setState(() => _searchQuery = '');
},
)
: null,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8),
),
),
onChanged: (value) => setState(() => _searchQuery = value),
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Text(
'${filteredIcons.length} icons',
style: Theme.of(context).textTheme.bodySmall,
),
),
const SizedBox(height: 8),
Wrap(
spacing: 16,
alignment: WrapAlignment.center,
children: filteredIcons
.map(
(entry) => Card(
child: Padding(
padding: const EdgeInsets.all(16),
child: Column(
children: [
SizedBox(width: 32, height: 32, child: Icon(entry.value)),
Text(entry.key),
],
),
),
),
)
.toList(),
),
],
),
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class _StreamBranding extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
children: [
// Stream Logo
const SvgIcon(StreamIcons.logo, size: 40),
const SvgIcon(StreamSvgIcons.logo, size: 40),
SizedBox(width: spacing.sm + spacing.xxs),
Column(
mainAxisAlignment: MainAxisAlignment.center,
Expand Down
15 changes: 15 additions & 0 deletions packages/stream_core_flutter/icon_font.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
icon_font:
input_svg_dir: "../../scripts/icons/sources/"
output_font_file: "lib/fonts/stream_icons_font.otf"

output_class_file: "lib/src/theme/stream_icons.g.dart"
class_name: "StreamIcons"
package: stream_core_flutter
format: true

font_name: "Stream Icons"
normalize: true
ignore_shapes: true

recursive: true
verbose: false
Binary file not shown.
3 changes: 3 additions & 0 deletions packages/stream_core_flutter/lib/src/theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@ export 'theme/semantics/stream_box_shadow.dart';
export 'theme/semantics/stream_color_scheme.dart';
export 'theme/semantics/stream_text_theme.dart';

export 'theme/stream_icon.dart';
export 'theme/stream_icons.g.dart';

export 'theme/stream_theme.dart';
export 'theme/stream_theme_extensions.dart';
Loading