diff --git a/lib/screens/about.dart b/lib/screens/about.dart index 1ee4bd60..3feeca14 100644 --- a/lib/screens/about.dart +++ b/lib/screens/about.dart @@ -178,7 +178,8 @@ class _AboutScreenState extends ConsumerState { context, icon: Symbols.label, label: 'aboutDeviceName'.tr(), - value: _deviceInfo?.data['name'], + value: + _deviceInfo?.data['name'] ?? 'unknown'.tr(), ), _buildInfoItem( context, diff --git a/lib/screens/explore.dart b/lib/screens/explore.dart index 0a496d01..4b80c254 100644 --- a/lib/screens/explore.dart +++ b/lib/screens/explore.dart @@ -11,6 +11,7 @@ import 'package:island/models/realm.dart'; import 'package:island/models/webfeed.dart'; import 'package:island/pods/event_calendar.dart'; import 'package:island/pods/userinfo.dart'; +import 'package:island/screens/notification.dart'; import 'package:island/services/responsive.dart'; import 'package:island/widgets/account/fortune_graph.dart'; import 'package:island/widgets/app_scaffold.dart'; @@ -30,6 +31,33 @@ import 'package:styled_widget/styled_widget.dart'; part 'explore.g.dart'; +Widget notificationIndicatorWidget( + BuildContext context, { + required int count, + EdgeInsets? margin, +}) => Card( + margin: margin, + child: ListTile( + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.all(Radius.circular(8)), + ), + leading: const Icon(Symbols.notifications), + title: Row( + children: [ + Text('notifications').tr().fontSize(14), + const Gap(8), + Badge(label: Text(count.toString())), + ], + ), + trailing: const Icon(Symbols.chevron_right), + minTileHeight: 40, + contentPadding: EdgeInsets.only(left: 16, right: 15), + onTap: () { + GoRouter.of(context).pushNamed('notifications'); + }, + ), +); + class ExploreScreen extends HookConsumerWidget { const ExploreScreen({super.key}); @@ -77,6 +105,10 @@ class ExploreScreen extends HookConsumerWidget { final user = ref.watch(userInfoProvider); + final notificationCount = ref.watch( + notificationUnreadCountNotifierProvider, + ); + return AppScaffold( isNoBackground: false, appBar: AppBar( @@ -200,33 +232,51 @@ class ExploreScreen extends HookConsumerWidget { if (user.value != null) Flexible( flex: 2, - child: SingleChildScrollView( - child: Column( - children: [ - CheckInWidget( - margin: EdgeInsets.only( + child: Align( + alignment: Alignment.topCenter, + child: SingleChildScrollView( + child: Column( + children: [ + CheckInWidget( + margin: EdgeInsets.only( + left: 8, + right: 12, + top: 16, + ), + onChecked: () { + ref.invalidate( + eventCalendarProvider(query.value), + ); + }, + ), + if (notificationCount.value != null && + notificationCount.value! > 0) + notificationIndicatorWidget( + context, + count: notificationCount.value ?? 0, + margin: EdgeInsets.only( + left: 8, + right: 12, + top: 8, + ), + ), + PostFeaturedList().padding( left: 8, right: 12, - top: 16, + top: 8, ), - onChecked: () { - ref.invalidate( - eventCalendarProvider(query.value), - ); - }, - ), - PostFeaturedList().padding( - left: 8, - right: 12, - top: 8, - ), - FortuneGraphWidget( - margin: EdgeInsets.only(left: 8, right: 12, top: 8), - events: events, - constrainWidth: true, - onPointSelected: onDaySelected, - ), - ], + FortuneGraphWidget( + margin: EdgeInsets.only( + left: 8, + right: 12, + top: 8, + ), + events: events, + constrainWidth: true, + onPointSelected: onDaySelected, + ), + ], + ), ), ), ) @@ -380,6 +430,10 @@ class _ActivityListView extends HookConsumerWidget { Widget build(BuildContext context, WidgetRef ref) { final user = ref.watch(userInfoProvider); + final notificationCount = ref.watch( + notificationUnreadCountNotifierProvider, + ); + return CustomScrollView( slivers: [ SliverGap(12), @@ -393,6 +447,14 @@ class _ActivityListView extends HookConsumerWidget { SliverToBoxAdapter( child: PostFeaturedList().padding(horizontal: 8, bottom: 4, top: 4), ), + if (!contentOnly) + SliverToBoxAdapter( + child: notificationIndicatorWidget( + context, + count: notificationCount.value ?? 0, + margin: EdgeInsets.only(left: 8, right: 8, top: 4, bottom: 4), + ), + ), SliverList.builder( itemCount: widgetCount, itemBuilder: (context, index) { diff --git a/macos/Podfile.lock b/macos/Podfile.lock index 550ec719..358c960d 100644 --- a/macos/Podfile.lock +++ b/macos/Podfile.lock @@ -195,7 +195,7 @@ PODS: - PromisesObjC (2.4.0) - PromisesSwift (2.4.0): - PromisesObjC (= 2.4.0) - - record_macos (1.0.0): + - record_macos (1.1.0): - FlutterMacOS - SAMKeychain (1.5.3) - share_plus (0.0.1): @@ -422,7 +422,7 @@ SPEC CHECKSUMS: path_provider_foundation: 080d55be775b7414fd5a5ef3ac137b97b097e564 PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47 PromisesSwift: 9d77319bbe72ebf6d872900551f7eeba9bce2851 - record_macos: 295d70bd5fb47145df78df7b80e6697cd18403c0 + record_macos: 43194b6c06ca6f8fa132e2acea72b202b92a0f5b SAMKeychain: 483e1c9f32984d50ca961e26818a534283b4cd5c share_plus: 510bf0af1a42cd602274b4629920c9649c52f4cc shared_preferences_foundation: 9e1978ff2562383bd5676f64ec4e9aa8fa06a6f7