I m trying to loop time in minutes and seconds to display them as a list on the widget as shown on the picture below. It might be my math problem that causing this or lack of a better way of achieving this, but I have tried and I m stack.
My problem was on capturing the minutes and seconds, like e.g you have 15minutes. and you want then to be displayed like this. [00:00, 00:30, 1:00, 1:30, 2:00, 2:30,3:00, 3:30....15:00],
So the issue is only achieving that.
here the image
void addTime() {
const addSeconds = 1;
setState(() {
int s = 0;
for(int i = 0; i <= Duration(minutes: 15).inMinutes; i++){
timelines.add(buildTime(minute:(i * 60) % 1 * 60.floor(),
sec: i > 0 ? (i * 60).floor() : 0));
}
});
}
So once the app is open then addTime will be called to fill the timelines List[], Then the timelines will be rendered on the build.
Kindly assist in any way possible for me to get this done.