Skip to content

Commit

Permalink
refactor: Implement global rounded in example app
Browse files Browse the repository at this point in the history
  • Loading branch information
thelukewalton committed Jul 2, 2024
1 parent 3cf4719 commit b5b61bb
Show file tree
Hide file tree
Showing 56 changed files with 238 additions and 484 deletions.
17 changes: 4 additions & 13 deletions example/lib/pages/assets/icons_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class IconsExample extends StatefulWidget {
class _IconsExampleState extends State<IconsExample> {
bool showGeneratedColors = false;

//TODO: LUKE ADD NAMES TO ICONS
@override
Widget build(BuildContext context) {
return ExampleScaffold(
Expand All @@ -23,22 +24,12 @@ class _IconsExampleState extends State<IconsExample> {
padding: EdgeInsets.all(ZetaSpacing.medium),
child: Column(
children: [
Text('Round', style: ZetaTextStyles.bodyLarge),
Wrap(
spacing: 8,
runSpacing: 8,
children: icons.values.map((e) => Icon(e)).toList(),
spacing: 20,
runSpacing: 20,
children: icons.values.map((e) => ZetaIcon(e, size: 48)).toList(),
),
const SizedBox(height: 20),
Text('Sharp', style: ZetaTextStyles.bodyLarge),
Wrap(
spacing: 8,
runSpacing: 8,
children: icons.values
.map((e) =>
Icon(IconData(e.codePoint, fontFamily: ZetaIcons.familySharp, fontPackage: ZetaIcons.package)))
.toList(),
),
],
),
),
Expand Down
42 changes: 2 additions & 40 deletions example/lib/pages/components/accordion_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class AccordionExample extends StatelessWidget {
padding: EdgeInsets.all(ZetaSpacing.medium),
child: Column(
children: [
Text('Rounded Divider'),
Text('Divider'),
const SizedBox(height: 20),
ZetaAccordion(
title: 'title',
Expand All @@ -29,7 +29,7 @@ class AccordionExample extends StatelessWidget {
),
ZetaAccordion(title: 'title'),
const SizedBox(height: 40),
Text('Rounded Contained'),
Text('Contained'),
const SizedBox(height: 20),
ZetaAccordion(
contained: true,
Expand All @@ -47,44 +47,6 @@ class AccordionExample extends StatelessWidget {
title: 'title',
),
const SizedBox(height: 40),
Text('Sharp Divider'),
const SizedBox(height: 20),
ZetaAccordion(
contained: false,
title: 'title',
rounded: false,
child: Column(
children: [
ListTile(title: Text('List Item')),
ListTile(title: Text('List Item')),
ListTile(title: Text('List Item')),
],
),
),
ZetaAccordion(
contained: false,
title: 'title',
rounded: false,
),
Text('Sharp Contained'),
const SizedBox(height: 20),
ZetaAccordion(
contained: true,
title: 'title',
rounded: false,
child: Column(
children: [
ListTile(title: Text('List Item')),
ListTile(title: Text('List Item')),
ListTile(title: Text('List Item')),
],
),
),
ZetaAccordion(
contained: true,
title: 'title',
rounded: false,
),
].divide(const SizedBox.square(dimension: 10)).toList(),
),
),
Expand Down
4 changes: 2 additions & 2 deletions example/lib/pages/components/avatar_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ class AvatarExample extends StatelessWidget {
Widget build(BuildContext context) {
final Widget image = CachedNetworkImage(
imageUrl: "https://i.ytimg.com/vi/KItsWUzFUOs/maxresdefault.jpg",
placeholder: (context, url) => Icon(ZetaIcons.user_round),
errorWidget: (context, url, error) => Icon(Icons.error),
placeholder: (context, url) => ZetaIcon(ZetaIcons.user),
errorWidget: (context, url, error) => ZetaIcon(ZetaIcons.error),
fit: BoxFit.cover,
);

Expand Down
28 changes: 6 additions & 22 deletions example/lib/pages/components/badges_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ class BadgesExample extends StatelessWidget {
_DividingText('Status Label'),
_StatusLabel(),
_DividingText('Priority Pill'),
_PriorityPill(),
_PriorityPill(ZetaPriorityPillSize.large),
const SizedBox(height: ZetaSpacing.xl_4),
_PriorityPill(size: ZetaPriorityPillSize.small),
_PriorityPill(ZetaPriorityPillSize.small),
_DividingText('Badge'),
_Badge(),
_DividingText('Indicators'),
Expand Down Expand Up @@ -57,9 +57,7 @@ class _StatusLabel extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
ZetaStatusLabel(label: 'Label', status: type),
ZetaStatusLabel(label: 'Label', status: type, customIcon: ZetaIcons.star_round),
ZetaStatusLabel(label: 'Label', status: type, rounded: false),
ZetaStatusLabel(label: 'Label', status: type, rounded: false, customIcon: ZetaIcons.star_sharp),
ZetaStatusLabel(label: 'Label', status: type, customIcon: ZetaIcons.star),
],
);
}
Expand All @@ -79,9 +77,7 @@ class _StatusLabel extends StatelessWidget {
}

class _PriorityPill extends StatelessWidget {
const _PriorityPill({
this.size = ZetaPriorityPillSize.large,
});
const _PriorityPill(this.size);

final ZetaPriorityPillSize size;

Expand All @@ -108,15 +104,6 @@ class _PriorityPill extends StatelessWidget {
ZetaPriorityPill(size: size, type: ZetaPriorityPillType.low),
].divide(const SizedBox.square(dimension: ZetaSpacing.xl_2)).toList(),
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ZetaPriorityPill(size: size, rounded: false),
ZetaPriorityPill(size: size, rounded: false, type: ZetaPriorityPillType.high),
ZetaPriorityPill(size: size, rounded: false, type: ZetaPriorityPillType.medium),
ZetaPriorityPill(size: size, rounded: false, type: ZetaPriorityPillType.low),
].divide(const SizedBox.square(dimension: ZetaSpacing.xl_2)).toList(),
),
],
);
}
Expand All @@ -131,7 +118,6 @@ class _Badge extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
ZetaLabel(label: 'Label', status: type),
ZetaLabel(label: 'Label', status: type, rounded: false),
],
);
}
Expand Down Expand Up @@ -243,10 +229,8 @@ class _Tags extends StatelessWidget {
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
ZetaTag.left(label: 'Sharp', rounded: false),
ZetaTag.right(label: 'Sharp', rounded: false),
ZetaTag.left(label: 'Rounded'),
ZetaTag.right(label: 'Rounded'),
ZetaTag.left(label: 'Left'),
ZetaTag.right(label: 'Right'),
].divide(SizedBox.square(dimension: ZetaSpacing.xl_2)).toList(),
),
);
Expand Down
34 changes: 15 additions & 19 deletions example/lib/pages/components/banner_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class BannerExample extends StatelessWidget {
title: 'Centered',
context: context,
titleStart: true,
leadingIcon: ZetaIcons.info_round,
leadingIcon: ZetaIcons.info,
),
ZetaBanner(
type: ZetaBannerStatus.primary,
Expand All @@ -36,30 +36,30 @@ class BannerExample extends StatelessWidget {
context: context,
title: 'Title left with arrow',
titleStart: true,
trailing: Icon(ZetaIcons.chevron_right_round),
trailing: ZetaIcon(ZetaIcons.chevron_right),
),
ZetaBanner(
type: ZetaBannerStatus.primary,
title: 'Title left + Icon',
titleStart: true,
context: context,
leadingIcon: ZetaIcons.info_round,
leadingIcon: ZetaIcons.info,
),
ZetaBanner(
type: ZetaBannerStatus.primary,
context: context,
title: 'Title left + Icon with Arrow',
titleStart: true,
leadingIcon: ZetaIcons.info_round,
leadingIcon: ZetaIcons.info,
trailing: IconButton(
icon: Icon(ZetaIcons.chevron_right_round),
icon: ZetaIcon(ZetaIcons.chevron_right),
onPressed: () {
ScaffoldMessenger.of(context).showMaterialBanner(ZetaBanner(
title: 'Title',
context: context,
type: ZetaBannerStatus.primary,
trailing: IconButton(
icon: Icon(ZetaIcons.close_round),
icon: ZetaIcon(ZetaIcons.close),
onPressed: () => ScaffoldMessenger.of(context).clearMaterialBanners(),
),
));
Expand All @@ -72,16 +72,16 @@ class BannerExample extends StatelessWidget {
context: context,
title: 'Centered',
titleStart: true,
leadingIcon: ZetaIcons.info_round,
leadingIcon: ZetaIcons.info,
trailing: IconButton(
icon: Icon(ZetaIcons.chevron_right_round),
icon: ZetaIcon(ZetaIcons.chevron_right),
onPressed: () {
ScaffoldMessenger.of(context).showMaterialBanner(ZetaBanner(
title: 'Title',
context: context,
type: ZetaBannerStatus.positive,
trailing: IconButton(
icon: Icon(ZetaIcons.close_round),
icon: ZetaIcon(ZetaIcons.close),
onPressed: () => ScaffoldMessenger.of(context).clearMaterialBanners(),
),
));
Expand All @@ -93,16 +93,16 @@ class BannerExample extends StatelessWidget {
title: 'Centered',
context: context,
titleStart: true,
leadingIcon: ZetaIcons.info_round,
leadingIcon: ZetaIcons.info,
trailing: IconButton(
icon: Icon(ZetaIcons.chevron_right_round),
icon: ZetaIcon(ZetaIcons.chevron_right),
onPressed: () {
ScaffoldMessenger.of(context).showMaterialBanner(ZetaBanner(
title: 'Title',
context: context,
type: ZetaBannerStatus.warning,
trailing: IconButton(
icon: Icon(ZetaIcons.close_round),
icon: ZetaIcon(ZetaIcons.close),
onPressed: () => ScaffoldMessenger.of(context).clearMaterialBanners(),
),
));
Expand All @@ -114,16 +114,16 @@ class BannerExample extends StatelessWidget {
title: 'Centered',
context: context,
titleStart: true,
leadingIcon: ZetaIcons.info_round,
leadingIcon: ZetaIcons.info,
trailing: IconButton(
icon: Icon(ZetaIcons.chevron_right_round),
icon: ZetaIcon(ZetaIcons.chevron_right),
onPressed: () {
ScaffoldMessenger.of(context).showMaterialBanner(ZetaBanner(
title: 'Title',
context: context,
type: ZetaBannerStatus.negative,
trailing: IconButton(
icon: Icon(ZetaIcons.close_round),
icon: ZetaIcon(ZetaIcons.close),
onPressed: () => ScaffoldMessenger.of(context).clearMaterialBanners(),
),
));
Expand All @@ -141,7 +141,6 @@ class BannerExample extends StatelessWidget {
onClose: () {},
status: ZetaWidgetStatus.positive,
title: 'Banner Title',
rounded: false,
),
ZetaInPageBanner(
content: Text(_content),
Expand All @@ -155,7 +154,6 @@ class BannerExample extends StatelessWidget {
onClose: () {},
status: ZetaWidgetStatus.negative,
title: 'Banner Title Banner Title Banner Title Banner Title',
rounded: false,
),
ZetaInPageBanner(
content: Text(_content),
Expand All @@ -177,7 +175,6 @@ class BannerExample extends StatelessWidget {

Column buildExampleBannerColumn(
ZetaWidgetStatus status, {
bool rounded = true,
IconData? customIcon,
}) {
return Column(
Expand All @@ -187,7 +184,6 @@ class BannerExample extends StatelessWidget {
ZetaInPageBanner(
content: Text(_content),
onClose: () {},
rounded: rounded,
status: status,
title: 'Banner Title',
customIcon: customIcon,
Expand Down
4 changes: 2 additions & 2 deletions example/lib/pages/components/bottom_sheet_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class _BottomSheetExampleState extends State<BottomSheetExample> {
6,
(index) => ZetaMenuItem.vertical(
label: Text('Menu Item'),
icon: Icon(ZetaIcons.star_round),
icon: ZetaIcon(ZetaIcons.star),
onTap: () {},
),
),
Expand All @@ -63,7 +63,7 @@ class _BottomSheetExampleState extends State<BottomSheetExample> {
(index) => ZetaMenuItem.horizontal(
label: Text('Menu Item'),
onTap: () {},
leading: Icon(ZetaIcons.star_round),
leading: ZetaIcon(ZetaIcons.star),
),
),
),
Expand Down
Loading

0 comments on commit b5b61bb

Please sign in to comment.