diegoveloper / flutter_percent_indicator

Flutter percent indicator library
BSD 2-Clause "Simplified" License
679 stars 206 forks source link

Linear progress animation not showing #103

Closed Atikur-Rahman-Sabuj closed 3 years ago

Atikur-Rahman-Sabuj commented 3 years ago

@diegoveloper Thanks for the amazing package. For LinearPercentIndicator when I changing the percent value animation is showing from beginning not for only the progress. My implementation

`import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:percent_indicator/linear_percent_indicator.dart';

class MyProgressIndicator extends StatelessWidget {
  final int total;
  final int progress;

  const MyProgressIndicator({Key key, this.total, this.progress})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return LinearPercentIndicator(
      percent: progress / total,
      lineHeight: 20.0,
      progressColor: Colors.blue,
      linearStrokeCap: LinearStrokeCap.roundAll,
      animation: true,
      animationDuration: 1000,
      center: Text(progress.toString() + "/" + total.toString()),
    );
  }
}`
diegoveloper commented 3 years ago

Hello, did you try using the animateFromLastPercent as true ? https://github.com/diegoveloper/flutter_percent_indicator/blob/master/lib/linear_percent_indicator.dart#L49

Atikur-Rahman-Sabuj commented 3 years ago

Thanks, it's working with animateFromLastPercent as true. Sorry unfortunately I did not see that property. Also I think this should be the default behavior.