全局搜索找到_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;
}
}文章来源:https://www.toymoban.com/news/detail-805834.html
qr_flutter二维码库修正 - 简书文章来源地址https://www.toymoban.com/news/detail-805834.html
到了这里,关于flutter qr_flutter二维码库填充不满问题解决方案的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!