Skip to content

Commit

Permalink
fix spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
thelukewalton committed Feb 29, 2024
1 parent 80c35ce commit b0ae50d
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 65 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* benken mikecoomber thelukewalton
* @benken @mikecoomber @thelukewalton
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ class ZetaDialPad extends StatelessWidget {
crossAxisCount: _buttonsPerRow,
shrinkWrap: true,
semanticChildCount: _buttonValues.length,
mainAxisSpacing: ZetaSpacing.x9,
crossAxisSpacing: ZetaSpacing.x8,
mainAxisSpacing: ZetaSpacing.x6,
crossAxisSpacing: ZetaSpacing.x9,
children: _buttonValues.entries
.map(
(e) => _DialPadButton(
Expand Down
2 changes: 1 addition & 1 deletion lib/src/components/progress/progress.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ abstract class ZetaProgressState<T extends ZetaProgress> extends State<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
122 changes: 62 additions & 60 deletions lib/src/components/progress/progress_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,40 +20,41 @@ enum ZetaBarType {
class ZetaProgressBar extends ZetaProgress {
///Constructor for [ZetaProgressBar]
const ZetaProgressBar(
{super.key,
required super.progress,
required this.rounded,
required this.type,
required this.isThin,
this.label});
const ZetaProgressBar({
super.key,
required super.progress,
required this.rounded,
required this.type,
required this.isThin,
this.label,
});

/// Constructs a standard progress bar
const ZetaProgressBar.standard(
{super.key,
required super.progress,
this.rounded = true,
this.isThin = false,
this.label})
: type = ZetaBarType.standard;
const ZetaProgressBar.standard({
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})
: type = ZetaBarType.buffering;
const ZetaProgressBar.buffering({
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})
: type = ZetaBarType.indeterminate;
const ZetaProgressBar.indeterminate({
super.key,
required super.progress,
this.rounded = true,
this.isThin = false,
this.label,
}) : type = ZetaBarType.indeterminate;

/// Is progress bar rounded or sharp.
final bool rounded;
Expand Down Expand Up @@ -91,53 +92,54 @@ class _ZetaProgressBarState extends ZetaProgressState<ZetaProgressBar> {
widget.label!,
textAlign: TextAlign.start,
),
Row(crossAxisAlignment: CrossAxisAlignment.start, children: [
Expanded(
child: AnimatedContainer(
duration: const Duration(milliseconds: 500),
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,
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: AnimatedContainer(
duration: const Duration(milliseconds: 500),
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,
),
),
),
),
_extraWidgets(),
])
_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;

Widget _extraWidgets() {
final Iterable<List<Widget>> extraList = List.filled(3, false).map((e) => [
const SizedBox(
width: 16,
),
Container(
width: _weight,
height: _weight,
decoration: const BoxDecoration(
color: Color.fromRGBO(224, 227, 233, 1),
borderRadius: ZetaRadius.rounded),
final Iterable<List<Widget>> extraList = List.filled(3, false).map(
(e) => [
const SizedBox(
width: 16,
),
Container(
width: _weight,
height: _weight,
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
2 changes: 1 addition & 1 deletion lib/zeta_flutter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export 'src/components/buttons/fab.dart';
export 'src/components/buttons/icon_button.dart';
export 'src/components/checkbox/checkbox.dart';
export 'src/components/chips/chip.dart';
export 'src/components/dial_pad/dial_pad_buttons.dart';
export 'src/components/dial_pad/dial_pad.dart';
export 'src/components/password/password_input.dart';
export 'src/components/progress/progress_bar.dart';
export 'src/theme/color_extensions.dart';
Expand Down

0 comments on commit b0ae50d

Please sign in to comment.