flutter 页面频繁刷新节省页面性能的组件RepaintBoundary

在flutter 页面中,如果存在定时器操作或者人为的 频繁操作setState({});刷新

 页面需要更新的页面结构可以用 RepaintBoundary组件嵌套,flutter 会将包含的组件独立出一层"画布",去绘制。

//频繁刷新的性能节约嵌套组件 RepaintBoundary
 return RepaintBoundary(
      child: Text(
        "${showTime}",
//        softWrap: true,
//        textAlign: TextAlign.left,
//        overflow: TextOverflow.ellipsis,
//        maxLines: 3,
          style: widget.style ?? TextStyleConstant().origin_16,
      ),
  );
源代码的解释 创建隔离重绘的小部件 所以性能可以省很多

原文地址:https://www.cnblogs.com/tianmiaogongzuoshi/p/13274964.html