📱 Optimize dashboard for large screen

This commit is contained in:
LittleSheep 2024-12-10 21:08:32 +08:00
parent 96f6752bbe
commit 1980843ac0

View File

@ -74,10 +74,9 @@ class _HomeScreenState extends State<HomeScreen> {
child: Column( child: Column(
mainAxisAlignment: constraints.maxWidth > 640 ? MainAxisAlignment.center : MainAxisAlignment.start, mainAxisAlignment: constraints.maxWidth > 640 ? MainAxisAlignment.center : MainAxisAlignment.start,
children: [ children: [
const Gap(8),
_HomeDashSpecialDayWidget().padding(top: 8, horizontal: 8), _HomeDashSpecialDayWidget().padding(top: 8, horizontal: 8),
StaggeredGrid.count( StaggeredGrid.extent(
crossAxisCount: 2, maxCrossAxisExtent: 280,
mainAxisSpacing: 8, mainAxisSpacing: 8,
crossAxisSpacing: 8, crossAxisSpacing: 8,
children: kCards.map((card) { children: kCards.map((card) {
@ -89,7 +88,7 @@ class _HomeScreenState extends State<HomeScreen> {
}).toList(), }).toList(),
).padding(horizontal: 8), ).padding(horizontal: 8),
], ],
), ).padding(vertical: 8),
), ),
), ),
); );
@ -443,10 +442,16 @@ class _HomeDashRecommendationPostWidgetState extends State<_HomeDashRecommendati
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Row(
'postRecommendation', children: [
style: Theme.of(context).textTheme.titleLarge, const Icon(Symbols.star),
).tr().padding(horizontal: 20, top: 16, bottom: 8), const Gap(8),
Text(
'postRecommendation',
style: Theme.of(context).textTheme.titleLarge,
).tr()
],
).padding(horizontal: 18, top: 12, bottom: 8),
Expanded( Expanded(
child: PageView.builder( child: PageView.builder(
scrollBehavior: ScrollConfiguration.of(context).copyWith(dragDevices: { scrollBehavior: ScrollConfiguration.of(context).copyWith(dragDevices: {
@ -460,7 +465,7 @@ class _HomeDashRecommendationPostWidgetState extends State<_HomeDashRecommendati
child: PostItem( child: PostItem(
data: _posts![index], data: _posts![index],
showMenu: false, showMenu: false,
).padding(left: 8, right: 8, bottom: 8), ).padding(bottom: 8),
onTap: () { onTap: () {
GoRouter.of(context).pushNamed('postDetail', pathParameters: { GoRouter.of(context).pushNamed('postDetail', pathParameters: {
'slug': _posts![index].id.toString(), 'slug': _posts![index].id.toString(),