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