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

Updates from ZebraFED #56

Merged
merged 17 commits into from
Apr 25, 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
14 changes: 14 additions & 0 deletions example/lib/home.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:zeta_example/pages/components/accordion_example.dart';
import 'package:zeta_example/pages/components/app_bar_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';
Expand All @@ -10,16 +11,22 @@ import 'package:zeta_example/pages/components/button_example.dart';
import 'package:zeta_example/pages/components/checkbox_example.dart';
import 'package:zeta_example/pages/components/chip_example.dart';
import 'package:zeta_example/pages/components/date_input_example.dart';
import 'package:zeta_example/pages/components/dialog_example.dart';
import 'package:zeta_example/pages/components/dialpad_example.dart';
import 'package:zeta_example/pages/components/dropdown_example.dart';
import 'package:zeta_example/pages/components/list_item_example.dart';
import 'package:zeta_example/pages/components/navigation_bar_example.dart';
import 'package:zeta_example/pages/components/navigation_rail_example.dart';
import 'package:zeta_example/pages/components/phone_input_example.dart';
import 'package:zeta_example/pages/components/radio_example.dart';
import 'package:zeta_example/pages/components/search_bar_example.dart';
import 'package:zeta_example/pages/components/segmented_control_example.dart';
import 'package:zeta_example/pages/components/stepper_example.dart';
import 'package:zeta_example/pages/components/switch_example.dart';
import 'package:zeta_example/pages/components/snackbar_example.dart';
import 'package:zeta_example/pages/components/tabs_example.dart';
import 'package:zeta_example/pages/components/pagination_example.dart';
import 'package:zeta_example/pages/components/tooltip_example.dart';
import 'package:zeta_example/pages/theme/color_example.dart';
import 'package:zeta_example/pages/components/password_input_example.dart';
import 'package:zeta_example/pages/components/progress_example.dart';
Expand All @@ -39,6 +46,7 @@ class Component {

final List<Component> components = [
Component(AccordionExample.name, (context) => const AccordionExample()),
Component(AppBarExample.name, (context) => const AppBarExample()),
Component(AvatarExample.name, (context) => const AvatarExample()),
Component(BannerExample.name, (context) => const BannerExample()),
Component(BadgesExample.name, (context) => const BadgesExample()),
Expand All @@ -53,13 +61,19 @@ final List<Component> components = [
Component(PasswordInputExample.name, (context) => const PasswordInputExample()),
Component(DropdownExample.name, (context) => const DropdownExample()),
Component(ProgressExample.name, (context) => const ProgressExample()),
Component(SegmentedControlExample.name, (context) => const SegmentedControlExample()),
Component(SnackBarExample.name, (context) => const SnackBarExample()),
Component(StepperExample.name, (context) => const StepperExample()),
Component(TabsExample.name, (context) => const TabsExample()),
Component(DialPadExample.name, (context) => const DialPadExample()),
Component(RadioButtonExample.name, (context) => const RadioButtonExample()),
Component(SwitchExample.name, (context) => const SwitchExample()),
Component(DateInputExample.name, (context) => const DateInputExample()),
Component(PhoneInputExample.name, (context) => const PhoneInputExample()),
Component(DialogExample.name, (context) => const DialogExample()),
Component(SearchBarExample.name, (context) => const SearchBarExample()),
Component(TooltipExample.name, (context) => const TooltipExample()),
Component(NavigationRailExample.name, (context) => const NavigationRailExample()),
];

final List<Component> theme = [
Expand Down
182 changes: 182 additions & 0 deletions example/lib/pages/components/app_bar_example.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
import 'dart:math';

import 'package:flutter/material.dart';
import 'package:zeta_example/widgets.dart';
import 'package:zeta_flutter/zeta_flutter.dart';

class AppBarExample extends StatefulWidget {
const AppBarExample({super.key});

static const String name = 'AppBar';

@override
State<AppBarExample> createState() => _AppBarExampleState();
}

class _AppBarExampleState extends State<AppBarExample> {
late final _searchController = AppBarSearchController();

void _showHideSearch() {
_searchController.isEnabled ? _searchController.closeSearch() : _searchController.startSearch();
}

@override
Widget build(BuildContext context) {
return ExampleScaffold(
name: AppBarExample.name,
child: SingleChildScrollView(
child: Column(
children: [
// Default
Padding(
padding: const EdgeInsets.only(top: ZetaSpacing.x4),
child: ZetaAppBar(
leading: IconButton(
onPressed: () {},
icon: Icon(Icons.menu_rounded),
),
title: Row(
children: [
ZetaAvatar(size: ZetaAvatarSize.xs),
Padding(
padding: const EdgeInsets.only(left: ZetaSpacing.s),
child: Text("Title"),
),
],
),
actions: [
IconButton(
onPressed: () {},
icon: Icon(Icons.language),
),
IconButton(
onPressed: () {},
icon: Icon(Icons.favorite),
),
IconButton(
onPressed: () {},
icon: Icon(ZetaIcons.more_vertical_round),
)
],
),
),

// Centered
Padding(
padding: const EdgeInsets.only(top: ZetaSpacing.x4),
child: ZetaAppBar(
type: ZetaAppBarType.centeredTitle,
leading: IconButton(
onPressed: () {},
icon: Icon(Icons.menu_rounded),
),
title: Text("Title"),
actions: [
IconButton(
onPressed: () {},
icon: Icon(Icons.account_circle),
),
],
),
),

// Contextual
Padding(
padding: const EdgeInsets.only(top: ZetaSpacing.x4),
child: ZetaAppBar(
leading: IconButton(
onPressed: () {},
icon: Icon(ZetaIcons.close_round),
),
title: Text("2 items"),
actions: [
IconButton(
onPressed: () {},
icon: Icon(ZetaIcons.edit_round),
),
IconButton(
onPressed: () {},
icon: Icon(ZetaIcons.share_round),
),
IconButton(
onPressed: () {},
icon: Icon(ZetaIcons.delete_round),
),
IconButton(
onPressed: () {},
icon: Icon(ZetaIcons.more_vertical_round),
),
],
),
),

// Search
Padding(
padding: const EdgeInsets.only(top: ZetaSpacing.x4),
child: Column(
children: [
ZetaAppBar(
type: ZetaAppBarType.centeredTitle,
leading: BackButton(),
title: Text("Title"),
actions: [
IconButton(
onPressed: _showHideSearch,
icon: Icon(ZetaIcons.search_round),
)
],
searchController: _searchController,
onSearch: (text) => debugPrint('search text: $text'),
onSearchMicrophoneIconPressed: () async {
var sampleTexts = [
'This is a sample text',
'Another sample',
'Speech recognition text',
'Example'
];

var generatedText = sampleTexts[Random().nextInt(sampleTexts.length)];

_searchController.text = generatedText;
},
),
ZetaButton.primary(
label: "Show/Hide Search",
onPressed: _showHideSearch,
)
],
),
),

// Extended
Padding(
padding: const EdgeInsets.only(top: ZetaSpacing.x4),
child: ZetaAppBar(
type: ZetaAppBarType.extendedTitle,
leading: IconButton(
onPressed: () {},
icon: Icon(Icons.menu),
),
title: Text("Large title"),
actions: [
IconButton(
onPressed: () {},
icon: Icon(Icons.language),
),
IconButton(
onPressed: () {},
icon: Icon(Icons.favorite),
),
IconButton(
onPressed: () {},
icon: Icon(ZetaIcons.more_vertical_round),
)
],
),
),
],
),
),
);
}
}
4 changes: 2 additions & 2 deletions example/lib/pages/components/date_input_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class _DateInputExampleState extends State<DateInputExample> {
label: 'Label',
hint: 'Default hint text',
errorText: 'Oops! Error hint text',
size: ZetaDateInputSize.medium,
size: ZetaWidgetSize.medium,
),
),
Divider(color: Colors.grey[200]),
Expand All @@ -96,7 +96,7 @@ class _DateInputExampleState extends State<DateInputExample> {
label: 'Label',
hint: 'Default hint text',
errorText: 'Oops! Error hint text',
size: ZetaDateInputSize.small,
size: ZetaWidgetSize.small,
),
),
],
Expand Down
93 changes: 93 additions & 0 deletions example/lib/pages/components/dialog_example.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
import 'package:flutter/material.dart';
import 'package:zeta_example/widgets.dart';
import 'package:zeta_flutter/zeta_flutter.dart';

class DialogExample extends StatelessWidget {
static const String name = 'Dialog';

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

@override
Widget build(BuildContext context) {
final zeta = Zeta.of(context);
return ExampleScaffold(
name: 'Dialog',
child: Center(
child: Column(
children: [
TextButton(
onPressed: () => showZetaDialog(
context,
useRootNavigator: false,
title: 'Dialog Title',
icon: Icon(
ZetaIcons.warning_round,
color: zeta.colors.warning,
),
message:
'Lorem ipsum dolor sit amet, conse ctetur adipiscing elit, sed do eiusm od tempor incididunt ut labore et do lore magna aliqua.',
primaryButtonLabel: 'Confirm',
),
child: Text('Show dialog with one button'),
),
TextButton(
onPressed: () => showZetaDialog(
context,
useRootNavigator: false,
title: 'Dialog Title',
icon: Icon(
ZetaIcons.warning_round,
color: zeta.colors.warning,
),
message:
'Lorem ipsum dolor sit amet, conse ctetur adipiscing elit, sed do eiusm od tempor incididunt ut labore et do lore magna aliqua.',
primaryButtonLabel: 'Confirm',
secondaryButtonLabel: 'Cancel',
),
child: Text('Show dialog with two buttons'),
),
TextButton(
onPressed: () => showZetaDialog(
context,
useRootNavigator: false,
title: 'Dialog Title',
icon: Icon(
ZetaIcons.warning_round,
color: zeta.colors.warning,
),
message:
'Lorem ipsum dolor sit amet, conse ctetur adipiscing elit, sed do eiusm od tempor incididunt ut labore et do lore magna aliqua.',
primaryButtonLabel: 'Confirm',
secondaryButtonLabel: 'Cancel',
tertiaryButtonLabel: 'Learn more',
onTertiaryButtonPressed: () {},
),
child: Text('Show dialog with three buttons'),
),
TextButton(
onPressed: () => showZetaDialog(
context,
useRootNavigator: false,
title: 'Dialog Title',
icon: Icon(
ZetaIcons.warning_round,
color: zeta.colors.warning,
),
message:
'Lorem ipsum dolor sit amet, conse ctetur adipiscing elit, sed do eiusm od tempor incididunt ut labore et do lore magna aliqua.',
headerAlignment: ZetaDialogHeaderAlignment.left,
primaryButtonLabel: 'Confirm',
secondaryButtonLabel: 'Cancel',
rounded: false,
),
child: Text(
'Show dialog with header to the left\nand sharp buttons',
textAlign: TextAlign.center,
),
),
],
),
),
);
}
}
Loading
Loading