-
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: Added ZetaProvider.base to allow for better developer experience
- Loading branch information
1 parent
913662d
commit 3cf4719
Showing
7 changed files
with
752 additions
and
602 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
## Set up | ||
|
||
To use Zeta components in you app, first the whole app must be wrapped with `ZetaProvider`. The easiest way to do this is with the custom builder `ZetaProvider.custom`. | ||
You can provide initial values for `ThemeData`, `ThemeMode`, `contrast` and `ZetaThemeData`. | ||
|
||
* `initialThemeData` allows you to extend an existing Flutter themeData to use alongside the `Zeta` theme. | ||
* `initialThemeMode` sets whether the app starts in light or dark mode, or uses the device default. | ||
* `initialContrast` sets whether the app starts with standard (WCAG AA) contrast, or if it attempts to use the more accessible contrast (WCAG AAA). | ||
* `initialZetaThemeData` allows you to override the Zeta theme with a custom theme. | ||
|
||
```dart | ||
return ZetaProvider.base( | ||
initialThemeData: initialThemeData, | ||
initialThemeMode: initialThemeMode, | ||
initialContrast: initialContrast, | ||
initialZetaThemeData: initialZetaThemeData, | ||
initialRounded: initialRounded, | ||
builder: (context, lightTheme, darkTheme, themeMode) { | ||
return MaterialApp.router( | ||
routerConfig: router, | ||
themeMode: themeMode, | ||
theme: lightTheme, | ||
darkTheme: darkTheme, | ||
); | ||
}, | ||
); | ||
``` | ||
|
||
## Using the components | ||
|
||
Once Zeta is configured, Zeta components can be used as any other componenent, and will inherit theme and other information from `Zeta`. | ||
|
||
```dart | ||
Column( | ||
children:[ | ||
ZetaButton(label: 'Button', onPressed: (){}), | ||
ZetaAvatar(), | ||
ZetaStatusLabel(), | ||
// etc... | ||
] | ||
) | ||
``` |
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.