diff --git a/lib/providers/notification.dart b/lib/providers/notification.dart index 60cb15a..0604935 100644 --- a/lib/providers/notification.dart +++ b/lib/providers/notification.dart @@ -78,6 +78,7 @@ class NotificationProvider extends ChangeNotifier { _ws.stream.stream.listen((event) { if (event.method == 'notifications.new') { final notification = SnNotification.fromJson(event.payload!); + if (showingCount < 0) showingCount = 0; showingCount++; notifications.add(notification); Future.delayed(const Duration(seconds: 3), () { diff --git a/lib/screens/home.dart b/lib/screens/home.dart index efe391f..9352821 100644 --- a/lib/screens/home.dart +++ b/lib/screens/home.dart @@ -288,6 +288,7 @@ class _HomeDashTodayNewsState extends State<_HomeDashTodayNews> { child: InkWell( borderRadius: BorderRadius.all(Radius.circular(8)), child: Column( + crossAxisAlignment: CrossAxisAlignment.start, spacing: 4, children: [ Text( diff --git a/lib/widgets/notify_indicator.dart b/lib/widgets/notify_indicator.dart index 5f03faa..96179bb 100644 --- a/lib/widgets/notify_indicator.dart +++ b/lib/widgets/notify_indicator.dart @@ -6,7 +6,9 @@ import 'package:flutter_animate/flutter_animate.dart'; import 'package:gap/gap.dart'; import 'package:material_symbols_icons/material_symbols_icons.dart'; import 'package:provider/provider.dart'; +import 'package:responsive_framework/responsive_framework.dart'; import 'package:styled_widget/styled_widget.dart'; +import 'package:surface/providers/config.dart'; import 'package:surface/providers/notification.dart'; import 'package:surface/providers/sn_network.dart'; import 'package:surface/providers/userinfo.dart'; @@ -63,6 +65,8 @@ class _NotifyIndicatorState extends State with SingleTickerProv final ua = context.read(); final nty = context.watch(); + final isMobile = ResponsiveBreakpoints.of(context).smallerOrEqualTo(MOBILE); + final show = nty.showingCount > 0 && ua.isAuthorized; if (show) { @@ -83,7 +87,7 @@ class _NotifyIndicatorState extends State with SingleTickerProv controller: _animationController, effects: [ SlideEffect( - begin: Offset(0, -1), + begin: isMobile ? Offset(0, -1) : Offset(1, 0), end: Offset(0, 0), duration: Duration(milliseconds: 300), curve: Curves.fastEaseInToSlowEaseOut, @@ -99,7 +103,7 @@ class _NotifyIndicatorState extends State with SingleTickerProv padding: const EdgeInsets.symmetric(vertical: 16), width: double.infinity, constraints: BoxConstraints( - maxWidth: min(480, MediaQuery.of(context).size.width - 16), + maxWidth: isMobile ? MediaQuery.of(context).size.width - 16 : 360, ), child: Material( elevation: 2,