Skip to content

Commit 7db8973

Browse files
thelukewaltongithub-actions
andauthored
feat(UX-1344): Change use of ZetaIcon to allow tree shaking (#300)
The ZetaIcon widget prevents tree shaking on app builds due to how it processes icons. I have removed usees of the widget as it can be easily replaced within the components library, but I have kept the widget in tact if end users still want to use it. docs: Add widgetbook page for bottom sheet docs: Update Widgetbook links docs: Add links to readmes deps: Update FVM to latest 3.29.2 feat: Allow components to be used without ZetaProvider or setting up Zeta manually --------- Co-authored-by: github-actions <[email protected]>
1 parent fdea3ce commit 7db8973

File tree

120 files changed

+1062
-846
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+1062
-846
lines changed

.fvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"flutter": "3.29.0"
2+
"flutter": "3.29.2"
33
}

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ This repo contains the source code for all Zeta Flutter packages.
1313
| [zeta_flutter_utils](https://github.com/ZebraDevs/zeta_flutter/tree/develop/packages/zeta_flutter_utils) | [pub.dev](https://pub.dev/packages/zeta_flutter_utils) |
1414
| [zeta_flutter_icons](https://github.com/ZebraDevs/zeta_flutter/tree/develop/packages/zeta_icons) | [pub.dev](https://pub.dev/packages/zeta_icons) |
1515

16+
## Contributing
17+
18+
We welcome contributions in this repo; please see our contribution guidelines (see [CONTRIBUTING](./CONTRIBUTING.md) or [design.zebra.com](https://design.zebra.com/docs/Development/contributing))
19+
1620
## Licensing
1721

1822
This software is licensed with the MIT license (see [LICENSE](./LICENSE) and [THIRD PARTY LICENSES](./LICENSE-3RD-PARTY)).

devtools_options.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
description: This file stores settings for Dart & Flutter DevTools.
2+
documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states
3+
extensions:

example/lib/home.dart

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -189,18 +189,17 @@ class ExampleListTile extends StatelessWidget {
189189

190190
@override
191191
Widget build(BuildContext context) {
192-
return ExpansionTile(
193-
title: Text(name),
194-
children: children
195-
.map(
196-
(item) => ListTile(
197-
title: Text(item.name),
198-
onTap: () => context.go('/${item.name}'),
199-
hoverColor: Zeta.of(context).colors.surfaceHover,
200-
tileColor: Zeta.of(context).colors.surfaceDefault,
201-
),
202-
)
203-
.toList(),
192+
return ZetaAccordion(
193+
title: name,
194+
child: Column(
195+
children: children
196+
.map(
197+
(item) => ZetaListItem(
198+
title: Text(item.name),
199+
onTap: () => context.go('/${item.name}'),
200+
),
201+
)
202+
.toList()),
204203
);
205204
}
206205
}

example/lib/pages/assets/icons_example.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class _IconsExampleState extends State<IconsExample> {
5252
child: Column(
5353
mainAxisAlignment: MainAxisAlignment.center,
5454
children: [
55-
ZetaIcon(
55+
Icon(
5656
IconData(
5757
e.value.codePoint,
5858
fontFamily: context.rounded ? ZetaIcons.familyRound : ZetaIcons.familySharp,

example/lib/pages/components/avatar_example.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ class AvatarExample extends StatelessWidget {
1212
Widget build(BuildContext context) {
1313
final Widget image = CachedNetworkImage(
1414
imageUrl: "https://i.ytimg.com/vi/KItsWUzFUOs/maxresdefault.jpg",
15-
placeholder: (context, url) => ZetaIcon(ZetaIcons.user),
16-
errorWidget: (context, url, error) => ZetaIcon(ZetaIcons.error),
15+
placeholder: (context, url) => Icon(ZetaIcons.user),
16+
errorWidget: (context, url, error) => Icon(ZetaIcons.error),
1717
fit: BoxFit.cover,
1818
);
1919

example/lib/pages/components/banner_example.dart

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class BannerExample extends StatelessWidget {
3636
context: context,
3737
title: 'Title left with arrow',
3838
titleCenter: true,
39-
trailing: ZetaIcon(ZetaIcons.chevron_right),
39+
trailing: Icon(ZetaIcons.chevron_right),
4040
),
4141
ZetaSystemBanner(
4242
type: ZetaSystemBannerStatus.primary,
@@ -52,14 +52,14 @@ class BannerExample extends StatelessWidget {
5252
titleCenter: true,
5353
leadingIcon: ZetaIcons.info,
5454
trailing: IconButton(
55-
icon: ZetaIcon(ZetaIcons.chevron_right),
55+
icon: Icon(ZetaIcons.chevron_right),
5656
onPressed: () {
5757
ScaffoldMessenger.of(context).showMaterialBanner(ZetaSystemBanner(
5858
title: 'Title',
5959
context: context,
6060
type: ZetaSystemBannerStatus.primary,
6161
trailing: IconButton(
62-
icon: ZetaIcon(ZetaIcons.close),
62+
icon: Icon(ZetaIcons.close),
6363
onPressed: () => ScaffoldMessenger.of(context).clearMaterialBanners(),
6464
),
6565
));
@@ -74,14 +74,14 @@ class BannerExample extends StatelessWidget {
7474
titleCenter: true,
7575
leadingIcon: ZetaIcons.info,
7676
trailing: IconButton(
77-
icon: ZetaIcon(ZetaIcons.chevron_right),
77+
icon: Icon(ZetaIcons.chevron_right),
7878
onPressed: () {
7979
ScaffoldMessenger.of(context).showMaterialBanner(ZetaSystemBanner(
8080
title: 'Title',
8181
context: context,
8282
type: ZetaSystemBannerStatus.positive,
8383
trailing: IconButton(
84-
icon: ZetaIcon(ZetaIcons.close),
84+
icon: Icon(ZetaIcons.close),
8585
onPressed: () => ScaffoldMessenger.of(context).clearMaterialBanners(),
8686
),
8787
));
@@ -95,14 +95,14 @@ class BannerExample extends StatelessWidget {
9595
titleCenter: true,
9696
leadingIcon: ZetaIcons.info,
9797
trailing: IconButton(
98-
icon: ZetaIcon(ZetaIcons.chevron_right),
98+
icon: Icon(ZetaIcons.chevron_right),
9999
onPressed: () {
100100
ScaffoldMessenger.of(context).showMaterialBanner(ZetaSystemBanner(
101101
title: 'Title',
102102
context: context,
103103
type: ZetaSystemBannerStatus.warning,
104104
trailing: IconButton(
105-
icon: ZetaIcon(ZetaIcons.close),
105+
icon: Icon(ZetaIcons.close),
106106
onPressed: () => ScaffoldMessenger.of(context).clearMaterialBanners(),
107107
),
108108
));
@@ -116,14 +116,14 @@ class BannerExample extends StatelessWidget {
116116
titleCenter: true,
117117
leadingIcon: ZetaIcons.info,
118118
trailing: IconButton(
119-
icon: ZetaIcon(ZetaIcons.chevron_right),
119+
icon: Icon(ZetaIcons.chevron_right),
120120
onPressed: () {
121121
ScaffoldMessenger.of(context).showMaterialBanner(ZetaSystemBanner(
122122
title: 'Title',
123123
context: context,
124124
type: ZetaSystemBannerStatus.negative,
125125
trailing: IconButton(
126-
icon: ZetaIcon(ZetaIcons.close),
126+
icon: Icon(ZetaIcons.close),
127127
onPressed: () => ScaffoldMessenger.of(context).clearMaterialBanners(),
128128
),
129129
));

example/lib/pages/components/bottom_sheet_example.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class _BottomSheetExampleState extends State<BottomSheetExample> {
3838
6,
3939
(index) => ZetaMenuItem.vertical(
4040
label: Text('Menu Item'),
41-
icon: ZetaIcon(ZetaIcons.star),
41+
icon: Icon(ZetaIcons.star),
4242
onTap: () {},
4343
),
4444
),
@@ -63,7 +63,7 @@ class _BottomSheetExampleState extends State<BottomSheetExample> {
6363
(index) => ZetaMenuItem.horizontal(
6464
label: Text('Menu Item'),
6565
onTap: () {},
66-
leading: ZetaIcon(ZetaIcons.star),
66+
leading: Icon(ZetaIcons.star),
6767
),
6868
),
6969
),

example/lib/pages/components/button_example.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ class _ButtonExampleState extends State<ButtonExample> {
225225
items: [
226226
ZetaDropdownItem(
227227
value: 'Item 1',
228-
icon: ZetaIcon(ZetaIcons.star_half),
228+
icon: Icon(ZetaIcons.star_half),
229229
),
230230
ZetaDropdownItem(value: 'Item 2'),
231231
],

example/lib/pages/components/chip_example.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class _ChipExampleState extends State<ChipExample> {
2323
const SizedBox(height: 10),
2424
ZetaInputChip(
2525
label: 'Label',
26-
leading: ZetaIcon(ZetaIcons.user),
26+
leading: Icon(ZetaIcons.user),
2727
trailing: IconButton(icon: Icon(ZetaIcons.close), onPressed: () {}),
2828
onTap: () {},
2929
),
@@ -40,7 +40,7 @@ class _ChipExampleState extends State<ChipExample> {
4040
height: 40,
4141
child: ZetaAssistChip(
4242
label: 'Label',
43-
leading: ZetaIcon(ZetaIcons.star),
43+
leading: Icon(ZetaIcons.star),
4444
draggable: true,
4545
data: 'Assist chip',
4646
onTap: () {},

0 commit comments

Comments
 (0)