Skip to content

Commit

Permalink
Merge pull request #118 from takenet/release/0.0.41
Browse files Browse the repository at this point in the history
Release/0.0.41
  • Loading branch information
githubdoandre authored Mar 31, 2023
2 parents f77ed71 + 3e21406 commit c0fa5e7
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.0.41

* [DSProgressBar] Added animation in progress bar.

## 0.0.40

* [DSProgressBar] Created the widget.
Expand Down
77 changes: 75 additions & 2 deletions lib/src/widgets/utils/ds_progress_bar.widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class DSProgressBar extends StatelessWidget {
return Container(
width: width,
padding: const EdgeInsets.all(1.5),
height: 18.0,
height: 17.0,
decoration: BoxDecoration(
color: Colors.transparent,
border: Border.all(
Expand All @@ -28,17 +28,90 @@ class DSProgressBar extends StatelessWidget {
child: Stack(
children: [
Container(
padding: const EdgeInsets.symmetric(horizontal: 2.0),
width: width * value / 100,
height: 18.0,
decoration: const BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(10.0),
),
color: DSColors.primaryMain,
),
child: AnimatedBarWidget(
width: MediaQuery.of(context).size.width,
),
),
],
),
);
}
}

class AnimatedBarWidget extends StatefulWidget {
final double width;

const AnimatedBarWidget({
super.key,
required this.width,
});

@override
State<AnimatedBarWidget> createState() => _AnimatedBarWidgetState();
}

class _AnimatedBarWidgetState extends State<AnimatedBarWidget>
with SingleTickerProviderStateMixin {
late final AnimationController animationController;
late final Animation<Offset> slideAnimation;

@override
void initState() {
super.initState();

animationController = AnimationController(
vsync: this,
duration: const Duration(milliseconds: 150),
);

slideAnimation = Tween<Offset>(
begin: Offset.zero,
end: const Offset(-1, 0),
).animate(
CurvedAnimation(
parent: animationController,
curve: Curves.easeIn,
),
);

animationController.repeat();
}

@override
Widget build(BuildContext context) {
return ListView(
padding: EdgeInsets.zero,
scrollDirection: Axis.horizontal,
children: List<Widget>.generate(
widget.width ~/ 5,
(_) => SlideTransition(
textDirection: TextDirection.rtl,
position: slideAnimation,
child: Text(
'/',
style: TextStyle(
color: Colors.black.withOpacity(0.2),
fontSize: 14.0,
height: 1.0,
),
textAlign: TextAlign.justify,
),
),
),
);
}

@override
void dispose() {
animationController.dispose();
super.dispose();
}
}
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: blip_ds
description: Blip Design System for Flutter.
version: 0.0.40
version: 0.0.41
homepage: https://github.com/takenet/blip-ds-flutter#readme
repository: https://github.com/takenet/blip-ds-flutter

Expand Down
2 changes: 1 addition & 1 deletion sample/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.0.38"
version: "0.0.41"
boolean_selector:
dependency: transitive
description:
Expand Down

0 comments on commit c0fa5e7

Please sign in to comment.