Skip to content

Commit 0d23f7c

Browse files
thelukewaltongithub-actions
and
github-actions
authored
fix: Widgetbook icons and reusable snippets (ZebraDevs#35)
Co-authored-by: github-actions <[email protected]>
1 parent 085dc17 commit 0d23f7c

38 files changed

+818
-807
lines changed

.github/workflows/on-main.yml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: release-please
2+
on:
3+
push:
4+
branches:
5+
- main
6+
7+
permissions:
8+
contents: write
9+
pull-requests: write
10+
11+
jobs:
12+
release-please:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: google-github-actions/release-please-action@v4
16+
with:
17+
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
18+
code-quality:
19+
runs-on: ubuntu-latest
20+
timeout-minutes: 20
21+
steps:
22+
- uses: actions/checkout@v4
23+
with:
24+
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
25+
- name: Get branch name
26+
id: branch-name
27+
uses: tj-actions/[email protected]
28+
- uses: subosito/flutter-action@v2
29+
- name: Setup flutter
30+
run: flutter pub get
31+
- name: Lint and format
32+
run: |
33+
dart format . -l 120
34+
dart fix --apply
35+
flutter analyze
36+
cd example && flutter test
37+
- name: Check for modified files
38+
id: git-check
39+
run: echo "modified=$(if [ -n "$(git status --porcelain)" ]; then echo "true"; else echo "false"; fi)" >> $GITHUB_ENV
40+
- name: Update changes in GitHub repository
41+
if: env.modified == 'true'
42+
run: |
43+
git config --global user.name "github-actions"
44+
git config --global user.email "[email protected]"
45+
git add -A
46+
git commit -m '[automated commit] lint format and import sort'
47+
git push -f

.github/workflows/on-release.yml

-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ jobs:
1515
- uses: dart-lang/setup-dart@v1
1616
- name: Install Flutter
1717
uses: subosito/flutter-action@v2
18-
with:
19-
flutter-version: "3.16.x"
20-
channel: "stable"
2118
- name: Install dependencies
2219
run: flutter pub get
2320
- name: Format code

.github/workflows/pull-request.yml

-3
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,6 @@ jobs:
5959
id: branch-name
6060
uses: tj-actions/[email protected]
6161
- uses: subosito/flutter-action@v2
62-
with:
63-
flutter-version: "3.19.x"
64-
channel: "stable"
6562
- name: Setup flutter
6663
run: flutter pub get
6764
- name: Lint and format

.github/workflows/release-please.yml

-17
This file was deleted.

example/lib/home.dart

+7-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ import 'package:zeta_example/pages/theme/color_example.dart';
1414
import 'package:zeta_example/pages/components/password_input_example.dart';
1515
import 'package:zeta_example/pages/components/progress_example.dart';
1616
import 'package:zeta_example/pages/assets/icons_example.dart';
17+
import 'package:zeta_example/pages/theme/radius_example.dart';
18+
import 'package:zeta_example/pages/theme/spacing_example.dart';
19+
import 'package:zeta_example/pages/theme/typography_example.dart';
1720
import 'package:zeta_example/widgets.dart';
1821
import 'package:zeta_flutter/zeta_flutter.dart';
1922

@@ -41,6 +44,9 @@ final List<Component> components = [
4144

4245
final List<Component> theme = [
4346
Component(ColorExample.name, (context) => const ColorExample()),
47+
Component(TypographyExample.name, (context) => const TypographyExample()),
48+
Component(RadiusExample.name, (context) => const RadiusExample()),
49+
Component(SpacingExample.name, (context) => const SpacingExample()),
4450
];
4551
final List<Component> assets = [
4652
Component(IconsExample.name, (context) => const IconsExample()),
@@ -77,7 +83,7 @@ final GoRouter router = GoRouter(
7783
))
7884
.toList(),
7985
),
80-
)
86+
),
8187
],
8288
),
8389
],

example/lib/pages/components/button_example.dart

+25-32
Original file line numberDiff line numberDiff line change
@@ -111,16 +111,10 @@ class _ButtonExampleState extends State<ButtonExample> {
111111
Column(
112112
children: groupButtons(ZetaWidgetBorder.rounded),
113113
),
114-
Text('Floating Action Buttons',
115-
style: ZetaTextStyles.displayMedium),
116-
Text('Tap buttons to change current FAB: ',
117-
style: ZetaTextStyles.bodyMedium),
118-
Wrap(
119-
children:
120-
fabs.divide(SizedBox.square(dimension: 10)).toList()),
121-
]
122-
.divide(const SizedBox.square(dimension: ZetaSpacing.m))
123-
.toList(),
114+
Text('Floating Action Buttons', style: ZetaTextStyles.displayMedium),
115+
Text('Tap buttons to change current FAB: ', style: ZetaTextStyles.bodyMedium),
116+
Wrap(children: fabs.divide(SizedBox.square(dimension: 10)).toList()),
117+
].divide(const SizedBox.square(dimension: ZetaSpacing.m)).toList(),
124118
),
125119
),
126120
Expanded(child: const SizedBox()),
@@ -178,63 +172,62 @@ class _ButtonExampleState extends State<ButtonExample> {
178172

179173
List<Widget> groupButtons(ZetaWidgetBorder) {
180174
return [
181-
ZetaButtonGroup(
182-
isLarge: true,
183-
rounded: true,
184-
buttons: [
185-
GroupButton(
175+
ZetaButtonGroup(isLarge: true, rounded: true, buttons: [
176+
ZetaGroupButton(
177+
onPressed: () {},
186178
label: "Label",
187179
),
188-
GroupButton(
180+
ZetaGroupButton(
181+
onPressed: () {},
189182
label: "Label",
190183
),
191184
]),
192-
ZetaButtonGroup(
193-
isLarge: true,
194-
rounded: true,
195-
buttons: [
196-
GroupButton(
185+
ZetaButtonGroup(isLarge: true, rounded: true, buttons: [
186+
ZetaGroupButton(
187+
onPressed: () {},
197188
label: "Label",
198189
),
199-
GroupButton.dropdown(
190+
ZetaGroupButton.dropdown(
200191
onPressed: () {},
201192
label: "Label",
193+
dropdown: SizedBox(height: 100, width: 100),
202194
),
203195
]),
204196
ZetaButtonGroup(
205-
isLarge: true,
206-
rounded: true,
197+
isLarge: true,
198+
rounded: true,
207199
buttons: [
208-
GroupButton.icon(
200+
ZetaGroupButton.icon(
209201
icon: ZetaIcons.star_round,
202+
onPressed: () {},
210203
label: "Label",
211204
),
212-
GroupButton.dropdown(
205+
ZetaGroupButton.dropdown(
213206
onPressed: () {},
214207
label: "Label",
208+
dropdown: SizedBox(height: 100, width: 100),
215209
),
216-
GroupButton.icon(
217-
210+
ZetaGroupButton.icon(
218211
icon: ZetaIcons.star_round,
219212
label: "Label",
220213
),
221214
],
222215
),
223216
ZetaButtonGroup(
224217
isLarge: true,
225-
rounded: true,
218+
rounded: true,
226219
buttons: [
227-
GroupButton.icon(
220+
ZetaGroupButton.icon(
228221
icon: ZetaIcons.star_round,
229222
label: "Label",
230223
onPressed: () {},
231224
),
232-
GroupButton.icon(
225+
ZetaGroupButton.icon(
233226
icon: ZetaIcons.star_round,
234227
label: "Label",
235228
onPressed: () {},
236229
),
237-
GroupButton.icon(
230+
ZetaGroupButton.icon(
238231
icon: ZetaIcons.star_round,
239232
label: "Label",
240233
onPressed: () {},

example/lib/pages/components/progress_example.dart

+4-12
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,7 @@ class ProgressExampleState extends State<ProgressExample> {
4141
SizedBox(
4242
height: 20,
4343
),
44-
Wrapper(
45-
stepsCompleted: 0,
46-
type: ZetaProgressBarType.standard,
47-
isThin: false,
48-
stateChangeable: true),
44+
Wrapper(stepsCompleted: 0, type: ZetaProgressBarType.standard, isThin: false, stateChangeable: true),
4945
SizedBox(
5046
height: 20,
5147
),
@@ -118,9 +114,7 @@ class _WrapperState extends State<Wrapper> {
118114

119115
void setLoading() {
120116
setState(() {
121-
type = type == ZetaProgressBarType.buffering
122-
? ZetaProgressBarType.standard
123-
: ZetaProgressBarType.buffering;
117+
type = type == ZetaProgressBarType.buffering ? ZetaProgressBarType.standard : ZetaProgressBarType.buffering;
124118
});
125119
}
126120

@@ -150,13 +144,11 @@ class _WrapperState extends State<Wrapper> {
150144
mainAxisAlignment: MainAxisAlignment.center,
151145
children: [
152146
widget.type != ZetaProgressBarType.indeterminate
153-
? FilledButton(
154-
onPressed: increasePercentage, child: Text("Increase"))
147+
? FilledButton(onPressed: increasePercentage, child: Text("Increase"))
155148
: Container(),
156149
const SizedBox(width: 40),
157150
widget.stateChangeable!
158-
? FilledButton(
159-
onPressed: setLoading, child: Text("Start Buffering"))
151+
? FilledButton(onPressed: setLoading, child: Text("Start Buffering"))
160152
: SizedBox.shrink()
161153
],
162154
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:zeta_example/widgets.dart';
3+
import 'package:zeta_flutter/zeta_flutter.dart';
4+
5+
class RadiusExample extends StatelessWidget {
6+
static const String name = 'Radius';
7+
8+
const RadiusExample({super.key});
9+
10+
@override
11+
Widget build(BuildContext context) {
12+
List<BorderRadius> radii = [
13+
ZetaRadius.none,
14+
ZetaRadius.minimal,
15+
ZetaRadius.rounded,
16+
ZetaRadius.wide,
17+
ZetaRadius.full
18+
];
19+
final colors = Zeta.of(context).colors;
20+
return ExampleScaffold(
21+
name: name,
22+
child: SingleChildScrollView(
23+
padding: EdgeInsets.all(ZetaSpacing.m),
24+
child: Row(
25+
mainAxisAlignment: MainAxisAlignment.center,
26+
children: [
27+
Column(
28+
children: radii
29+
.map((rad) {
30+
return Container(
31+
width: 250,
32+
height: 100,
33+
decoration: BoxDecoration(
34+
borderRadius: rad,
35+
color: Zeta.of(context).colors.blue.shade30,
36+
border: Border.all(color: colors.blue.shade80, width: 3),
37+
),
38+
child: Center(
39+
child: Container(
40+
decoration: BoxDecoration(
41+
borderRadius: rad,
42+
color: Zeta.of(context).colors.surfacePrimary,
43+
border: Border.all(color: colors.blue.shade50, width: 3),
44+
),
45+
padding: EdgeInsets.all(ZetaSpacing.b),
46+
child: Text(
47+
rad.radiusString.split('.').last.capitalize(),
48+
style: ZetaTextStyles.titleMedium.apply(
49+
color: Zeta.of(context).colors.textDefault,
50+
fontStyle: FontStyle.normal,
51+
decoration: TextDecoration.none,
52+
),
53+
),
54+
),
55+
),
56+
);
57+
})
58+
.divide(const SizedBox(height: ZetaSpacing.l))
59+
.toList(),
60+
),
61+
],
62+
),
63+
),
64+
);
65+
}
66+
}
67+
68+
extension on BorderRadius {
69+
String get radiusString {
70+
if (topLeft.x == 0) return 'ZetaRadius.none';
71+
if (topLeft.x == 4) return 'ZetaRadius.minimal';
72+
if (topLeft.x == 8) return 'ZetaRadius.rounded';
73+
if (topLeft.x == 24) return 'ZetaRadius.wide';
74+
return 'ZetaRadius.full';
75+
}
76+
}

0 commit comments

Comments
 (0)