mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-24 12:32:40 +08:00
mod: 不使用FixedCrossAxisCount,改为MaxCrossAxisExtent
This commit is contained in:
12
lib/utils/grid.dart
Normal file
12
lib/utils/grid.dart
Normal 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;
|
||||
}
|
||||
}
|
||||
@@ -149,7 +149,7 @@ class SettingBoxKey {
|
||||
customColor = 'customColor', // 自定义主题色
|
||||
enableSingleRow = 'enableSingleRow', // 首页单列
|
||||
displayMode = 'displayMode',
|
||||
customRows = 'customRows', // 自定义列
|
||||
maxRowWidth = 'maxRowWidth', // 首页列最大宽度(dp)
|
||||
enableMYBar = 'enableMYBar',
|
||||
hideSearchBar = 'hideSearchBar', // 收起顶栏
|
||||
hideTabBar = 'hideTabBar', // 收起底栏
|
||||
|
||||
Reference in New Issue
Block a user