Add Fixed Time Zone Support for NowIndicator#174
Add Fixed Time Zone Support for NowIndicator#174MasterHiei wants to merge 4 commits intoJonasWanke:mainfrom
Conversation
736f39f to
4c133d4
Compare
JonasWanke
left a comment
There was a problem hiding this comment.
Thanks for the contribution, and sorry for the delay! I agree that customizing the current time is a useful feature, but I'd go a bit differently about the implementation:
Instead of having users provide a time zone ID and explicitly requiring the timezone package, I'd just take a DateTime Function() getNow (or with a different name). In the documentation, we can still point to the timezone package, but a getter allows the flexibility to use a different package, using DateTime.now() and adding a fixed offset directly, or even set a fixed time for testing.
|
Thanks for your advice! I'm a bit busy right now, but I'll check it later :) |
…mezone dependency
0b7334c to
0946db6
Compare
| devicePixelRatio != oldDelegate.devicePixelRatio; | ||
|
|
||
| DateTime get _now => | ||
| timeController.getCurrentTime?.call().copyWith(isUtc: true) ?? |
There was a problem hiding this comment.
Ideally, users should provide UTC time according to the package’s original design. However, since this isn’t common practice, handle the conversion internally looks better.
|
@JonasWanke Hi 👋 |
Hi @JonasWanke 👋
First of all, thank you for your awesome package!
I encountered a situation where we needed to set the now indicator with a fixed time zone. To address this, I created this PR.
I also saw that similar functionality is WIP, but I’m hoping to use it as soon as possible, so I decided to go ahead with this solution for now.
Please feel free to review the changes, and I’d love to hear any feedback or suggestions!
Thanks again for your great work!