Skip to content

Commit

Permalink
chore: Rename ZetaBanner to ZetaSystemBanner to match Figma (#235)
Browse files Browse the repository at this point in the history
fix: remove capitals from issue_tracker url due to issue on pub.dev
fix: Move Zebra head logo into library
fix: Make ZetaAvatar._pixelSize extension private
fix: Badge, button colors updated
fix: Tag, chat item, list item  now shrink rather than expands by default
fix: Date and time inputs pass zeta context into their children
feat: Make ZetaDialog public
fix: Changed progress bar, notification list item shapes so they are not affected by contrast
test: Update in page banner tests as banner no longer fully expands
  • Loading branch information
thelukewalton authored Jan 10, 2025
1 parent dd28e28 commit 74fee17
Show file tree
Hide file tree
Showing 43 changed files with 640 additions and 541 deletions.
1 change: 1 addition & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# include: package:zds_analysis/analysis_options_lib_all_files.yaml
include: package:zds_analysis/analysis_options_lib.yaml
2 changes: 1 addition & 1 deletion example/lib/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:zeta_example/pages/components/accordion_example.dart';
import 'package:zeta_example/pages/components/avatar_rail_example.dart';
import 'package:zeta_example/pages/components/avatar_example.dart';
import 'package:zeta_example/pages/components/badges_example.dart';
import 'package:zeta_example/pages/components/banner_example.dart';
import 'package:zeta_example/pages/components/system_banner_example.dart';
import 'package:zeta_example/pages/components/bottom_sheet_example.dart';
import 'package:zeta_example/pages/components/breadcrumb_example.dart';
import 'package:zeta_example/pages/components/button_example.dart';
Expand Down
2 changes: 1 addition & 1 deletion example/lib/pages/assets/icons_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class _IconsExampleState extends State<IconsExample> {
onTap: () async {
await Clipboard.setData(ClipboardData(text: 'ZetaIcons.' + e.key));
ScaffoldMessenger.of(context).showMaterialBanner(
ZetaBanner(context: context, title: 'Icon name copied'),
ZetaSystemBanner(context: context, title: 'Icon name copied'),
);
await Future.delayed(Duration(seconds: 4));
ScaffoldMessenger.of(context).clearMaterialBanners();
Expand Down
48 changes: 24 additions & 24 deletions example/lib/pages/components/banner_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,45 +19,45 @@ class BannerExample extends StatelessWidget {
children: [
Text('System Banner', style: ZetaTextStyles.displayMedium),
_getTitle('Style variants'),
ZetaBanner(
type: ZetaBannerStatus.primary,
ZetaSystemBanner(
type: ZetaSystemBannerStatus.primary,
title: 'Centered',
context: context,
titleCenter: true,
leadingIcon: ZetaIcons.info,
),
ZetaBanner(
type: ZetaBannerStatus.primary,
ZetaSystemBanner(
type: ZetaSystemBannerStatus.primary,
context: context,
title: 'Title Left',
),
ZetaBanner(
type: ZetaBannerStatus.primary,
ZetaSystemBanner(
type: ZetaSystemBannerStatus.primary,
context: context,
title: 'Title left with arrow',
titleCenter: true,
trailing: ZetaIcon(ZetaIcons.chevron_right),
),
ZetaBanner(
type: ZetaBannerStatus.primary,
ZetaSystemBanner(
type: ZetaSystemBannerStatus.primary,
title: 'Title left + Icon',
titleCenter: true,
context: context,
leadingIcon: ZetaIcons.info,
),
ZetaBanner(
type: ZetaBannerStatus.primary,
ZetaSystemBanner(
type: ZetaSystemBannerStatus.primary,
context: context,
title: 'Title left + Icon with Arrow',
titleCenter: true,
leadingIcon: ZetaIcons.info,
trailing: IconButton(
icon: ZetaIcon(ZetaIcons.chevron_right),
onPressed: () {
ScaffoldMessenger.of(context).showMaterialBanner(ZetaBanner(
ScaffoldMessenger.of(context).showMaterialBanner(ZetaSystemBanner(
title: 'Title',
context: context,
type: ZetaBannerStatus.primary,
type: ZetaSystemBannerStatus.primary,
trailing: IconButton(
icon: ZetaIcon(ZetaIcons.close),
onPressed: () => ScaffoldMessenger.of(context).clearMaterialBanners(),
Expand All @@ -67,19 +67,19 @@ class BannerExample extends StatelessWidget {
),
),
_getTitle('Color variants'),
ZetaBanner(
type: ZetaBannerStatus.positive,
ZetaSystemBanner(
type: ZetaSystemBannerStatus.positive,
context: context,
title: 'Centered',
titleCenter: true,
leadingIcon: ZetaIcons.info,
trailing: IconButton(
icon: ZetaIcon(ZetaIcons.chevron_right),
onPressed: () {
ScaffoldMessenger.of(context).showMaterialBanner(ZetaBanner(
ScaffoldMessenger.of(context).showMaterialBanner(ZetaSystemBanner(
title: 'Title',
context: context,
type: ZetaBannerStatus.positive,
type: ZetaSystemBannerStatus.positive,
trailing: IconButton(
icon: ZetaIcon(ZetaIcons.close),
onPressed: () => ScaffoldMessenger.of(context).clearMaterialBanners(),
Expand All @@ -88,19 +88,19 @@ class BannerExample extends StatelessWidget {
},
),
),
ZetaBanner(
type: ZetaBannerStatus.warning,
ZetaSystemBanner(
type: ZetaSystemBannerStatus.warning,
title: 'Centered',
context: context,
titleCenter: true,
leadingIcon: ZetaIcons.info,
trailing: IconButton(
icon: ZetaIcon(ZetaIcons.chevron_right),
onPressed: () {
ScaffoldMessenger.of(context).showMaterialBanner(ZetaBanner(
ScaffoldMessenger.of(context).showMaterialBanner(ZetaSystemBanner(
title: 'Title',
context: context,
type: ZetaBannerStatus.warning,
type: ZetaSystemBannerStatus.warning,
trailing: IconButton(
icon: ZetaIcon(ZetaIcons.close),
onPressed: () => ScaffoldMessenger.of(context).clearMaterialBanners(),
Expand All @@ -109,19 +109,19 @@ class BannerExample extends StatelessWidget {
},
),
),
ZetaBanner(
type: ZetaBannerStatus.negative,
ZetaSystemBanner(
type: ZetaSystemBannerStatus.negative,
title: 'Centered',
context: context,
titleCenter: true,
leadingIcon: ZetaIcons.info,
trailing: IconButton(
icon: ZetaIcon(ZetaIcons.chevron_right),
onPressed: () {
ScaffoldMessenger.of(context).showMaterialBanner(ZetaBanner(
ScaffoldMessenger.of(context).showMaterialBanner(ZetaSystemBanner(
title: 'Title',
context: context,
type: ZetaBannerStatus.negative,
type: ZetaSystemBannerStatus.negative,
trailing: IconButton(
icon: ZetaIcon(ZetaIcons.close),
onPressed: () => ScaffoldMessenger.of(context).clearMaterialBanners(),
Expand Down
194 changes: 194 additions & 0 deletions example/lib/pages/components/system_banner_example.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
import 'package:flutter/material.dart';
import 'package:zeta_example/widgets.dart';
import 'package:zeta_flutter/zeta_flutter.dart';

class BannerExample extends StatelessWidget {
static const String name = 'Banner';

const BannerExample({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
return ExampleScaffold(
name: BannerExample.name,
child: SingleChildScrollView(
child: Padding(
padding: EdgeInsets.all(20),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('System Banner', style: ZetaTextStyles.displayMedium),
_getTitle('Style variants'),
ZetaSystemBanner(
type: ZetaSystemBannerStatus.primary,
title: 'Centered',
context: context,
titleCenter: true,
leadingIcon: ZetaIcons.info,
),
ZetaSystemBanner(
type: ZetaSystemBannerStatus.primary,
context: context,
title: 'Title Left',
),
ZetaSystemBanner(
type: ZetaSystemBannerStatus.primary,
context: context,
title: 'Title left with arrow',
titleCenter: true,
trailing: ZetaIcon(ZetaIcons.chevron_right),
),
ZetaSystemBanner(
type: ZetaSystemBannerStatus.primary,
title: 'Title left + Icon',
titleCenter: true,
context: context,
leadingIcon: ZetaIcons.info,
),
ZetaSystemBanner(
type: ZetaSystemBannerStatus.primary,
context: context,
title: 'Title left + Icon with Arrow',
titleCenter: true,
leadingIcon: ZetaIcons.info,
trailing: IconButton(
icon: ZetaIcon(ZetaIcons.chevron_right),
onPressed: () {
ScaffoldMessenger.of(context).showMaterialBanner(ZetaSystemBanner(
title: 'Title',
context: context,
type: ZetaSystemBannerStatus.primary,
trailing: IconButton(
icon: ZetaIcon(ZetaIcons.close),
onPressed: () => ScaffoldMessenger.of(context).clearMaterialBanners(),
),
));
},
),
),
_getTitle('Color variants'),
ZetaSystemBanner(
type: ZetaSystemBannerStatus.positive,
context: context,
title: 'Centered',
titleCenter: true,
leadingIcon: ZetaIcons.info,
trailing: IconButton(
icon: ZetaIcon(ZetaIcons.chevron_right),
onPressed: () {
ScaffoldMessenger.of(context).showMaterialBanner(ZetaSystemBanner(
title: 'Title',
context: context,
type: ZetaSystemBannerStatus.positive,
trailing: IconButton(
icon: ZetaIcon(ZetaIcons.close),
onPressed: () => ScaffoldMessenger.of(context).clearMaterialBanners(),
),
));
},
),
),
ZetaSystemBanner(
type: ZetaSystemBannerStatus.warning,
title: 'Centered',
context: context,
titleCenter: true,
leadingIcon: ZetaIcons.info,
trailing: IconButton(
icon: ZetaIcon(ZetaIcons.chevron_right),
onPressed: () {
ScaffoldMessenger.of(context).showMaterialBanner(ZetaSystemBanner(
title: 'Title',
context: context,
type: ZetaSystemBannerStatus.warning,
trailing: IconButton(
icon: ZetaIcon(ZetaIcons.close),
onPressed: () => ScaffoldMessenger.of(context).clearMaterialBanners(),
),
));
},
),
),
ZetaSystemBanner(
type: ZetaSystemBannerStatus.negative,
title: 'Centered',
context: context,
titleCenter: true,
leadingIcon: ZetaIcons.info,
trailing: IconButton(
icon: ZetaIcon(ZetaIcons.chevron_right),
onPressed: () {
ScaffoldMessenger.of(context).showMaterialBanner(ZetaSystemBanner(
title: 'Title',
context: context,
type: ZetaSystemBannerStatus.negative,
trailing: IconButton(
icon: ZetaIcon(ZetaIcons.close),
onPressed: () => ScaffoldMessenger.of(context).clearMaterialBanners(),
),
));
},
),
),
const Divider(),
Text('In-Page Banner', style: ZetaTextStyles.displayMedium),
ZetaInPageBanner(
content: Text(_content),
status: ZetaWidgetStatus.info,
),
ZetaInPageBanner(
content: Text(_content),
onClose: () {},
status: ZetaWidgetStatus.positive,
title: 'Banner Title',
),
ZetaInPageBanner(
content: Text(_content),
onClose: () {},
status: ZetaWidgetStatus.warning,
title: 'Banner Title',
actions: [ZetaButton(label: 'Button', onPressed: () {})],
),
ZetaInPageBanner(
content: Text(_content),
onClose: () {},
status: ZetaWidgetStatus.negative,
title: 'Banner Title Banner Title Banner Title Banner Title',
),
ZetaInPageBanner(
content: Text(_content),
onClose: () {},
status: ZetaWidgetStatus.neutral,
title: 'Banner Title',
)
].divide(const SizedBox(height: 10)).toList(),
),
),
),
);
}

final _content = 'Lorem ipsum dolor sit amet, conse ctetur cididunt ut'
'labore et do lore magna aliqua.';

Widget _getTitle(String title) => Container(height: 50, child: Center(child: Text(title)));

Column buildExampleBannerColumn(
ZetaWidgetStatus status, {
IconData? customIcon,
}) {
return Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
mainAxisSize: MainAxisSize.min,
children: [
ZetaInPageBanner(
content: Text(_content),
onClose: () {},
status: status,
title: 'Banner Title',
customIcon: customIcon,
),
],
);
}
}
2 changes: 1 addition & 1 deletion example/macos/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 353c8bcc5d5b0994e508d035b5431cfe18c1dea7

COCOAPODS: 1.15.2
COCOAPODS: 1.16.2
2 changes: 1 addition & 1 deletion example/widgetbook/pages/assets/icon_widgetbook.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Widget iconsUseCase(BuildContext context) {
onTap: () async {
await Clipboard.setData(ClipboardData(text: 'ZetaIcons.' + e.key));
ScaffoldMessenger.of(context).showMaterialBanner(
ZetaBanner(context: context, title: 'Icon name copied'),
ZetaSystemBanner(context: context, title: 'Icon name copied'),
);
await Future.delayed(Duration(seconds: 4));
ScaffoldMessenger.of(context).clearMaterialBanners();
Expand Down
4 changes: 2 additions & 2 deletions example/widgetbook/pages/components/banner_widgetbook.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import '../../utils/scaffold.dart';
import '../../utils/utils.dart';

Widget bannerUseCase(BuildContext context) {
final banner = ZetaBanner(
final banner = ZetaSystemBanner(
context: context,
title: context.knobs.string(label: 'Title', initialValue: 'Banner Title'),
type: context.knobs.list(
label: 'Type',
options: ZetaBannerStatus.values,
options: ZetaSystemBannerStatus.values,
labelBuilder: enumLabelBuilder,
),
leadingIcon: iconKnob(context, nullable: true),
Expand Down
File renamed without changes
Loading

0 comments on commit 74fee17

Please sign in to comment.