-
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
12 changed files
with
449 additions
and
85 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,57 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:zeta_example/widgets.dart'; | ||
import 'package:zeta_flutter/zeta_flutter.dart'; | ||
|
||
class GroupHeaderExample extends StatefulWidget { | ||
static final name = "GlobalHeader"; | ||
const GroupHeaderExample({super.key}); | ||
|
||
@override | ||
State<GroupHeaderExample> createState() => _GroupHeaderExampleState(); | ||
} | ||
|
||
class _GroupHeaderExampleState extends State<GroupHeaderExample> { | ||
final childrenOne = List.filled(5, ZetaGlobalHeaderItem(label: 'Button')); | ||
final childrenTwo = List.filled(10, ZetaGlobalHeaderItem(label: 'Button')); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return ExampleScaffold( | ||
name: "Global Header", | ||
child: LayoutBuilder(builder: (context, constraints) { | ||
return Center( | ||
child: SingleChildScrollView( | ||
child: Column(children: [ | ||
Text(constraints.maxWidth.toString()), | ||
ZetaGlobalHeader( | ||
title: "Title", | ||
tabItems: childrenOne, | ||
searchBar: ZetaSearchBar(shape: ZetaWidgetBorder.full, size: ZetaWidgetSize.large), | ||
onAppsButton: () {}, | ||
actionButtons: [ | ||
IconButton( | ||
onPressed: () {}, | ||
icon: const Icon( | ||
ZetaIcons.alert_round, | ||
), | ||
), | ||
IconButton( | ||
onPressed: () {}, | ||
icon: const Icon( | ||
ZetaIcons.help_round, | ||
), | ||
), | ||
], | ||
avatar: const ZetaAvatar(initials: 'PS'), | ||
), | ||
const SizedBox( | ||
height: ZetaSpacing.x5, | ||
), | ||
ZetaGlobalHeader(title: "Title", tabItems: childrenTwo), | ||
]), | ||
), | ||
); | ||
}), | ||
); | ||
} | ||
} |
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
38 changes: 38 additions & 0 deletions
38
example/widgetbook/pages/components/global_header_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,38 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:widgetbook/widgetbook.dart'; | ||
import 'package:zeta_flutter/zeta_flutter.dart'; | ||
|
||
import '../../test/test_components.dart'; | ||
|
||
Widget globalHeaderUseCase(BuildContext context) { | ||
final actionButtons = [ | ||
IconButton( | ||
onPressed: () {}, | ||
icon: const Icon( | ||
ZetaIcons.alert_round, | ||
), | ||
), | ||
IconButton( | ||
onPressed: () {}, | ||
icon: const Icon( | ||
ZetaIcons.help_round, | ||
), | ||
), | ||
]; | ||
|
||
return WidgetbookTestWidget( | ||
widget: ZetaGlobalHeader( | ||
title: context.knobs.string(label: "Title", initialValue: "Title"), | ||
tabItems: List.generate( | ||
context.knobs.int.slider(label: "Tabs"), (index) => ZetaGlobalHeaderItem(label: 'Button ${index + 1}')), | ||
searchBar: context.knobs.boolean(label: 'Search bar', initialValue: true) | ||
? ZetaSearchBar(shape: ZetaWidgetBorder.full, size: ZetaWidgetSize.large) | ||
: null, | ||
actionButtons: context.knobs.boolean(label: "Menu buttons", initialValue: true) ? actionButtons : [], | ||
avatar: context.knobs.boolean(label: "Show Avatar", initialValue: true) | ||
? const ZetaAvatar(initials: 'PS', size: ZetaAvatarSize.s) | ||
: null, | ||
onAppsButton: context.knobs.boolean(label: "Apps menu", initialValue: true) ? () => {} : null, | ||
), | ||
); | ||
} |
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.