Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined class 'CurrentRemainingTime'. #28

Open
hafidzaini opened this issue Mar 4, 2021 · 3 comments
Open

Undefined class 'CurrentRemainingTime'. #28

hafidzaini opened this issue Mar 4, 2021 · 3 comments

Comments

@hafidzaini
Copy link

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 😂

@wuweijian1997
Copy link
Owner

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

@hafidzaini
Copy link
Author

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

@wuweijian1997
Copy link
Owner

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); }, ),

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

No branches or pull requests

2 participants