FlutterCountdownTimer icon indicating copy to clipboard operation
FlutterCountdownTimer copied to clipboard

Undefined class 'CurrentRemainingTime'.

Open hafidzaini opened this issue 3 years ago • 3 comments

Undefined class 'CurrentRemainingTime'. Try changing the name to the name of an existing class, or creating a class with the name 'CurrentRemainingTime'.

how to set the class? sorry for dumb question 😂

hafidzaini avatar Mar 04 '21 21:03 hafidzaini

Do you mean this?You can post your code if you can. image

wuweijian1997 avatar Mar 06 '21 05:03 wuweijian1997

sample code

CountdownTimer(
            controller: controller,
            widgetBuilder: (_, CurrentRemainingTime? time) {
              if (time == null) {
                return Text('Game over');
              }
              return Text(
                  'days: [ ${time.days} ], hours: [ ${time.hours} ], min: [ ${time.min} ], sec: [ ${time.sec} ]');
            },
          ),

my code

                                            Expanded(
                                                flex: 3,
                                                        child: CountdownTimer(
                                                          endTime: DateTime.parse(
                                                                  todaylist[
                                                                      "date"])
                                                              .toLocal()
                                                              .millisecondsSinceEpoch,
                                                        ))

sample

i want to replace : with custom text i want to show text like 00 hours 10 minutes 42 seconds more

hafidzaini avatar Mar 10 '21 17:03 hafidzaini

CountdownTimer( controller: controller, widgetBuilder: (_, CurrentRemainingTime? time) { if (time == null) { return Text('Game over'); } var text = ''; if(time.days != null) { text = '${time.days} days'; } text += '${time.hours ?? '00'} hours ${time.min} minutes ${time.sec} seconds'; ///00 hours 10 minutes 42 seconds return Text(text); }, ),

wuweijian1997 avatar Mar 11 '21 06:03 wuweijian1997