Skip to content

Commit

Permalink
[automated commit] lint format and import sort
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Mar 7, 2024
1 parent 549f168 commit 6c3143e
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 63 deletions.
35 changes: 11 additions & 24 deletions example/lib/pages/components/button_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,10 @@ class _ButtonExampleState extends State<ButtonExample> {
Column(
children: groupButtons(ZetaWidgetBorder.rounded),
),
Text('Floating Action Buttons',
style: ZetaTextStyles.displayMedium),
Text('Tap buttons to change current FAB: ',
style: ZetaTextStyles.bodyMedium),
Wrap(
children:
fabs.divide(SizedBox.square(dimension: 10)).toList()),
]
.divide(const SizedBox.square(dimension: ZetaSpacing.m))
.toList(),
Text('Floating Action Buttons', style: ZetaTextStyles.displayMedium),
Text('Tap buttons to change current FAB: ', style: ZetaTextStyles.bodyMedium),
Wrap(children: fabs.divide(SizedBox.square(dimension: 10)).toList()),
].divide(const SizedBox.square(dimension: ZetaSpacing.m)).toList(),
),
),
Expanded(child: const SizedBox()),
Expand Down Expand Up @@ -178,21 +172,15 @@ class _ButtonExampleState extends State<ButtonExample> {

List<Widget> groupButtons(ZetaWidgetBorder) {
return [
ZetaButtonGroup(
isLarge: true,
rounded: true,
buttons: [
ZetaButtonGroup(isLarge: true, rounded: true, buttons: [
GroupButton(
label: "Label",
),
GroupButton(
label: "Label",
),
]),
ZetaButtonGroup(
isLarge: true,
rounded: true,
buttons: [
ZetaButtonGroup(isLarge: true, rounded: true, buttons: [
GroupButton(
label: "Label",
),
Expand All @@ -202,8 +190,8 @@ class _ButtonExampleState extends State<ButtonExample> {
),
]),
ZetaButtonGroup(
isLarge: true,
rounded: true,
isLarge: true,
rounded: true,
buttons: [
GroupButton.icon(
icon: ZetaIcons.star_round,
Expand All @@ -214,22 +202,21 @@ class _ButtonExampleState extends State<ButtonExample> {
label: "Label",
),
GroupButton.icon(

icon: ZetaIcons.star_round,
label: "Label",
),
],
),
ZetaButtonGroup(
isLarge: true,
rounded: true,
rounded: true,
buttons: [
GroupButton.icon(
GroupButton.icon(
icon: ZetaIcons.star_round,
label: "Label",
onPressed: () {},
),
GroupButton.icon(
GroupButton.icon(
icon: ZetaIcons.star_round,
label: "Label",
onPressed: () {},
Expand Down
16 changes: 4 additions & 12 deletions example/lib/pages/components/progress_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,7 @@ class ProgressExampleState extends State<ProgressExample> {
SizedBox(
height: 20,
),
Wrapper(
stepsCompleted: 0,
type: ZetaProgressBarType.standard,
isThin: false,
stateChangeable: true),
Wrapper(stepsCompleted: 0, type: ZetaProgressBarType.standard, isThin: false, stateChangeable: true),
SizedBox(
height: 20,
),
Expand Down Expand Up @@ -118,9 +114,7 @@ class _WrapperState extends State<Wrapper> {

void setLoading() {
setState(() {
type = type == ZetaProgressBarType.buffering
? ZetaProgressBarType.standard
: ZetaProgressBarType.buffering;
type = type == ZetaProgressBarType.buffering ? ZetaProgressBarType.standard : ZetaProgressBarType.buffering;
});
}

Expand Down Expand Up @@ -150,13 +144,11 @@ class _WrapperState extends State<Wrapper> {
mainAxisAlignment: MainAxisAlignment.center,
children: [
widget.type != ZetaProgressBarType.indeterminate
? FilledButton(
onPressed: increasePercentage, child: Text("Increase"))
? FilledButton(onPressed: increasePercentage, child: Text("Increase"))
: Container(),
const SizedBox(width: 40),
widget.stateChangeable!
? FilledButton(
onPressed: setLoading, child: Text("Start Buffering"))
? FilledButton(onPressed: setLoading, child: Text("Start Buffering"))
: SizedBox.shrink()
],
)
Expand Down
15 changes: 5 additions & 10 deletions lib/src/components/buttons/button_style.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ extension ButtonFunctions on ZetaButtonType {
}

/// Returns if button has border
bool get border =>
this == ZetaButtonType.outline || this == ZetaButtonType.outlineSubtle;
bool get border => this == ZetaButtonType.outline || this == ZetaButtonType.outlineSubtle;

///Returns if button is solid
bool get solid => index < 4;
Expand Down Expand Up @@ -86,9 +85,8 @@ ButtonStyle buttonStyle(
ZetaButtonType type,
Color? backgroundColor,
) {
final ZetaColorSwatch color = backgroundColor != null
? ZetaColorSwatch.fromColor(backgroundColor)
: type.color(colors);
final ZetaColorSwatch color =
backgroundColor != null ? ZetaColorSwatch.fromColor(backgroundColor) : type.color(colors);

final bool isSolid = type.solid || backgroundColor != null;

Expand Down Expand Up @@ -131,8 +129,7 @@ ButtonStyle buttonStyle(
}
},
),
overlayColor:
MaterialStateProperty.resolveWith((Set<MaterialState> states) {
overlayColor: MaterialStateProperty.resolveWith((Set<MaterialState> states) {
return null;
}),
side: MaterialStateProperty.resolveWith((Set<MaterialState> states) {
Expand All @@ -145,9 +142,7 @@ ButtonStyle buttonStyle(
}
if (type.border) {
return BorderSide(
color: type == ZetaButtonType.outline
? colors.primary.border
: colors.borderDefault,
color: type == ZetaButtonType.outline ? colors.primary.border : colors.borderDefault,
);
}

Expand Down
4 changes: 3 additions & 1 deletion lib/src/components/progress/progress.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ abstract class ZetaProgressState<T extends ZetaProgress> extends State<T> with T
super.initState();
progress = widget.progress;
controller = AnimationController(
vsync: this, duration: const Duration(milliseconds: 200),);
vsync: this,
duration: const Duration(milliseconds: 200),
);
animation = Tween<double>(
begin: widget.progress, // Start value
end: widget.progress, // End value (initially same as start value)
Expand Down
22 changes: 9 additions & 13 deletions lib/src/components/progress/progress_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@ class _ZetaProgressBarState extends ZetaProgressState<ZetaProgressBar> {
children: [
Text(
widget.label ??
(widget.label == null &&
widget.type != ZetaProgressBarType.indeterminate
(widget.label == null && widget.type != ZetaProgressBarType.indeterminate
? '${(animation.value * 100).toInt()}%'
: ''),
style: ZetaTextStyles.titleMedium,
Expand All @@ -115,26 +114,21 @@ class _ZetaProgressBarState extends ZetaProgressState<ZetaProgressBar> {
height: _weight,
child: LinearProgressIndicator(
borderRadius: _border,
value: widget.type == ZetaProgressBarType.indeterminate
? null
: animation.value,
backgroundColor: widget.type == ZetaProgressBarType.buffering
? colors.surfaceDisabled
: Colors.transparent,
value: widget.type == ZetaProgressBarType.indeterminate ? null : animation.value,
backgroundColor:
widget.type == ZetaProgressBarType.buffering ? colors.surfaceDisabled : Colors.transparent,
),
),
),
if (widget.type == ZetaProgressBarType.buffering)
bufferingWidget(colors),
if (widget.type == ZetaProgressBarType.buffering) bufferingWidget(colors),
],
),
],
);
}

/// Returns border based on widgets border type.
BorderRadius get _border =>
widget.rounded ? ZetaRadius.rounded : ZetaRadius.none;
BorderRadius get _border => widget.rounded ? ZetaRadius.rounded : ZetaRadius.none;

/// Returns thickness of progress bar based on its weight.
double get _weight => widget.isThin ? ZetaSpacing.x2 : ZetaSpacing.x4;
Expand All @@ -148,7 +142,9 @@ class _ZetaProgressBarState extends ZetaProgressState<ZetaProgressBar> {
width: _weight,
height: _weight,
decoration: BoxDecoration(
color: colors.surfaceDisabled, borderRadius: ZetaRadius.rounded,),
color: colors.surfaceDisabled,
borderRadius: ZetaRadius.rounded,
),
),
],
);
Expand Down
5 changes: 2 additions & 3 deletions lib/src/components/progress/progress_circle.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class ZetaProgressCircle extends ZetaProgress {
///Size of [ZetaProgressCircle]
final ZetaCircleSizes size;

///{@macro zeta-component-rounded}
///{@macro zeta-component-rounded}
final bool rounded;

@override
Expand Down Expand Up @@ -102,7 +102,7 @@ class ZetaProgressCircleState extends ZetaProgressState<ZetaProgressCircle> {
///Class definition for [CirclePainter]
class CirclePainter extends CustomPainter {
///Constructor for [CirclePainter]
CirclePainter({this.progress = 0, this.rounded = true,required this.colors});
CirclePainter({this.progress = 0, this.rounded = true, required this.colors});

///Percentage of progress in decimal value, defaults to 0
final double progress;
Expand All @@ -122,7 +122,6 @@ class CirclePainter extends CustomPainter {
if (rounded) _paint.strokeCap = StrokeCap.round;
_paint.color = colors.primary;


const double fullCircle = 2 * math.pi;

canvas.drawArc(
Expand Down

0 comments on commit 6c3143e

Please sign in to comment.