Skip to content

Commit

Permalink
version updated
Browse files Browse the repository at this point in the history
  • Loading branch information
diegoveloper committed Feb 28, 2021
1 parent c020461 commit 38e4e54
Show file tree
Hide file tree
Showing 6 changed files with 122 additions and 80 deletions.
121 changes: 67 additions & 54 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,70 +4,83 @@ on:
push:
branches: [ release ]

jobs:

check_version:
runs-on: ubuntu-latest
name: 'Check Version Tag'
steps:
- uses: actions/checkout@v1
- name: 'Get Latest Version'
id: previoustag
uses: "WyriHaximus/github-action-get-previous-tag@master"
env:
jobs:
check_version:
name: "Check Version Tag"
runs-on: ubuntu-20.04
steps:
-
uses: actions/checkout@v1
-
continue-on-error: true
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
continue-on-error: true
- name: 'Print Latest Version'
run: echo ${{ steps.previoustag.outputs.tag }}
- name: 'Get New Version'
id: previoustag
name: "Get Latest Version"
uses: WyriHaximus/github-action-get-previous-tag@master
-
name: "Print Latest Version"
run: "echo ${{ steps.previoustag.outputs.tag }}"
-
id: config
uses: CumulusDS/[email protected]
with:
name: "Get New Version"
uses: CumulusDS/[email protected]
with:
file: pubspec.yaml
version_name: version
- name: 'Print New Version'
run: echo ${{ steps.config.outputs.version_name }}
- name: 'Compare Vresion'
if: steps.config.outputs.version_name == steps.previoustag.outputs.tag
-
name: "Print New Version"
run: "echo ${{ steps.config.outputs.version_name }}"
-
if: "steps.config.outputs.version_name == steps.previoustag.outputs.tag"
name: "Compare Vresion"
run: |
echo 'The version from your pubspec.yaml is the same as Release, Please update the version'
exit 1
- shell: bash
run: |
echo ${{ steps.config.outputs.version_name }} > version.txt
- name: 'Upload New Version'
-
run: "echo ${{ steps.config.outputs.version_name }} > version.txt\n"
shell: bash
-
name: "Upload New Version"
uses: actions/upload-artifact@v1
with:
with:
name: home
path: version.txt

publish:
needs: [check_version]
runs-on: ubuntu-latest
steps:
- name: Checkout
path: version.txt
publish:
needs:
- check_version
runs-on: ubuntu-20.04
steps:
-
name: Checkout
uses: actions/checkout@v1
- name: 'Publish Package'
-
name: "Publish Package"
uses: ilteoood/actions-flutter-pub-publisher@master
with:
credential: ${{secrets.CREDENTIAL_JSON}}
with:
credential: "${{secrets.CREDENTIAL_JSON}}"
dry_run: false
flutter_package: true
skip_test: true
dry_run: false

tag:
needs: [publish]
name: 'Tag Version'
runs-on: ubuntu-latest
steps:
- name: 'Download New Version'
uses: actions/download-artifact@v1
with:
name: home
- name: Set and Tag the new version
shell: bash
run: echo "::set-env name=RELEASE_VERSION::$(cat home/version.txt)"
- uses: tvdias/[email protected]
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
tag: ${{env.RELEASE_VERSION}}
tag:
name: "Tag Version"
needs:
- publish
runs-on: ubuntu-20.04
steps:
-
name: "Download New Version"
uses: actions/download-artifact@v1
with:
name: home
-
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: "true"
name: "Set and Tag the new version"
run: "echo \"::set-env name=RELEASE_VERSION::$(cat home/version.txt)\""
shell: bash
-
uses: tvdias/[email protected]
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
tag: "${{env.RELEASE_VERSION}}"
3 changes: 2 additions & 1 deletion example/lib/sample_circular_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,8 @@ class _SampleCircularPageState extends State<SampleCircularPage> {
),
circularStrokeCap: CircularStrokeCap.round,
progressColor: Colors.blueAccent,
onAnimationEnd: () => setState(() => state = 'End Animation at 50%'),
onAnimationEnd: () =>
setState(() => state = 'End Animation at 50%'),
),
const SizedBox(height: 20),
CircularPercentIndicator(
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ packages:
source: hosted
version: "2.1.0-nullsafety.3"
sdks:
dart: ">=2.10.0-110 <2.11.0"
dart: ">=2.10.5 <2.11.0"
70 changes: 49 additions & 21 deletions lib/circular_percent_indicator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ class CircularPercentIndicator extends StatefulWidget {
this.fillColor = Colors.transparent,
this.backgroundColor = const Color(0xFFB8C7CB),
Color progressColor,
this.backgroundWidth = -1, //negative values ignored, replaced with lineWidth
this.backgroundWidth =
-1, //negative values ignored, replaced with lineWidth
this.linearGradient,
this.animation = false,
this.animationDuration = 500,
Expand All @@ -119,7 +120,8 @@ class CircularPercentIndicator extends StatefulWidget {
this.rotateLinearGradient = false})
: super(key: key) {
if (linearGradient != null && progressColor != null) {
throw ArgumentError('Cannot provide both linearGradient and progressColor');
throw ArgumentError(
'Cannot provide both linearGradient and progressColor');
}
_progressColor = progressColor ?? Colors.red;

Expand All @@ -135,7 +137,8 @@ class CircularPercentIndicator extends StatefulWidget {
}

@override
_CircularPercentIndicatorState createState() => _CircularPercentIndicatorState();
_CircularPercentIndicatorState createState() =>
_CircularPercentIndicatorState();
}

class _CircularPercentIndicatorState extends State<CircularPercentIndicator>
Expand All @@ -155,8 +158,9 @@ class _CircularPercentIndicatorState extends State<CircularPercentIndicator>
@override
void initState() {
if (widget.animation) {
_animationController =
AnimationController(vsync: this, duration: Duration(milliseconds: widget.animationDuration));
_animationController = AnimationController(
vsync: this,
duration: Duration(milliseconds: widget.animationDuration));
_animation = Tween(begin: 0.0, end: widget.percent).animate(
CurvedAnimation(parent: _animationController, curve: widget.curve),
)..addListener(() {
Expand All @@ -168,7 +172,8 @@ class _CircularPercentIndicatorState extends State<CircularPercentIndicator>
}
});
_animationController.addStatusListener((status) {
if (widget.onAnimationEnd != null && status == AnimationStatus.completed) {
if (widget.onAnimationEnd != null &&
status == AnimationStatus.completed) {
widget.onAnimationEnd();
}
});
Expand All @@ -180,18 +185,25 @@ class _CircularPercentIndicatorState extends State<CircularPercentIndicator>
}

void _checkIfNeedCancelAnimation(CircularPercentIndicator oldWidget) {
if (oldWidget.animation && !widget.animation && _animationController != null) {
if (oldWidget.animation &&
!widget.animation &&
_animationController != null) {
_animationController.stop();
}
}

@override
void didUpdateWidget(CircularPercentIndicator oldWidget) {
super.didUpdateWidget(oldWidget);
if (oldWidget.percent != widget.percent || oldWidget.startAngle != widget.startAngle) {
if (oldWidget.percent != widget.percent ||
oldWidget.startAngle != widget.startAngle) {
if (_animationController != null) {
_animationController.duration = Duration(milliseconds: widget.animationDuration);
_animation = Tween(begin: widget.animateFromLastPercent ? oldWidget.percent : 0.0, end: widget.percent).animate(
_animationController.duration =
Duration(milliseconds: widget.animationDuration);
_animation = Tween(
begin: widget.animateFromLastPercent ? oldWidget.percent : 0.0,
end: widget.percent)
.animate(
CurvedAnimation(parent: _animationController, curve: widget.curve),
);
_animationController.forward(from: 0.0);
Expand Down Expand Up @@ -231,24 +243,34 @@ class _CircularPercentIndicatorState extends State<CircularPercentIndicator>
radius: (widget.radius / 2) - widget.lineWidth / 2,
lineWidth: widget.lineWidth,
backgroundWidth: //negative values ignored, replaced with lineWidth
widget.backgroundWidth >= 0.0 ? (widget.backgroundWidth) : widget.lineWidth,
widget.backgroundWidth >= 0.0
? (widget.backgroundWidth)
: widget.lineWidth,
arcBackgroundColor: widget.arcBackgroundColor,
arcType: widget.arcType,
reverse: widget.reverse,
linearGradient: widget.linearGradient,
maskFilter: widget.maskFilter,
rotateLinearGradient: widget.rotateLinearGradient),
child: (widget.center != null) ? Center(child: widget.center) : Container(),
child: (widget.center != null)
? Center(child: widget.center)
: Container(),
),
if (widget.widgetIndicator != null && widget.animation)
Positioned.fill(
child: Transform.rotate(
angle: radians((widget.circularStrokeCap != CircularStrokeCap.butt && widget.reverse) ? -15 : 0),
angle: radians(
(widget.circularStrokeCap != CircularStrokeCap.butt &&
widget.reverse)
? -15
: 0),
child: Transform.rotate(
angle: radians((widget.reverse ? -360 : 360) * _percent),
child: Transform.translate(
offset: Offset(
(widget.circularStrokeCap != CircularStrokeCap.butt) ? widget.lineWidth / 2 : 0,
(widget.circularStrokeCap != CircularStrokeCap.butt)
? widget.lineWidth / 2
: 0,
(-widget.radius / 2 + widget.lineWidth / 2),
),
child: widget.widgetIndicator,
Expand Down Expand Up @@ -366,8 +388,8 @@ class CirclePainter extends CustomPainter {
}
}
if (arcType == ArcType.HALF) {
canvas.drawArc(
rectForArc, radians(-90.0 + fixedStartAngle), radians(360 * startAngleFixedMargin), false, _paintBackground);
canvas.drawArc(rectForArc, radians(-90.0 + fixedStartAngle),
radians(360 * startAngleFixedMargin), false, _paintBackground);
} else {
canvas.drawCircle(center, radius, _paintBackground);
}
Expand All @@ -378,7 +400,8 @@ class CirclePainter extends CustomPainter {
if (linearGradient != null) {
if (rotateLinearGradient && progress > 0) {
double correction = 0;
if (_paintLine.strokeCap == StrokeCap.round || _paintLine.strokeCap == StrokeCap.square) {
if (_paintLine.strokeCap == StrokeCap.round ||
_paintLine.strokeCap == StrokeCap.square) {
if (reverse) {
correction = math.atan(_paintLine.strokeWidth / 2 / radius);
} else {
Expand All @@ -387,12 +410,16 @@ class CirclePainter extends CustomPainter {
}
_paintLine.shader = SweepGradient(
transform: reverse
? GradientRotation(radians(-90 - progress + startAngle) - correction)
: GradientRotation(radians(-90.0 + startAngle) - correction),
? GradientRotation(
radians(-90 - progress + startAngle) - correction)
: GradientRotation(
radians(-90.0 + startAngle) - correction),
startAngle: radians(0),
endAngle: radians(progress),
tileMode: TileMode.clamp,
colors: reverse ? linearGradient.colors.reversed.toList() : linearGradient.colors)
colors: reverse
? linearGradient.colors.reversed.toList()
: linearGradient.colors)
.createShader(
Rect.fromCircle(
center: center,
Expand Down Expand Up @@ -433,7 +460,8 @@ class CirclePainter extends CustomPainter {
}

if (reverse) {
final start = radians(360 * startAngleFixedMargin - 90.0 + fixedStartAngle);
final start =
radians(360 * startAngleFixedMargin - 90.0 + fixedStartAngle);
final end = radians(-progress * startAngleFixedMargin);
canvas.drawArc(
Rect.fromCircle(
Expand Down
2 changes: 1 addition & 1 deletion pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,4 @@ packages:
source: hosted
version: "2.1.0-nullsafety.3"
sdks:
dart: ">=2.10.0-110 <2.11.0"
dart: ">=2.10.5 <2.11.0"
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: percent_indicator
description: Library that allows you to display progress widgets based on percentage, can be Circular or Linear, you can also customize it to your needs.
version: 2.1.9+1
version: 2.2-nullsafety.0
homepage: https://www.diegoveloper.com
repository: https://github.com/diegoveloper/flutter_percent_indicator/

Expand All @@ -9,7 +9,7 @@ dependencies:
sdk: flutter

environment:
sdk: ">=2.7.0 <3.0.0"
sdk: '>=2.12.0-29.10.beta <3.0.0'

dev_dependencies:
flutter_test:
Expand Down

0 comments on commit 38e4e54

Please sign in to comment.