Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat : Progress Circle upload #97

Closed
wants to merge 51 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
1fe3bfc
Component dialog (#18)
atanasyordanov21 Apr 12, 2024
dfe4dd6
feat(main): AppBar (#19)
thelukewalton Apr 12, 2024
d66cc3c
Component dialog (#22)
atanasyordanov21 Apr 12, 2024
7a5dabb
Merge branch 'ZebraDevs:main' into main
thelukewalton Apr 12, 2024
b2d8022
Component phone input (#21)
atanasyordanov21 Apr 16, 2024
b53a177
restore main.dart in example (#23)
atanasyordanov21 Apr 16, 2024
a950ea5
Component phone input (#24)
atanasyordanov21 Apr 16, 2024
8c8650a
Component phone input (#25)
atanasyordanov21 Apr 16, 2024
2f82ae1
Navigation rail (#27)
atanasyordanov21 Apr 19, 2024
e206aa6
Component tooltip (#31)
atanasyordanov21 Apr 22, 2024
f0a8aae
feat(main): Segmented control (#26)
sd-athlon Apr 22, 2024
3facff6
Component phone input (#28)
atanasyordanov21 Apr 23, 2024
93f3dae
use ZetaWidgetSize from enums.dart (#32)
atanasyordanov21 Apr 23, 2024
4c2f908
Component tooltip (#33)
atanasyordanov21 Apr 23, 2024
a9e2a8e
Component search bar (#29)
atanasyordanov21 Apr 23, 2024
0b6f620
Component phone input (#34)
atanasyordanov21 Apr 23, 2024
15b20a4
Merge branch 'ZebraDevs:main' into main
thelukewalton Apr 25, 2024
0325001
Select input (#35)
atanasyordanov21 Apr 26, 2024
766c637
Select input (#35)
atanasyordanov21 Apr 26, 2024
d2eb46e
Filter Selection (#36)
atanasyordanov21 Apr 29, 2024
4dbdeb8
ZetaScreenHeaderBar (#39)
atanasyordanov21 Apr 29, 2024
8608323
merge
Apr 29, 2024
3a42dde
feat : Avatar update (#30)
ahmed-osman3 Apr 30, 2024
9972802
feat(main): Contact List (#40)
sd-athlon Apr 30, 2024
b20080a
feat(main): Chat Item (#37)
sd-athlon Apr 30, 2024
6e6f7ee
Merge branch 'main' of https://github.com/zebrafed/zeta_flutter
Apr 30, 2024
c9878a6
Update banners (#41)
atanasyordanov21 Apr 30, 2024
06ddad2
Merge branch 'main' of https://github.com/zebrafed/zeta_flutter
May 1, 2024
2da6aec
feat: Global Header (#38)
ahmed-osman3 May 8, 2024
b25a469
fix: Button update (#42)
ahmed-osman3 May 9, 2024
82f8f1e
Merge remote-tracking branch 'upstream/main'
thelukewalton May 15, 2024
c9b0625
Merge
May 20, 2024
b63c589
Merge branch 'ZebraDevs:main' into main
thelukewalton May 20, 2024
6d1d096
Merge
May 22, 2024
ce15f1c
Merge branch 'ZebraDevs:main' into main
thelukewalton May 24, 2024
dca1f28
feat: Update project colors (#43)
ahmed-osman3 May 24, 2024
ab053f6
chore: Add deprecation warning on breaking colors (#44)
thelukewalton May 24, 2024
c3953e1
Merge branch 'main' of https://github.com/zebrafed/zeta_flutter
May 29, 2024
e4ed2fd
fix: Dropdown focused behavior (#46)
ahmed-osman3 Jun 3, 2024
9f3da3b
feat: Notification list item (#45)
ahmed-osman3 Jun 3, 2024
1439976
fix: Spacings + Radii tokens (#48)
ahmed-osman3 Jun 3, 2024
554db21
build: merge from upstream (#48)
thelukewalton Jun 4, 2024
f1a3d5f
Merge
Jun 5, 2024
3e805b9
Merge branch 'ZebraDevs:main' into main
thelukewalton Jun 5, 2024
2bcb80b
Merge branch 'main' of https://github.com/zebrafed/zeta_flutter
Jun 6, 2024
e1284cd
chore: organise (#49)
thelukewalton Jun 6, 2024
b989693
fix: Dropdown rendering direction (#50)
ahmed-osman3 Jun 6, 2024
a73ed0f
Merge branch 'main' of https://github.com/zebrafed/zeta_flutter
Jun 10, 2024
407e9b2
Remove app bar
Jun 10, 2024
908425c
Merge conflicts resolution
Jun 11, 2024
510fc27
Create upload progress circle
Jun 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@ Widget progressCircleUseCase(BuildContext context) => WidgetbookTestWidget(
options: ZetaCircleSizes.values,
labelBuilder: enumLabelBuilder,
),
onCancel: context.knobs.boolean(label: "Can Cancel") ? () {} : null,
),
);
74 changes: 73 additions & 1 deletion lib/src/components/progress/progress_circle.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class ZetaProgressCircle extends ZetaProgress {
super.progress = 0,
this.size = ZetaCircleSizes.xl_1,
this.rounded = true,
this.onCancel,
});

///Size of [ZetaProgressCircle]
Expand All @@ -39,6 +40,9 @@ class ZetaProgressCircle extends ZetaProgress {
///{@macro zeta-component-rounded}
final bool rounded;

/// Cancel function => cancel upload.
final VoidCallback? onCancel;

@override
State<ZetaProgressCircle> createState() => ZetaProgressCircleState();

Expand All @@ -48,14 +52,42 @@ class ZetaProgressCircle extends ZetaProgress {
properties
..add(EnumProperty<ZetaCircleSizes>('size', size))
..add(DoubleProperty('progress', progress))
..add(DiagnosticsProperty<bool>('rounded', rounded));
..add(DiagnosticsProperty<bool>('rounded', rounded))
..add(ObjectFlagProperty<VoidCallback?>.has('onCancel', onCancel));
}
}

///Class definition for [ZetaProgressCircleState]
class ZetaProgressCircleState extends ZetaProgressState<ZetaProgressCircle> {
final _controller = WidgetStatesController();

@override
void initState() {
super.initState();
_controller.addListener(() {
if (context.mounted && mounted && !_controller.value.contains(WidgetState.hovered)) {
setState(() {});
}
});
}

@override
void dispose() {
_controller.dispose();
super.dispose();
}

@override
Widget build(BuildContext context) {
final textVal = '${(widget.progress * 100).round()}%';
final colors = Zeta.of(context).colors;
final textWidget = Text(
textVal,
style: widget.size != ZetaCircleSizes.s
? ZetaTextStyles.labelSmall
: ZetaTextStyles.labelSmall.copyWith(fontSize: ZetaSpacing.small),
);

return ConstrainedBox(
constraints: BoxConstraints.tight(_getSize()),
child: AnimatedBuilder(
Expand All @@ -68,6 +100,46 @@ class ZetaProgressCircleState extends ZetaProgressState<ZetaProgressCircle> {
rounded: widget.rounded,
colors: Zeta.of(context).colors,
),
child: Center(
child: widget.size == ZetaCircleSizes.xs
? null
: widget.onCancel != null
? ListenableBuilder(
listenable: _controller,
builder: (context, _) {
return MouseRegion(
onEnter: (hover) {
if (mounted) {
_controller.update(WidgetState.hovered, true);
}
},
onExit: (hover) {
_controller.update(WidgetState.hovered, false);
},
child: _controller.value.contains(WidgetState.hovered)
? InkWell(
enableFeedback: false,
onTap: widget.onCancel,
borderRadius: ZetaRadius.full,
child: Container(
decoration: BoxDecoration(
color: colors.surfaceHover,
borderRadius: ZetaRadius.full,
),
padding: const EdgeInsets.all(ZetaSpacing.small),
child: Icon(
widget.rounded ? ZetaIcons.close_round : ZetaIcons.close_sharp,
size:
widget.size == ZetaCircleSizes.s ? ZetaSpacing.medium : ZetaSpacing.large,
),
),
)
: textWidget,
);
},
)
: textWidget,
),
);
},
),
Expand Down
Loading