Skip to content

Commit

Permalink
fix type story and add icon story
Browse files Browse the repository at this point in the history
  • Loading branch information
thelukewalton committed Feb 13, 2024
1 parent 4e14f7b commit 2643fbe
Show file tree
Hide file tree
Showing 14 changed files with 86 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ jobs:
- name: Build example app
run: |
cd example
flutter build web -o ../build --no-tree-shake-icons
flutter build web -t widgetbook/main.dart -o ../build --no-tree-shake-icons
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: "${{ secrets.GITHUB_TOKEN }}"
Expand Down
33 changes: 33 additions & 0 deletions example/widgetbook/pages/assets/icon_widgetbook.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import 'package:flutter/material.dart';
import 'package:widgetbook/widgetbook.dart';
import 'package:zeta_flutter/zeta_flutter.dart';

import '../../test/test_components.dart';

WidgetbookComponent iconWidgetbook() {
return WidgetbookComponent(
isInitiallyExpanded: false,
name: 'Icons',
useCases: [
WidgetbookUseCase(
name: 'All Icons',
builder: (context) {
List<IconData> icons = (context.knobs.boolean(label: 'Rounded', initialValue: true)
? [...iconsRounded]
: [...iconsSharp])
..sort((a, b) => a.codePoint < b.codePoint ? 1 : 0);
return WidgetbookTestWidget(
removeBody: true,
widget: SingleChildScrollView(
child: Wrap(
spacing: ZetaSpacing.b,
runSpacing: ZetaSpacing.b,
children: icons.map((e) => Icon(e, size: ZetaSpacing.x10)).toList(),
),
),
);
},
),
],
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import 'package:widgetbook/widgetbook.dart';
import 'package:zeta_flutter/zeta_flutter.dart';

import '../test/test_components.dart';
import '../../test/test_components.dart';

WidgetbookComponent accordionWidgetBook() {
return WidgetbookComponent(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import 'package:widgetbook/widgetbook.dart';
import 'package:zeta_flutter/zeta_flutter.dart';

import '../test/test_components.dart';
import '../../test/test_components.dart';

WidgetbookComponent avatarWidgetBook() {
return WidgetbookComponent(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import 'package:widgetbook/widgetbook.dart';
import 'package:zeta_flutter/zeta_flutter.dart';

import '../test/test_components.dart';
import '../../test/test_components.dart';

WidgetbookComponent badgeWidgetBook() {
return WidgetbookComponent(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import 'package:flutter/material.dart';
import 'package:widgetbook/widgetbook.dart';
import 'package:zeta_flutter/zeta_flutter.dart';

import '../test/test_components.dart';
import '../../test/test_components.dart';

WidgetbookComponent BannerWidgetBook() {
WidgetbookComponent bannerWidgetBook() {
return WidgetbookComponent(
isInitiallyExpanded: false,
name: 'Banners',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import 'package:widgetbook/widgetbook.dart';
import 'package:zeta_flutter/zeta_flutter.dart';

import '../test/test_components.dart';
import '../../test/test_components.dart';

WidgetbookComponent bottomSheetWidgetBook() {
return WidgetbookComponent(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import 'package:widgetbook/widgetbook.dart';
import 'package:zeta_flutter/zeta_flutter.dart';

import '../test/test_components.dart';
import '../../test/test_components.dart';

WidgetbookComponent buttonWidgetBook() {
return WidgetbookComponent(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import 'package:widgetbook/widgetbook.dart';
import 'package:zeta_flutter/zeta_flutter.dart';

import '../test/test_components.dart';
import '../../test/test_components.dart';

WidgetbookComponent checkboxWidgetBook() {
return WidgetbookComponent(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import 'package:widgetbook/widgetbook.dart';
import 'package:zeta_flutter/zeta_flutter.dart';

import '../test/test_components.dart';
import '../../test/test_components.dart';

WidgetbookComponent chipWidgetBook() {
return WidgetbookComponent(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import 'package:widgetbook/widgetbook.dart';
import 'package:zeta_flutter/zeta_flutter.dart';

import '../test/test_components.dart';
import '../../test/test_components.dart';

WidgetbookComponent passwordInputWidgetBook() {
return WidgetbookComponent(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ WidgetbookComponent textWidgetBook() {
name: 'Typography',
useCases: [
WidgetbookUseCase(
name: 'Text styles',
name: 'Individual text styles',
builder: (context) => Text(
context.knobs.string(label: 'Text', initialValue: 'The quick brown fox jumps over the lazy dog.'),
style: context.knobs
Expand All @@ -43,6 +43,29 @@ WidgetbookComponent textWidgetBook() {
),
),
),
WidgetbookUseCase(
name: 'All text styles',
builder: (context) => SingleChildScrollView(
scrollDirection: Axis.vertical,
child: Row(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: dedicatedSizes.keys.map(
(e) {
return Text(
e,
style: dedicatedSizes[e]?.apply(
color: Zeta.of(context).colors.textDefault,
fontStyle: FontStyle.normal,
decoration: TextDecoration.none,
),
).paddingAll(ZetaSpacing.b);
},
).toList()),
],
),
)),
],
);
}
30 changes: 18 additions & 12 deletions example/widgetbook/widgetbook.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@ import 'package:flutter/material.dart';
import 'package:widgetbook/widgetbook.dart';
import 'package:zeta_flutter/zeta_flutter.dart';

import 'components/accordion_widgetbook.dart';
import 'components/avatar_widgetbook.dart';
import 'components/badges_widgetbook.dart';
import 'components/bottom_sheet_widgetbook.dart';
import 'components/button_widgetbook.dart';
import 'components/checkbox_widgetbook.dart';
import 'theme/color_widgetbook.dart';
import 'components/banner_widgetbook.dart';
import 'components/chip_widgetbook.dart';
import 'components/password_input_widgetbook.dart';
import 'theme/typography_widgetbook.dart';
import 'pages/assets/icon_widgetbook.dart';
import 'pages/components/accordion_widgetbook.dart';
import 'pages/components/avatar_widgetbook.dart';
import 'pages/components/badges_widgetbook.dart';
import 'pages/components/bottom_sheet_widgetbook.dart';
import 'pages/components/button_widgetbook.dart';
import 'pages/components/checkbox_widgetbook.dart';
import 'pages/theme/color_widgetbook.dart';
import 'pages/components/banner_widgetbook.dart';
import 'pages/components/chip_widgetbook.dart';
import 'pages/components/password_input_widgetbook.dart';
import 'pages/theme/typography_widgetbook.dart';
import 'utils/zebra.dart';

class HotReload extends StatelessWidget {
Expand All @@ -31,7 +32,7 @@ class HotReload extends StatelessWidget {
avatarWidgetBook(),
checkboxWidgetBook(),
buttonWidgetBook(),
BannerWidgetBook(),
bannerWidgetBook(),
accordionWidgetBook(),
chipWidgetBook(),
passwordInputWidgetBook(),
Expand All @@ -43,6 +44,11 @@ class HotReload extends StatelessWidget {
isInitiallyExpanded: false,
children: [textWidgetBook(), colorWidgetBook()]..sort((a, b) => a.name.compareTo(b.name)),
),
WidgetbookCategory(
name: 'Assets',
isInitiallyExpanded: true,
children: [iconWidgetbook()]..sort((a, b) => a.name.compareTo(b.name)),
),
],
addons: [
DeviceFrameAddon(
Expand Down

0 comments on commit 2643fbe

Please sign in to comment.