Skip to content

Commit

Permalink
Releases v2.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
davigmacode committed Jun 5, 2024
1 parent 5f2cb53 commit ea1fde2
Show file tree
Hide file tree
Showing 6 changed files with 123 additions and 29 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.2.0

* Added option to draw cross and optionally draw dash.

## 2.1.0

* Improved api doc
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ Easy way to displaying, animating, and styling checkmark icon.

* Animated check/uncheck/undetermined by boolean value or double value.
* Animated color, weight, and size.
* Rounded or sharpen style.
* Rounded or sharpen line style.
* Optionally draw cross for falsy value.
* Optionally undraw dash for undetermined value.

## Usage

Expand All @@ -26,6 +28,8 @@ AnimatedCheckmark(
value: true,
size: 12,
color: Colors.blue,
drawCross: true,
drawDash: false,
);
// animate by progress value [-1.0 to 1.0]
Expand Down
138 changes: 112 additions & 26 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ class MyHomePage extends StatefulWidget {
class _MyHomePageState extends State<MyHomePage> {
double _size = 50;
bool? _active = true;
bool _rounded = true;
bool _rounded = false;
bool _drawCross = false;
bool _drawDash = true;
Color? _color;

void setActive(bool? value) {
Expand All @@ -43,6 +45,14 @@ class _MyHomePageState extends State<MyHomePage> {
setState(() => _rounded = value);
}

void setDrawCross(bool value) {
setState(() => _drawCross = value);
}

void setDrawDash(bool value) {
setState(() => _drawDash = value);
}

void setColor(Color color) {
setState(() => _color = color);
}
Expand All @@ -62,16 +72,32 @@ class _MyHomePageState extends State<MyHomePage> {
const Padding(
padding: EdgeInsets.fromLTRB(0, 50, 0, 35),
child: Center(
child: WxText.displaySmall('AnimatedCheckmark'),
child: WxText.displayMedium(
'AnimatedCheckmark',
gradient: LinearGradient(
colors: [
Colors.green,
Colors.blue,
],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
fontWeight: FontWeight.bold,
letterSpacing: -2,
),
),
),
ColoredBox(
color: Colors.yellow.shade100,
child: AnimatedCheckmark(
duration: const Duration(milliseconds: 250),
curve: Curves.linear,
value: _active,
size: _size,
color: _color,
rounded: _rounded,
drawCross: _drawCross,
drawDash: _drawDash,
),
),
const SizedBox(height: 20),
Expand All @@ -87,39 +113,68 @@ class _MyHomePageState extends State<MyHomePage> {
),
const SizedBox(height: 20),
Wrap(
spacing: 5,
spacing: 10,
children: [
OutlinedButton(
onPressed: () {
setActive(true);
},
child: const Text('CHECK'),
StackedCheckmark(
value: _active == true,
child: OutlinedButton(
onPressed: () => setActive(true),
child: const Text('CHECK'),
),
),
OutlinedButton(
onPressed: () {
setActive(false);
},
child: const Text('UNCHECK'),
StackedCheckmark(
value: _active == false,
child: OutlinedButton(
onPressed: () => setActive(false),
child: const Text('UNCHECK'),
),
),
OutlinedButton(
onPressed: () {
setActive(null);
},
child: const Text('UNDETERMINED'),
StackedCheckmark(
value: _active == null,
child: OutlinedButton(
onPressed: () => setActive(null),
child: const Text('UNDETERMINED'),
),
),
],
),
const SizedBox(height: 20),
const SizedBox(height: 10),
Wrap(
spacing: 10,
children: [
StackedCheckmark(
value: _drawCross,
child: OutlinedButton(
onPressed: () => setDrawCross(!_drawCross),
child: const Text('DRAW CROSS'),
),
),
StackedCheckmark(
value: _drawDash,
child: OutlinedButton(
onPressed: () => setDrawDash(!_drawDash),
child: const Text('DRAW DASH'),
),
),
],
),
const SizedBox(height: 10),
Wrap(
spacing: 5,
spacing: 10,
children: [
OutlinedButton(
onPressed: () => setRounded(true),
child: const Text('ROUNDED'),
StackedCheckmark(
value: _rounded == true,
child: OutlinedButton(
onPressed: () => setRounded(true),
child: const Text('ROUNDED'),
),
),
OutlinedButton(
onPressed: () => setRounded(false),
child: const Text('SHARPEN'),
StackedCheckmark(
value: _rounded == false,
child: OutlinedButton(
onPressed: () => setRounded(false),
child: const Text('SHARPEN'),
),
),
],
),
Expand Down Expand Up @@ -159,3 +214,34 @@ class _MyHomePageState extends State<MyHomePage> {
);
}
}

class StackedCheckmark extends StatelessWidget {
const StackedCheckmark({
super.key,
this.value,
required this.child,
});

final bool? value;
final Widget child;

@override
Widget build(BuildContext context) {
return Stack(
clipBehavior: Clip.none,
children: [
child,
Positioned(
top: -8,
right: -8,
child: AnimatedCheckmark(
value: value,
color: Colors.blueGrey,
weight: 5,
size: 32,
),
),
],
);
}
}
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ packages:
path: ".."
relative: true
source: path
version: "2.0.1"
version: "2.2.0"
animated_repeatable:
dependency: transitive
description:
Expand Down
Binary file modified media/preview.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: animated_checkmark
description: Easy way to displaying, animating, and styling checkmark icon.
version: 2.1.0
version: 2.2.0
homepage: https://davigmacode.github.io/flutter_animated_checkmark
repository: https://github.com/davigmacode/flutter_animated_checkmark

Expand Down

0 comments on commit ea1fde2

Please sign in to comment.