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 Feb 29, 2024
1 parent 6a40faa commit 7ac5917
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 66 deletions.
15 changes: 4 additions & 11 deletions example/lib/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ final List<Component> components = [
Component(ButtonExample.name, (context) => const ButtonExample()),
Component(CheckBoxExample.name, (context) => const CheckBoxExample()),
Component(ChipExample.name, (context) => const ChipExample()),
Component(
PasswordInputExample.name, (context) => const PasswordInputExample()),
Component(PasswordInputExample.name, (context) => const PasswordInputExample()),
Component(ProgressExample.name, (context) => const ProgressExample())
];

Expand Down Expand Up @@ -96,27 +95,21 @@ class _HomeState extends State<Home> {
title: Text('Widgets'),
backgroundColor: Zeta.of(context).colors.warm.shade30,
children: _components
.map((item) => ListTile(
title: Text(item.name),
onTap: () => context.go('/${item.name}')))
.map((item) => ListTile(title: Text(item.name), onTap: () => context.go('/${item.name}')))
.toList(),
),
ExpansionTile(
title: Text('Theme'),
backgroundColor: Zeta.of(context).colors.warm.shade30,
children: _theme
.map((item) => ListTile(
title: Text(item.name),
onTap: () => context.go('/${item.name}')))
.map((item) => ListTile(title: Text(item.name), onTap: () => context.go('/${item.name}')))
.toList(),
),
ExpansionTile(
title: Text('Assets'),
backgroundColor: Zeta.of(context).colors.warm.shade30,
children: _assets
.map((item) => ListTile(
title: Text(item.name),
onTap: () => context.go('/${item.name}')))
.map((item) => ListTile(title: Text(item.name), onTap: () => context.go('/${item.name}')))
.toList(),
),
],
Expand Down
24 changes: 5 additions & 19 deletions example/lib/pages/components/progress_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,7 @@ class ProgressExampleState extends State<ProgressExample> {
SizedBox(
height: 20,
),
Wrapper(
stepsCompleted: 0,
type: ZetaBarType.standard,
isThin: false,
stateChangeable: true),
Wrapper(stepsCompleted: 0, type: ZetaBarType.standard, isThin: false, stateChangeable: true),
SizedBox(
height: 20,
),
Expand Down Expand Up @@ -94,9 +90,7 @@ class _WrapperState extends State<Wrapper> {

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

Expand All @@ -108,25 +102,17 @@ class _WrapperState extends State<Wrapper> {
SizedBox(
width: 400,
child: ZetaProgressBar(
progress: progress,
rounded: widget.rounded,
type: type,
isThin: widget.isThin,
label: widget.label),
progress: progress, rounded: widget.rounded, type: type, isThin: widget.isThin, label: widget.label),
),
const SizedBox(width: 40),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
widget.type != ZetaBarType.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"))
: Container()
widget.stateChangeable ? FilledButton(onPressed: setLoading, child: Text("Start Buffering")) : Container()
],
)
],
Expand Down
6 changes: 2 additions & 4 deletions lib/src/components/progress/progress.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ abstract class ZetaProgress extends StatefulWidget {
/// Super class for [ZetaProgressState]
/// Defines functions that deal with state change of progress value and
/// animation changing.
abstract class ZetaProgressState<T extends ZetaProgress> extends State<T>
with TickerProviderStateMixin {
abstract class ZetaProgressState<T extends ZetaProgress> extends State<T> with TickerProviderStateMixin {
/// Decimal progress value
late double progress;

Expand All @@ -34,8 +33,7 @@ abstract class ZetaProgressState<T extends ZetaProgress> extends State<T>
void initState() {
super.initState();
progress = widget.progress;
controller = AnimationController(
vsync: this, duration: const Duration(milliseconds: 200));
controller = AnimationController(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
44 changes: 12 additions & 32 deletions lib/src/components/progress/progress_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,33 +26,21 @@ class ZetaProgressBar extends ZetaProgress {
required this.rounded,
required this.type,
required this.isThin,
this.label});
this.label,});

/// Constructs a standard progress bar
const ZetaProgressBar.standard(
{super.key,
required super.progress,
this.rounded = true,
this.isThin = false,
this.label})
{super.key, required super.progress, this.rounded = true, this.isThin = false, this.label,})
: type = ZetaBarType.standard;

/// Constructs buffering example
const ZetaProgressBar.buffering(
{super.key,
required super.progress,
this.rounded = true,
this.isThin = false,
this.label})
{super.key, required super.progress, this.rounded = true, this.isThin = false, this.label,})
: type = ZetaBarType.buffering;

/// Constructs indeterminate example
const ZetaProgressBar.indeterminate(
{super.key,
required super.progress,
this.rounded = true,
this.isThin = false,
this.label})
{super.key, required super.progress, this.rounded = true, this.isThin = false, this.label,})
: type = ZetaBarType.indeterminate;

/// Is progress bar rounded or sharp.
Expand Down Expand Up @@ -98,24 +86,20 @@ class _ZetaProgressBarState extends ZetaProgressState<ZetaProgressBar> {
height: _weight,
child: LinearProgressIndicator(
borderRadius: _border,
value: widget.type == ZetaBarType.indeterminate
? null
: animation.value,
backgroundColor: widget.type == ZetaBarType.buffering
? Zeta.of(context).colors.surfaceDisabled
: Colors.transparent,
value: widget.type == ZetaBarType.indeterminate ? null : animation.value,
backgroundColor:
widget.type == ZetaBarType.buffering ? Zeta.of(context).colors.surfaceDisabled : Colors.transparent,
),
),
),
_extraWidgets(),
])
],),
],
);
}

/// 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 ? 8 : 16;
Expand All @@ -128,16 +112,12 @@ class _ZetaProgressBarState extends ZetaProgressState<ZetaProgressBar> {
Container(
width: _weight,
height: _weight,
decoration: const BoxDecoration(
color: Color.fromRGBO(224, 227, 233, 1),
borderRadius: ZetaRadius.rounded),
decoration: const BoxDecoration(color: Color.fromRGBO(224, 227, 233, 1), borderRadius: ZetaRadius.rounded),
),
]);
],);

final Widget extraWidgets = Row(
children: widget.type == ZetaBarType.buffering
? extraList.expand((list) => list).toList()
: [],
children: widget.type == ZetaBarType.buffering ? extraList.expand((list) => list).toList() : [],
);
return extraWidgets;
}
Expand Down

0 comments on commit 7ac5917

Please sign in to comment.