🐛 Fix bugs in the new changes

This commit is contained in:
2025-12-21 02:29:43 +08:00
parent d68b39f80f
commit e16a04bd5a
4 changed files with 89 additions and 86 deletions

View File

@@ -8,6 +8,7 @@ import 'package:google_fonts/google_fonts.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:island/pods/chat/chat_room.dart'; import 'package:island/pods/chat/chat_room.dart';
import 'package:island/pods/event_calendar.dart'; import 'package:island/pods/event_calendar.dart';
import 'package:island/pods/userinfo.dart';
import 'package:island/screens/chat/chat.dart'; import 'package:island/screens/chat/chat.dart';
import 'package:island/services/event_bus.dart'; import 'package:island/services/event_bus.dart';
import 'package:island/services/responsive.dart'; import 'package:island/services/responsive.dart';
@@ -41,6 +42,8 @@ class DashboardGrid extends HookConsumerWidget {
final isWide = isWideScreen(context); final isWide = isWideScreen(context);
final devicePadding = MediaQuery.paddingOf(context); final devicePadding = MediaQuery.paddingOf(context);
final userInfo = ref.watch(userInfoProvider);
return Container( return Container(
constraints: BoxConstraints( constraints: BoxConstraints(
maxHeight: isWide maxHeight: isWide
@@ -52,6 +55,7 @@ class DashboardGrid extends HookConsumerWidget {
: EdgeInsets.only(top: 24 + devicePadding.top), : EdgeInsets.only(top: 24 + devicePadding.top),
child: Column( child: Column(
spacing: 16, spacing: 16,
mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
// Clock card spans full width // Clock card spans full width
ClockCard().padding(horizontal: isWide ? 24 : 16), ClockCard().padding(horizontal: isWide ? 24 : 16),
@@ -68,13 +72,16 @@ class DashboardGrid extends HookConsumerWidget {
}, },
), ),
), ),
if (userInfo.value != null)
Expanded( Expanded(
child: child:
SingleChildScrollView( SingleChildScrollView(
padding: isWide padding: isWide
? const EdgeInsets.symmetric(horizontal: 24) ? const EdgeInsets.symmetric(horizontal: 24)
: const EdgeInsets.only(bottom: 64), : const EdgeInsets.only(bottom: 64),
scrollDirection: isWide ? Axis.horizontal : Axis.vertical, scrollDirection: isWide
? Axis.horizontal
: Axis.vertical,
child: isWide child: isWide
? _DashboardGridWide() ? _DashboardGridWide()
: _DashboardGridNarrow(), : _DashboardGridNarrow(),
@@ -365,9 +372,7 @@ class NotificationsCard extends HookConsumerWidget {
final notifications = ref.watch(notificationListProvider); final notifications = ref.watch(notificationListProvider);
return Card( return Card(
elevation: 4,
margin: EdgeInsets.zero, margin: EdgeInsets.zero,
color: Theme.of(context).colorScheme.surfaceContainer,
shape: const RoundedRectangleBorder( shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(12)), borderRadius: BorderRadius.all(Radius.circular(12)),
), ),
@@ -454,9 +459,7 @@ class ChatListCard extends HookConsumerWidget {
final chatRooms = ref.watch(chatRoomJoinedProvider); final chatRooms = ref.watch(chatRoomJoinedProvider);
return Card( return Card(
elevation: 4,
margin: EdgeInsets.zero, margin: EdgeInsets.zero,
color: Theme.of(context).colorScheme.surfaceContainer,
shape: const RoundedRectangleBorder( shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(12)), borderRadius: BorderRadius.all(Radius.circular(12)),
), ),
@@ -490,11 +493,8 @@ class ChatListCard extends HookConsumerWidget {
} }
// Take only the first 5 rooms // Take only the first 5 rooms
final recentRooms = rooms.take(5).toList(); final recentRooms = rooms.take(5).toList();
return ListView.builder( return Column(
shrinkWrap: true, children: recentRooms.map((room) {
itemCount: recentRooms.length,
itemBuilder: (context, index) {
final room = recentRooms[index];
return ChatRoomListTile( return ChatRoomListTile(
room: room, room: room,
isDirect: room.type == 1, isDirect: room.type == 1,
@@ -505,7 +505,7 @@ class ChatListCard extends HookConsumerWidget {
); );
}, },
); );
}, }).toList(),
); );
}, },
), ),
@@ -556,9 +556,7 @@ class FortuneCard extends HookWidget {
}); });
return Card( return Card(
elevation: 4,
margin: EdgeInsets.zero, margin: EdgeInsets.zero,
color: Theme.of(context).colorScheme.surfaceContainer,
shape: const RoundedRectangleBorder( shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(12)), borderRadius: BorderRadius.all(Radius.circular(12)),
), ),

View File

@@ -388,6 +388,9 @@ class CommandPattleWidget extends HookConsumerWidget {
), ),
], ],
), ),
child: Material(
color: Theme.of(context).colorScheme.surface,
borderRadius: BorderRadius.circular(24),
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
@@ -408,6 +411,7 @@ class CommandPattleWidget extends HookConsumerWidget {
maxHeight: 300, maxHeight: 300,
), ),
child: ListView.builder( child: ListView.builder(
padding: EdgeInsets.zero,
controller: scrollController, controller: scrollController,
shrinkWrap: true, shrinkWrap: true,
itemCount: allResults.length, itemCount: allResults.length,
@@ -451,6 +455,7 @@ class CommandPattleWidget extends HookConsumerWidget {
), ),
), ),
), ),
),
); );
} }

View File

@@ -54,7 +54,7 @@ class SliverRealmList extends HookConsumerWidget {
itemBuilder: (context, index, realm) { itemBuilder: (context, index, realm) {
return ConstrainedBox( return ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 540), constraints: const BoxConstraints(maxWidth: 540),
child: RealmListTile(realm: realm), child: RealmListTile(realm: realm).padding(horizontal: 8),
).center(); ).center();
}, },
); );

View File

@@ -16,7 +16,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts # In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix. # of the product and file versions while build-number is used as the build suffix.
version: 3.5.0+152 version: 3.5.0+153
environment: environment:
sdk: ^3.8.0 sdk: ^3.8.0