Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(UX-1232): Breadcrumb Issues #214

Merged
merged 6 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions example/lib/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ 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/bottom_sheet_example.dart';
import 'package:zeta_example/pages/components/breadcrumbs_example.dart';
import 'package:zeta_example/pages/components/breadcrumb_example.dart';
import 'package:zeta_example/pages/components/button_example.dart';
import 'package:zeta_example/pages/components/chat_item_example.dart';
import 'package:zeta_example/pages/components/checkbox_example.dart';
Expand Down Expand Up @@ -67,7 +67,7 @@ final List<Component> components = [
Component(BannerExample.name, (context) => const BannerExample()),
Component(BadgesExample.name, (context) => const BadgesExample()),
Component(BottomSheetExample.name, (context) => const BottomSheetExample()),
Component(BreadCrumbsExample.name, (context) => const BreadCrumbsExample()),
Component(BreadcrumbExample.name, (context) => const BreadcrumbExample()),
Component(ButtonExample.name, (context) => const ButtonExample()),
Component(ChatItemExample.name, (context) => const ChatItemExample()),
Component(CheckBoxExample.name, (context) => const CheckBoxExample()),
Expand Down
57 changes: 57 additions & 0 deletions example/lib/pages/components/breadcrumb_example.dart
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 BreadcrumbExample extends StatefulWidget {
static const String name = 'Breadcrumb';

const BreadcrumbExample({super.key});

@override
State<BreadcrumbExample> createState() => _BreadcrumbExampleState();
}

class _BreadcrumbExampleState extends State<BreadcrumbExample> {
List<ZetaBreadcrumbItem> _children = [];

@override
void initState() {
super.initState();
_children = [
ZetaBreadcrumbItem(label: 'Breadcrumb', onPressed: () {}),
ZetaBreadcrumbItem(label: 'Item 1', onPressed: () {}),
ZetaBreadcrumbItem(label: 'Item 2', onPressed: () {}),
ZetaBreadcrumbItem(label: 'Item 3', icon: ZetaIcons.star, onPressed: () {}),
ZetaBreadcrumbItem(label: 'Item 4', onPressed: () {}),
ZetaBreadcrumbItem(label: 'Item 5', onPressed: () {}),
ZetaBreadcrumbItem(label: 'Item 6', onPressed: () {}),
ZetaBreadcrumbItem(label: 'Item 7', onPressed: () {}),
];
}

@override
Widget build(BuildContext context) {
return ExampleScaffold(
name: 'Breadcrumb',
child: Center(
child: SingleChildScrollView(
child: SizedBox(
width: double.infinity,
child: Column(
children: [
ZetaBreadcrumb(children: _children.sublist(0, 1)),
ZetaBreadcrumb(children: _children.sublist(0, 2)),
ZetaBreadcrumb(children: _children.sublist(0, 3)),
ZetaBreadcrumb(children: _children.sublist(0, 4), maxItemsShown: 3),
ZetaBreadcrumb(children: _children.sublist(0, 5), maxItemsShown: 5),
ZetaBreadcrumb(children: _children.sublist(0, 6), maxItemsShown: 3),
ZetaBreadcrumb(children: _children.sublist(0, 7)),
ZetaBreadcrumb(children: _children, maxItemsShown: 1),
].gap(50),
),
),
),
),
);
}
}
58 changes: 0 additions & 58 deletions example/lib/pages/components/breadcrumbs_example.dart

This file was deleted.

4 changes: 2 additions & 2 deletions example/widgetbook/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import 'pages/components/avatar_widgetbook.dart';
import 'pages/components/badges_widgetbook.dart';
import 'pages/components/banner_widgetbook.dart';
import 'pages/components/bottom_sheet_widgetbook.dart';
import 'pages/components/breadcrumbs_widgetbook.dart';
import 'pages/components/breadcrumb_widgetbook.dart';
import 'pages/components/button_widgetbook.dart';
import 'pages/components/chat_item_widgetbook.dart';
import 'pages/components/checkbox_widgetbook.dart';
Expand Down Expand Up @@ -192,7 +192,7 @@ class _HotReloadState extends State<HotReload> {
WidgetbookUseCase(name: 'Accordion', builder: (context) => accordionUseCase(context)),
WidgetbookUseCase(name: 'Banners', builder: (context) => bannerUseCase(context)),
WidgetbookUseCase(name: 'Bottom Sheet', builder: (context) => bottomSheetContentUseCase(context)),
WidgetbookUseCase(name: 'BreadCrumbs', builder: (context) => breadCrumbsUseCase(context)),
WidgetbookUseCase(name: 'Breadcrumb', builder: (context) => breadcrumbUseCase(context)),
WidgetbookUseCase(name: 'Checkbox', builder: (context) => checkboxUseCase(context)),
WidgetbookUseCase(name: 'Comms Button', builder: (context) => commsButtonUseCase(context)),
WidgetbookUseCase(name: 'Date Input', builder: (context) => dateInputUseCase(context)),
Expand Down
58 changes: 58 additions & 0 deletions example/widgetbook/pages/components/breadcrumb_widgetbook.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import 'package:flutter/material.dart';
import 'package:zeta_flutter/zeta_flutter.dart';

import '../../utils/scaffold.dart';
import 'package:widgetbook/widgetbook.dart';

final List<ZetaBreadcrumbItem> children = [
ZetaBreadcrumbItem(label: 'Breadcrumb', onPressed: () {}),
ZetaBreadcrumbItem(label: 'Item 1', onPressed: () {}),
ZetaBreadcrumbItem(label: 'Item 2', onPressed: () {}),
ZetaBreadcrumbItem(label: 'Item 3', onPressed: () {}),
ZetaBreadcrumbItem(label: 'Item 4', onPressed: () {}),
ZetaBreadcrumbItem(label: 'Item 5', onPressed: () {}),
ZetaBreadcrumbItem(label: 'Item 6', onPressed: () {})
];

Widget breadcrumbUseCase(BuildContext context) => WidgetbookScaffold(
builder: (context, _) => Center(
child: BreadcrumbExample(context, children),
),
);

class BreadcrumbExample extends StatelessWidget {
BreadcrumbExample(this.context, this.children);
final BuildContext context;
final List<ZetaBreadcrumbItem> children;

@override
Widget build(BuildContext _) {
return SingleChildScrollView(
child: SizedBox(
width: double.infinity,
child: Column(
children: [
ZetaBreadcrumb(
rounded: context.knobs.boolean(label: 'Rounded', initialValue: true),
children: context.knobs.list(
label: 'Items',
labelBuilder: (value) => value.length.toString(),
initialOption: children.sublist(0, 4),
options: List.generate(
children.length,
(index) => children.sublist(0, index + 1),
),
),
maxItemsShown: context.knobs.int.slider(
label: 'Max Items Shown',
initialValue: 2,
min: 1,
max: children.length,
),
),
],
),
),
);
}
}
63 changes: 0 additions & 63 deletions example/widgetbook/pages/components/breadcrumbs_widgetbook.dart

This file was deleted.

Loading