🐛 Fix some bugs in dashboard
This commit is contained in:
@@ -117,7 +117,14 @@ class DashboardRenderer {
|
||||
case 'postsColumn':
|
||||
return SizedBox(
|
||||
width: 400,
|
||||
child: PostFeaturedList(collapsable: false),
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
return PostFeaturedList(
|
||||
collapsable: false,
|
||||
maxHeight: constraints.maxHeight,
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
case 'socialColumn':
|
||||
return SizedBox(
|
||||
@@ -153,6 +160,7 @@ class DashboardGrid extends HookConsumerWidget {
|
||||
final devicePadding = MediaQuery.paddingOf(context);
|
||||
|
||||
final userInfo = ref.watch(userInfoProvider);
|
||||
final appSettings = ref.watch(appSettingsProvider);
|
||||
|
||||
final dragging = useState(false);
|
||||
|
||||
@@ -185,26 +193,32 @@ class DashboardGrid extends HookConsumerWidget {
|
||||
spacing: 16,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
// Clock card spans full width
|
||||
if (isWide)
|
||||
// Clock card spans full width (only if enabled in settings)
|
||||
if (isWide &&
|
||||
(appSettings.dashboardConfig?.showClockAndCountdown ??
|
||||
true))
|
||||
ClockCard().padding(horizontal: 24)
|
||||
else
|
||||
else if (!isWide)
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Gap(8),
|
||||
Expanded(child: ClockCard(compact: true)),
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
eventBus.fire(CommandPaletteTriggerEvent());
|
||||
},
|
||||
icon: const Icon(Symbols.search),
|
||||
tooltip: 'searchAnything'.tr(),
|
||||
),
|
||||
if (appSettings.dashboardConfig?.showClockAndCountdown ??
|
||||
true)
|
||||
Expanded(child: ClockCard(compact: true)),
|
||||
if (appSettings.dashboardConfig?.showSearchBar ?? true)
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
eventBus.fire(CommandPaletteTriggerEvent());
|
||||
},
|
||||
icon: const Icon(Symbols.search),
|
||||
tooltip: 'searchAnything'.tr(),
|
||||
),
|
||||
],
|
||||
).padding(horizontal: 24),
|
||||
// Row with two cards side by side
|
||||
if (isWide)
|
||||
// Row with two cards side by side (only if enabled in settings)
|
||||
if (isWide &&
|
||||
(appSettings.dashboardConfig?.showSearchBar ?? true))
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: isWide ? 24 : 16),
|
||||
child: SearchBar(
|
||||
@@ -250,7 +264,7 @@ class DashboardGrid extends HookConsumerWidget {
|
||||
),
|
||||
// Customize button
|
||||
Positioned(
|
||||
bottom: 16,
|
||||
bottom: isWide ? 16 : 16 + devicePadding.bottom,
|
||||
right: 16,
|
||||
child: TextButton.icon(
|
||||
onPressed: () {
|
||||
|
||||
@@ -285,7 +285,7 @@ class DashboardCustomizationSheet extends HookConsumerWidget {
|
||||
if (availableCards.isNotEmpty)
|
||||
SliverToBoxAdapter(
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
|
||||
@@ -22,7 +22,8 @@ Future<List<SnPost>> featuredPosts(Ref ref) async {
|
||||
|
||||
class PostFeaturedList extends HookConsumerWidget {
|
||||
final bool collapsable;
|
||||
const PostFeaturedList({super.key, this.collapsable = true});
|
||||
final double? maxHeight;
|
||||
const PostFeaturedList({super.key, this.collapsable = true, this.maxHeight});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
@@ -178,7 +179,7 @@ class PostFeaturedList extends HookConsumerWidget {
|
||||
error: (error, stack) => Center(child: Text('Error: $error')),
|
||||
data: (posts) {
|
||||
return SizedBox(
|
||||
height: 344,
|
||||
height: maxHeight == null ? 344 : (maxHeight! - 48),
|
||||
child: PageView.builder(
|
||||
controller: pageViewController,
|
||||
scrollDirection: Axis.horizontal,
|
||||
|
||||
Reference in New Issue
Block a user