Comments (8)
Checked with DevTools' Highlight repaints and found that it seems that this animation causes the whole page to be repaint. Also tried wrapping a RepaintBoundary around it, no effect, still causes the whole page to be repaint
from slide_countdown.
Hi @gaodeng, are you in debug mode? i run it in simulator no issue
Maybe you can try use new version SlideCountdown 2.0.6
from slide_countdown.
Hi @gaodeng, are you in debug mode? i run it in simulator no issue Maybe you can try use new version SlideCountdown 2.0.6
I'm testing the release build of the mac app.
I just tried 0.2.6-dev.1 with SlideDirection.none to remove the animation, and the cpu usage is normal.
However, if the animation is shown, it still takes up a lot of cpu. Through devtools, I can observe that the digit switch animation will cause the whole page to repaint, and when the page is complex, then the cpu usage will be high. But I don't quite understand why that animation will cause the whole page to repaint, maybe it's a bug inside the flutter framework?
from slide_countdown.
@gaodeng i tried it on my macbook air m1, but found no same problem. If the SlideCountdown
widget has animation it shouldn't repaint the whole page. Maybe you did that because there is a setState function in your page
Flutter version: 3.0.1.
from slide_countdown.
@farhanfadila1717 Here is the code to reproduce the problem.
import 'package:flutter/material.dart';
import 'package:slide_countdown/slide_countdown.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key, required this.title}) : super(key: key);
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: const <Widget>[
SlideCountdown(
duration: Duration(days: 2),
)
],
),
),
);
}
}
After running the app, Open flutter devtools and click the Highlight Repaints button in devtools.
CircularProgressIndicator has a similar situation, but it can be solved by wrapping a RepaintBoundary. I tried to wrap SlideCountdown with RepaintBoundary, but unfortunately I found it doesn't work.
Here is the link to the documentation https://docs.flutter.dev/development/tools/devtools/inspector#highlight-repaints
you can check the video below, you will see that the whole page is repainting, not just the small part of SlideCountdown.
Simulator.Screen.Recording.-.iPhone.13.-.2022-06-10.at.10.50.03.mp4
from slide_countdown.
same issue
any update?
from slide_countdown.
fixed in SlideCountdown
lastest version. The older code take a lot of ValueNotifier
, the new version just only listen one stream.
from slide_countdown.
I believe this issue should be reopened. I have tried the latest version, but the problem remains unresolved. This widget still causes the entire page to repaint.
from slide_countdown.
Related Issues (20)
- Restart the counter HOT 1
- streamDuration bug HOT 1
- SlideCountdownSeparated digits are flipped HOT 1
- Error in SlideCountdownSeparated HOT 1
- Text for Days, hours, minutes, sec HOT 2
- FUnction onDone not fired if streamDuration is configure
- Multiple widget used SlideCountdown but dispose widget onchange steal called
- Bad state: Stream has already been listened to HOT 1
- "Bad state: Stream has already been listened to" in 1.0.2 HOT 12
- onDone() in background state HOT 1
- When I run the timer, an unknown number appears and then disappears. HOT 8
- strange behaviour in the count down HOT 3
- When a specific number is changed, the next number is displayed in advance. HOT 2
- restart countdown HOT 1
- Use Listenable instead of Stream
- Incorrect Display of Minutes and Seconds HOT 1
- when the screen is locked
- CountUp bug and accompanying fix code! HOT 2
- How to change the background color
- bug: count down not work properly when TextDirection is RTL
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from slide_countdown.