-
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.
* feat(main): Chat Item * [automated commit] lint format and import sort * remove hard coded avatar * [automated commit] lint format and import sort --------- Co-authored-by: github-actions <[email protected]>
- Loading branch information
1 parent
84b727c
commit c2dd630
Showing
7 changed files
with
487 additions
and
0 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
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,61 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:zeta_example/widgets.dart'; | ||
import 'package:zeta_flutter/zeta_flutter.dart'; | ||
|
||
class ChatItemExample extends StatefulWidget { | ||
static const String name = 'ChatItem'; | ||
|
||
const ChatItemExample({Key? key}) : super(key: key); | ||
|
||
@override | ||
State<ChatItemExample> createState() => _ChatItemExampleState(); | ||
} | ||
|
||
class _ChatItemExampleState extends State<ChatItemExample> { | ||
@override | ||
Widget build(BuildContext context) { | ||
return ExampleScaffold( | ||
name: 'Chat Item', | ||
child: SingleChildScrollView( | ||
child: Column( | ||
children: [ | ||
ZetaChatItem( | ||
time: DateTime.now(), | ||
enabledWarningIcon: true, | ||
enabledNotificationIcon: true, | ||
leading: const ZetaAvatar( | ||
size: ZetaAvatarSize.l, | ||
), | ||
count: 100, | ||
onTap: () {}, | ||
onDeleteTap: () {}, | ||
onCallTap: () {}, | ||
onMenuMoreTap: () {}, | ||
onPttTap: () {}, | ||
title: Text("Chat name ID"), | ||
subtitle: Text( | ||
"Dummy text to represent the first lines of most recent message dsadas dsa dsa ds dssd sd sdsd s ds"), | ||
), | ||
Padding( | ||
padding: const EdgeInsets.only(top: ZetaSpacing.b), | ||
child: ZetaChatItem( | ||
highlighted: true, | ||
count: 99, | ||
time: DateTime.now(), | ||
onTap: () {}, | ||
starred: true, | ||
leading: const ZetaAvatar( | ||
size: ZetaAvatarSize.l, | ||
), | ||
title: Text("Chat name ID"), | ||
subtitle: Text( | ||
"Dummy text to represent the first lines of most recent message", | ||
), | ||
), | ||
), | ||
], | ||
), | ||
), | ||
); | ||
} | ||
} |
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
49 changes: 49 additions & 0 deletions
49
example/widgetbook/pages/components/chat_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,49 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:widgetbook/widgetbook.dart'; | ||
import 'package:zeta_flutter/zeta_flutter.dart'; | ||
|
||
import '../../test/test_components.dart'; | ||
|
||
Widget chatItemWidgetBook(BuildContext context) { | ||
final title = context.knobs.string(label: 'Title', initialValue: 'Chat name ID'); | ||
|
||
final subtitle = context.knobs.string( | ||
label: 'Subtitle', | ||
initialValue: 'Dummy text to represent the first lines of most recent message', | ||
); | ||
|
||
final count = context.knobs.int.input(label: 'Count', initialValue: 3); | ||
|
||
final enabledWarningIcon = context.knobs.boolean(label: 'Warning Icon', initialValue: false); | ||
final enabledNotificationIcon = context.knobs.boolean(label: 'Notification Icon', initialValue: false); | ||
final starred = context.knobs.boolean(label: 'Starred', initialValue: false); | ||
|
||
final enabledOnTap = context.knobs.boolean(label: 'Enabled Tap', initialValue: true); | ||
final enabledOnDelete = context.knobs.boolean(label: 'Delete', initialValue: true); | ||
|
||
final enabledOnMenuMore = context.knobs.boolean(label: 'Menu More', initialValue: true); | ||
|
||
final enabledOnCall = context.knobs.boolean(label: 'Call', initialValue: true); | ||
|
||
final enabledOnPtt = context.knobs.boolean(label: 'Ptt', initialValue: true); | ||
|
||
return WidgetbookTestWidget( | ||
widget: ZetaChatItem( | ||
time: DateTime.now(), | ||
enabledWarningIcon: enabledWarningIcon, | ||
enabledNotificationIcon: enabledNotificationIcon, | ||
count: count, | ||
onTap: enabledOnTap ? () {} : null, | ||
onDeleteTap: enabledOnDelete ? () {} : null, | ||
onCallTap: enabledOnCall ? () {} : null, | ||
onMenuMoreTap: enabledOnMenuMore ? () {} : null, | ||
onPttTap: enabledOnPtt ? () {} : null, | ||
starred: starred, | ||
leading: const ZetaAvatar( | ||
size: ZetaAvatarSize.l, | ||
), | ||
title: Text(title), | ||
subtitle: Text(subtitle), | ||
), | ||
); | ||
} |
Oops, something went wrong.