mod: 不使用FixedCrossAxisCount,改为MaxCrossAxisExtent

This commit is contained in:
orz12
2024-01-26 23:08:29 +08:00
parent bf6cef3a19
commit 283262c58e
11 changed files with 83 additions and 143 deletions

12
lib/utils/grid.dart Normal file
View File

@@ -0,0 +1,12 @@
import 'package:flutter/cupertino.dart';
import 'storage.dart';
class Grid {
static double maxRowWidth = GStrorage.setting.get(SettingBoxKey.maxRowWidth, defaultValue: 240.0) as double;
static double calculateActualWidth(BuildContext context, double maxCrossAxisExtent, double crossAxisSpacing) {
double screenWidth = MediaQuery.of(context).size.width;
int columnCount = ((screenWidth - crossAxisSpacing) / (maxCrossAxisExtent + crossAxisSpacing)).ceil();
double columnWidth = (screenWidth - crossAxisSpacing) ~/ columnCount - crossAxisSpacing;
return columnWidth;
}
}

View File

@@ -149,7 +149,7 @@ class SettingBoxKey {
customColor = 'customColor', // 自定义主题色
enableSingleRow = 'enableSingleRow', // 首页单列
displayMode = 'displayMode',
customRows = 'customRows', // 自定义列
maxRowWidth = 'maxRowWidth', // 首页列最大宽度dp
enableMYBar = 'enableMYBar',
hideSearchBar = 'hideSearchBar', // 收起顶栏
hideTabBar = 'hideTabBar', // 收起底栏