Timer with tickCount stays finished after start() or reset()
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 66/100
Hướng nghiên cứu
Bắt đầu với phần triển khai Timer và các bài kiểm thử, tìm reset(), start(), stop() và _callTicker; issue nêu bộ đếm tick và hành vi khi đạt đến giới hạn. Tái hiện ví dụ với tickCount: 2, sau đó kiểm tra rằng việc khởi động lại và đặt lại cho phép thêm hai tick, đồng thời bộ hẹn giờ báo finished sau khi đạt giới hạn.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
What happened?
A Timer (or TimerComponent) with tickCount never resets its tick counter. start(), stop() and reset() only set current back to 0, so once the timer has ticked tickCount times:
finishedis stilltrueright afterstart(), even though the timer is running again. ATimerComponentwithremoveOnFinish: trueis removed on its next update.- The restarted timer ticks once and stops, instead of ticking
tickCounttimes again.
reset() part way through has the same problem: the ticks counted before the reset still count towards the limit.
What do you expect?
start() starts the timer from 0, as its docs say, so it should tick tickCount times again and not be finished until it has. reset() should also reset the ticks.
How can we reproduce this?
var count = 0;
final timer = Timer(
period: 1,
repeat: true,
tickCount: 2,
onTick: () => count++,
);
timer.update(1.1);
timer.update(1.1);
print(count); // 2
print(timer.finished); // true
timer.start();
print(timer.finished); // true, expected false
timer.update(1.1);
timer.update(1.1);
print(count); // 3, expected 4
What steps should take to fix this?
Reset _currentTick in Timer.reset() (which start() and stop() call). When the tick limit is reached, _callTicker calls stop() today; it would need to set _current to 0 and pause instead, so that the timer still reports finished afterwards.
Affected platforms
All
Other information
Flame main at a0044089 (flame 2.0.0-dev.1), Flutter 3.47.9 stable. tickCount was added in #3552.
Are you interested in working on a PR for this?
- I want to work on this
- Ngôn ngữ chính
- Dart
- Star
- 10.8k
- Fork
- 1.1k
- Merge trung bình
- 2 ngày 4 giờ
- Pull request đã merge (30 ngày)
- 61
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của flame-engine/flame
-
`CameraComponent.follow` follows the local position of a nested targetCó thể đã có người làm @ufrshubham đã nhận 1 ngày trước. Đang mởbug
flame-engine/flame#4238 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`ComponentPool` returns components to the pool while they are still in use, and loses components removed before mountingCó thể đã có người làm @ufrshubham đã nhận 18 ngày trước. Đang mởbug
flame-engine/flame#4191 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Move the flame_studio debugging features to flame_devtoolsCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởenhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
flame-engine/flame#4176 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
discussion enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
flame-engine/flame#4175 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
flame-engine/flame#4174 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của flame-engine/flame
Issue tương tự
-
[feat]: 截图挑选时希望能双击缩略图直接选中/取消Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[体验问题] 新建下载任务时重命名会丢失原文件后缀Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
spotiflacapp/SpotiFLAC-Mobile#935 ·
-
documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
chriskelly/wish-together#193 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area: player feature request
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100