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

prerelease/0.6.0 #45

Merged
merged 17 commits into from
Apr 12, 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
9 changes: 9 additions & 0 deletions .firebaserc
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
{
"projects": {
"default": "zeta-ds"
},
"targets": {
"zeta-ds": {
"hosting": {
"flutter": [
"zeta-flutter-main"
]
}
}
}
}
18 changes: 18 additions & 0 deletions .github/workflows/on-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,21 @@ jobs:
git add -A
git commit -m '[automated commit] lint format and import sort'
git push -f
deploy-qa-demo:
name: Deploy preview version of the storybook on firebase
needs: code-quality
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
- name: Setup flutter
run: flutter pub get
- name: Build example app
run: |
cd example
flutter build web -t widgetbook/main.dart -o ../build --no-tree-shake-icons
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: "${{ secrets.GITHUB_TOKEN }}"
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_ZETA_DS }}"
channelId: "live"
5 changes: 0 additions & 5 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,6 @@ jobs:
with:
ref: ${{ github.head_ref }}
- uses: subosito/flutter-action@v2
with:
flutter-version: "3.19.x"
channel: "stable"
- name: Setup flutter
run: flutter pub get
- name: Build example app
Expand All @@ -100,6 +97,4 @@ jobs:
with:
repoToken: "${{ secrets.GITHUB_TOKEN }}"
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_ZETA_DS }}"
expires: 7d
projectId: zeta-ds
channelId: "pr-${{ github.event.number }}-${{ github.event.pull_request.head.ref }}"
27 changes: 0 additions & 27 deletions CONTRIBUTING

This file was deleted.

53 changes: 53 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Getting Involved

Thank you for your interest in this project. We'd love to see your contributions. There are just few small guidelines you need to follow.
Please note we have a code of conduct, please follow it in all your interactions with the project.

## Opening an issue

If you've noticed a bug or you have a suggestion for a new feature, please go ahead and open an issue in this project. Please do include as much information as possible.

Please file issues before doing substantial work; this will ensure that others don't duplicate the work and that there's a chance to discuss any design issues.

## Making a code change

We're always open to pull requests, but these should be small and clearly described so that we can understand what you're trying to do.

When you're ready to start coding, fork the needed repository to your own GitHub account and make your changes in a new branch. Once you're happy, open a pull request and explain what the change is and why you think we should include it in our project.

If the change is a bug fix, try to create a test that aligns with the bug.

### Creating a new component

We want the designs to be the source of truth for this repository, so new components will only be accepted if they are with the design files.

New components should use all tokens matching the design, and should not use hardcoded values for color, spacing, or radius. This ensures that changes made to these fundamental tokens are reflected throughout the library.

All components should have inline [dartdoc](https://dart.dev/tools/dart-doc) documentation on public functions and variables. This is enforced by the lint rules.

To demonstrate a component, we need to create 2 examples: firstly in the zeta_flutter example app and secondly in widgetbook.

Example app should show basic examples to compare against the designs and is typically used by developers whilst building out components.

The widgetbook is used by the wider team to review components. We should attempt to show the full functionality of a component in a single Widgetbook instance. We have some helper functions for building knobs for icons and rounded bool in [utils.dart](./example/widgetbook/utils/utils.dart).
For more information on widgetbook, [read the docs](https://docs.widgetbook.io/).

We should also create a test for each widget created.

## Code reviews

All submissions, including submissions by project members, require review. We use GitHub pull requests (PRs) for this purpose. Consult [GitHub Help](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests) for more information on using pull requests.

Before a PR can be reviewed, ensure you have done the following, and fixed any issues that may arise:

- Ensure branch is up to date `git rebase main`
- Check formatting: `flutter format .`
- Run static analyses: `flutter analyze`
- Run unit-tests: `flutter test`

All PRs should be titled according to [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/), as the branch will be squashed, so the PR title will become the commit message.
Examples:

- `feat(X):` for new features
- `fix(x):` for bug fixes
- `chore(x):` for admin / chores.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ With these configurations, Zeta makes it easy to achieve consistent theming thro

## Viewing the components

To view examples of all the components in the library, you can run the example app in this repo or go to [Zeta](https://zeta-ds.web.app/)
To view examples of all the components in the library, you can pull this repo and run either the example app or widgetbook instance.

You can also view the latest release at [Zeta](https://zeta-ds.web.app/) or the latest commits to main [here](https://zeta-flutter-main.web.app/).

## Licensing

Expand Down
16 changes: 16 additions & 0 deletions example/lib/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,16 @@ import 'package:zeta_example/pages/components/breadcrumbs_example.dart';
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/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/radio_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/theme/color_example.dart';
import 'package:zeta_example/pages/components/password_input_example.dart';
import 'package:zeta_example/pages/components/progress_example.dart';
Expand Down Expand Up @@ -38,10 +46,18 @@ final List<Component> components = [
Component(ButtonExample.name, (context) => const ButtonExample()),
Component(CheckBoxExample.name, (context) => const CheckBoxExample()),
Component(ChipExample.name, (context) => const ChipExample()),
Component(ListItemExample.name, (context) => const ListItemExample()),
Component(NavigationBarExample.name, (context) => const NavigationBarExample()),
Component(PasswordInputExample.name, (context) => const PasswordInputExample()),
Component(DropdownExample.name, (context) => const DropdownExample()),
Component(ProgressExample.name, (context) => const ProgressExample()),
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()),
];

final List<Component> theme = [
Expand Down
107 changes: 107 additions & 0 deletions example/lib/pages/components/date_input_example.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
import 'package:flutter/material.dart';
import 'package:zeta_example/widgets.dart';
import 'package:zeta_flutter/zeta_flutter.dart';

class DateInputExample extends StatefulWidget {
static const String name = 'DateInput';

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

@override
State<DateInputExample> createState() => _DateInputExampleState();
}

class _DateInputExampleState extends State<DateInputExample> {
String? _errorText;

@override
Widget build(BuildContext context) {
return ExampleScaffold(
name: 'Date Input',
child: SingleChildScrollView(
child: Column(
children: [
Padding(
padding: const EdgeInsets.only(top: 20),
child: Text('Rounded', style: ZetaTextStyles.titleMedium),
),
Padding(
padding: const EdgeInsets.all(20),
child: ZetaDateInput(
label: 'Birthdate',
hint: 'Enter birthdate',
hasError: _errorText != null,
errorText: _errorText ?? 'Invalid date',
onChanged: (value) {
if (value == null) return setState(() => _errorText = null);
final now = DateTime.now();
setState(
() => _errorText = value.difference(DateTime(now.year, now.month, now.day)).inDays > 0
? 'Birthdate cannot be in the future'
: null,
);
},
),
),
Divider(color: Colors.grey[200]),
Padding(
padding: const EdgeInsets.only(top: 20),
child: Text('Sharp', style: ZetaTextStyles.titleMedium),
),
Padding(
padding: const EdgeInsets.all(20),
child: ZetaDateInput(
label: 'Label',
hint: 'Default hint text',
errorText: 'Oops! Error hint text',
rounded: false,
datePattern: 'yyyy-MM-dd',
),
),
Divider(color: Colors.grey[200]),
Padding(
padding: const EdgeInsets.only(top: 20),
child: Text('Disabled', style: ZetaTextStyles.titleMedium),
),
Padding(
padding: const EdgeInsets.all(20),
child: ZetaDateInput(
label: 'Label',
hint: 'Default hint text',
enabled: false,
),
),
Divider(color: Colors.grey[200]),
Padding(
padding: const EdgeInsets.only(top: 20),
child: Text('Medium', style: ZetaTextStyles.titleMedium),
),
Padding(
padding: const EdgeInsets.all(20),
child: ZetaDateInput(
label: 'Label',
hint: 'Default hint text',
errorText: 'Oops! Error hint text',
size: ZetaDateInputSize.medium,
),
),
Divider(color: Colors.grey[200]),
Padding(
padding: const EdgeInsets.only(top: 20),
child: Text('Small', style: ZetaTextStyles.titleMedium),
),
Padding(
padding: const EdgeInsets.all(20),
child: ZetaDateInput(
label: 'Label',
hint: 'Default hint text',
errorText: 'Oops! Error hint text',
size: ZetaDateInputSize.small,
),
),
],
),
),
);
}
}
56 changes: 56 additions & 0 deletions example/lib/pages/components/dropdown_example.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import 'package:flutter/material.dart';
import 'package:zeta_example/widgets.dart';
import 'package:zeta_flutter/zeta_flutter.dart';

class DropdownExample extends StatefulWidget {
static const String name = "Dropdown";
const DropdownExample({super.key});

@override
State<DropdownExample> createState() => _DropdownExampleState();
}

class _DropdownExampleState extends State<DropdownExample> {
ZetaDropdownItem selectedItem = ZetaDropdownItem(
value: "Item 1",
leadingIcon: Icon(ZetaIcons.star_round),
);

@override
Widget build(BuildContext context) {
return ExampleScaffold(
name: "Dropdown",
child: Center(
child: SingleChildScrollView(
child: SizedBox(
width: 320,
child: Column(children: [
ZetaDropdown(
leadingType: LeadingStyle.checkbox,
onChange: (value) {
setState(() {
selectedItem = value;
});
},
selectedItem: selectedItem,
items: [
ZetaDropdownItem(
value: "Item 1",
leadingIcon: Icon(ZetaIcons.star_round),
),
ZetaDropdownItem(
value: "Item 2",
leadingIcon: Icon(ZetaIcons.star_half_round),
),
ZetaDropdownItem(
value: "Item 3",
)
],
),
Text('Selected item : ${selectedItem.value}')
])),
),
),
);
}
}
Loading
Loading