mirror of
https://github.com/venera-app/venera.git
synced 2025-09-27 15:57:25 +00:00
Fix layout
This commit is contained in:
@@ -356,14 +356,13 @@ class ComicTile extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.fromLTRB(4, 4, 4, 0),
|
padding: const EdgeInsets.fromLTRB(4, 4, 4, 0),
|
||||||
child: TextScroll(
|
child: Text(
|
||||||
comic.title.replaceAll('\n', ''),
|
comic.title.replaceAll('\n', ''),
|
||||||
mode: TextScrollMode.endless,
|
maxLines: 1,
|
||||||
|
overflow: TextOverflow.clip,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
),
|
),
|
||||||
delayBefore: Duration(milliseconds: 500),
|
|
||||||
velocity: const Velocity(pixelsPerSecond: Offset(40, 0)),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@@ -70,15 +70,15 @@ class SliverGridDelegateWithFixedHeight extends SliverGridDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class SliverGridDelegateWithComics extends SliverGridDelegate {
|
class SliverGridDelegateWithComics extends SliverGridDelegate {
|
||||||
SliverGridDelegateWithComics([this.useBriefMode = false, this.scale]);
|
SliverGridDelegateWithComics([this.scale]);
|
||||||
|
|
||||||
final bool useBriefMode;
|
final bool useBriefMode = appdata.settings['comicDisplayMode'] == 'brief';
|
||||||
|
|
||||||
final double? scale;
|
final double? scale;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
SliverGridLayout getLayout(SliverConstraints constraints) {
|
SliverGridLayout getLayout(SliverConstraints constraints) {
|
||||||
if (appdata.settings['comicDisplayMode'] == 'brief' || useBriefMode) {
|
if (useBriefMode) {
|
||||||
return getBriefModeLayout(
|
return getBriefModeLayout(
|
||||||
constraints,
|
constraints,
|
||||||
scale ?? (appdata.settings['comicTileScale'] as num).toDouble(),
|
scale ?? (appdata.settings['comicTileScale'] as num).toDouble(),
|
||||||
@@ -108,7 +108,7 @@ class SliverGridDelegateWithComics extends SliverGridDelegate {
|
|||||||
|
|
||||||
SliverGridLayout getBriefModeLayout(SliverConstraints constraints, double scale) {
|
SliverGridLayout getBriefModeLayout(SliverConstraints constraints, double scale) {
|
||||||
final maxCrossAxisExtent = 192.0 * scale;
|
final maxCrossAxisExtent = 192.0 * scale;
|
||||||
const childAspectRatio = 0.68;
|
const childAspectRatio = 0.64;
|
||||||
const crossAxisSpacing = 0.0;
|
const crossAxisSpacing = 0.0;
|
||||||
int crossAxisCount = (constraints.crossAxisExtent / (maxCrossAxisExtent + crossAxisSpacing)).ceil();
|
int crossAxisCount = (constraints.crossAxisExtent / (maxCrossAxisExtent + crossAxisSpacing)).ceil();
|
||||||
// Ensure a minimum count of 1, can be zero and result in an infinite extent
|
// Ensure a minimum count of 1, can be zero and result in an infinite extent
|
||||||
@@ -132,6 +132,10 @@ class SliverGridDelegateWithComics extends SliverGridDelegate {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
bool shouldRelayout(covariant SliverGridDelegate oldDelegate) {
|
bool shouldRelayout(covariant SliverGridDelegate oldDelegate) {
|
||||||
|
if (oldDelegate is! SliverGridDelegateWithComics) return true;
|
||||||
|
if (oldDelegate.scale != scale || oldDelegate.useBriefMode != useBriefMode) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -229,9 +229,12 @@ class _SettingsPageState extends State<SettingsPage> implements PopEntry {
|
|||||||
child: child,
|
child: child,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
child: Material(
|
||||||
|
key: ValueKey(currentPage),
|
||||||
child: buildRight(),
|
child: buildRight(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user