全局搜索找到_PaintMetrics类的_calculateMetrics()方法,将
_pixelSize = (pixelSize * 2).roundToDouble() / 2;
这一行代码注释掉,然后添加_pixelSize = pixelSize这行代码,完整代码如下:
class _PaintMetrics {
_PaintMetrics({
required this.containerSize,
required this.gapSize,
required this.moduleCount,
}) {
_calculateMetrics();
}
final int moduleCount;
final double containerSize;
final double gapSize;
late final double _pixelSize;
double get pixelSize => _pixelSize;
late final double _innerContentSize;
double get innerContentSize => _innerContentSize;
late final double _inset;
double get inset => _inset;
void _calculateMetrics() {
final gapTotal = (moduleCount - 1) * gapSize;
final pixelSize = (containerSize - gapTotal) / moduleCount;
// _pixelSize = (pixelSize * 2).roundToDouble() / 2; // 注释掉这行
_pixelSize = pixelSize; // 添加这行代码,将pixelSize 直接赋值给_pixelSize
_innerContentSize = (_pixelSize * moduleCount) + gapTotal;
_inset = (containerSize - _innerContentSize) / 2;
}
}