-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
10 changed files
with
388 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
example/lib/pages/components/notification_list_example.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:zeta_example/widgets.dart'; | ||
import 'package:zeta_flutter/zeta_flutter.dart'; | ||
|
||
class NotificationListItemExample extends StatefulWidget { | ||
static const String name = 'NotificationListItem'; | ||
|
||
const NotificationListItemExample({super.key}); | ||
|
||
@override | ||
State<NotificationListItemExample> createState() => _NotificationListItemExampleState(); | ||
} | ||
|
||
class _NotificationListItemExampleState extends State<NotificationListItemExample> { | ||
@override | ||
Widget build(BuildContext context) { | ||
return ExampleScaffold( | ||
name: "NotificationListItem", | ||
child: SingleChildScrollView( | ||
child: Column( | ||
children: [ | ||
Padding( | ||
padding: const EdgeInsets.symmetric(horizontal: 400), | ||
child: ZetaNotificationListItem( | ||
body: Text( | ||
"New urgent" * 300, | ||
maxLines: 2, | ||
overflow: TextOverflow.ellipsis, | ||
), | ||
title: 'Urgent Message', | ||
leading: ZetaNotificationBadge.icon(icon: ZetaIcons.check_circle_round), | ||
notificationTime: "Just now", | ||
action: ZetaButton.negative( | ||
label: "Remove", | ||
onPressed: () {}, | ||
), | ||
), | ||
), | ||
Padding( | ||
padding: const EdgeInsets.symmetric(horizontal: 200), | ||
child: ZetaNotificationListItem( | ||
body: Column( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: [ | ||
Text( | ||
"New urgent" * 300, | ||
maxLines: 2, | ||
overflow: TextOverflow.ellipsis, | ||
), | ||
ZetaButton.text(label: "label") | ||
], | ||
), | ||
title: 'Urgent Message', | ||
leading: ZetaNotificationBadge.icon(icon: ZetaIcons.check_circle_round), | ||
notificationTime: "Just now", | ||
action: ZetaButton.negative( | ||
label: "Remove", | ||
onPressed: () {}, | ||
), | ||
), | ||
), | ||
].gap(ZetaSpacing.l))), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
example/widgetbook/pages/components/notification_list_item_widgetbook.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:widgetbook/widgetbook.dart'; | ||
import 'package:zeta_flutter/zeta_flutter.dart'; | ||
|
||
import '../../test/test_components.dart'; | ||
|
||
Widget notificationListItemUseCase(BuildContext context) => WidgetbookTestWidget( | ||
widget: Padding( | ||
padding: EdgeInsets.symmetric(horizontal: context.knobs.list(label: "Size", options: [100, 200, 400])), | ||
child: ZetaNotificationListItem( | ||
body: context.knobs.boolean(label: "Include Link") | ||
? Column( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: [ | ||
Text( | ||
"New urgent" * 300, | ||
maxLines: 2, | ||
overflow: TextOverflow.ellipsis, | ||
), | ||
ZetaButton.text(label: "label") | ||
], | ||
) | ||
: Text( | ||
"New urgent" * 300, | ||
maxLines: 2, | ||
overflow: TextOverflow.ellipsis, | ||
), | ||
title: context.knobs.string(label: "Title", initialValue: "Urgent Notification"), | ||
notificationTime: context.knobs.stringOrNull(label: "Notification Time", initialValue: "Just Now"), | ||
notificationRead: context.knobs.boolean(label: "Notification Read", initialValue: false), | ||
leading: context.knobs.list( | ||
label: 'Badge', | ||
options: [ | ||
ZetaNotificationBadge.avatar(avatar: ZetaAvatar.initials(initials: "AO")), | ||
ZetaNotificationBadge.icon(icon: ZetaIcons.check_circle_round), | ||
ZetaNotificationBadge.image( | ||
image: Image.network( | ||
"https://www.google.com/url?sa=i&url=https%3A%2F%2Fgithub.com%2Fzebratechnologies&psig=AOvVaw0fBPVE5gUkkpFw8mVf6B8G&ust=1717073069230000&source=images&cd=vfe&opi=89978449&ved=0CBIQjRxqFwoTCPCwn-XxsoYDFQAAAAAdAAAAABAE")) | ||
], | ||
labelBuilder: (value) => value.avatar != null | ||
? "Avatar" | ||
: value.icon != null | ||
? "Icon" | ||
: "Image", | ||
), | ||
action: context.knobs.list( | ||
label: "Action Buttons", | ||
options: [ | ||
ZetaButton.negative(label: "Remove"), | ||
ZetaButton.positive(label: "Add"), | ||
ZetaButton.outline(label: "Action"), | ||
], | ||
labelBuilder: (value) { | ||
final button = (value as ZetaButton); | ||
return button.label == "Remove" | ||
? "Negative" | ||
: button.label == "Add" | ||
? "Positive" | ||
: "Netutral"; | ||
}, | ||
), | ||
showDivider: context.knobs.booleanOrNull(label: "Has More"), | ||
), | ||
), | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.