Skip to content
This repository was archived by the owner on Nov 24, 2020. It is now read-only.

Download progress decimal places pattern #78

Closed
fernando-s97 opened this issue Aug 13, 2020 · 7 comments
Closed

Download progress decimal places pattern #78

fernando-s97 opened this issue Aug 13, 2020 · 7 comments

Comments

@fernando-s97
Copy link

fernando-s97 commented Aug 13, 2020

Is your feature request related to a problem? Please describe.
I need to change the predefined progress text when using .
When displaying the ProgressDialogType.Download, I don't like the fact that that progress shows its complete value. For example:
1/100.0
1.3276872287/100.0
3.82738/100.0

I guess it would be nice to have some way to make it follow a pattern.

Describe the solution you'd like
Two parameters in the constructor to allow defining the decimal places of the current progress (progressDecimalPlaces) and max progress (maxProgressDecimalPlaces).

downloadDialog ??= ProgressDialog(
    context,
    type: ProgressDialogType.Download,
    progressDecimalPlaces: [int],
    maxProgressDecimalPlaces: [int],
  );

Some examples:
progressDecimalPlaces: 0 | maxProgressDecimalPlaces: 0 -> 4/100
progressDecimalPlaces: 0 | maxProgressDecimalPlaces: 2 -> 4/100.00
progressDecimalPlaces: 2 | maxProgressDecimalPlaces: 0 -> 4.25/100
progressDecimalPlaces: 2 | maxProgressDecimalPlaces: 2 -> 4.25/100.00

To allow the default user/dart double.toString() pass -1 as value:

downloadDialog ??= ProgressDialog(
    context,
    type: ProgressDialogType.Download,
    progressDecimalPlaces: -1,
    maxProgressDecimalPlaces: -1,
  );

This would result in the normal behaviour of the lib today: 1.3276872287/100.0

@fayaz07
Copy link
Owner

fayaz07 commented Aug 14, 2020

you can achieve that with something like this

doubleValue.toStringAsFixed(2)

@fayaz07 fayaz07 closed this as completed Aug 14, 2020
@fernando-s97
Copy link
Author

Where?

@fayaz07
Copy link
Owner

fayaz07 commented Aug 19, 2020

progressDialog.update(down..: Double.parse(doubleValue.toStringAsFixed(2)));

@fernando-s97
Copy link
Author

This will correctly show the current progress, but not max progress. It will display something like xx.xx/100.0 - The max progress still displays 1 decimal place.

@fayaz07
Copy link
Owner

fayaz07 commented Aug 22, 2020

you should figure it out bro

@fernando-s97
Copy link
Author

I've figured out. It was just a tip to improve your package...

@fayaz07
Copy link
Owner

fayaz07 commented Aug 22, 2020

thanks @fernando-s97 I will surely update, due to busy schedule I wasn't able to look up on it

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants