📱 Fix new notify indicator on large screen
This commit is contained in:
parent
319d5c7d7f
commit
b7b921f1f4
@ -78,6 +78,7 @@ class NotificationProvider extends ChangeNotifier {
|
|||||||
_ws.stream.stream.listen((event) {
|
_ws.stream.stream.listen((event) {
|
||||||
if (event.method == 'notifications.new') {
|
if (event.method == 'notifications.new') {
|
||||||
final notification = SnNotification.fromJson(event.payload!);
|
final notification = SnNotification.fromJson(event.payload!);
|
||||||
|
if (showingCount < 0) showingCount = 0;
|
||||||
showingCount++;
|
showingCount++;
|
||||||
notifications.add(notification);
|
notifications.add(notification);
|
||||||
Future.delayed(const Duration(seconds: 3), () {
|
Future.delayed(const Duration(seconds: 3), () {
|
||||||
|
@ -288,6 +288,7 @@ class _HomeDashTodayNewsState extends State<_HomeDashTodayNews> {
|
|||||||
child: InkWell(
|
child: InkWell(
|
||||||
borderRadius: BorderRadius.all(Radius.circular(8)),
|
borderRadius: BorderRadius.all(Radius.circular(8)),
|
||||||
child: Column(
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
spacing: 4,
|
spacing: 4,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
|
@ -6,7 +6,9 @@ import 'package:flutter_animate/flutter_animate.dart';
|
|||||||
import 'package:gap/gap.dart';
|
import 'package:gap/gap.dart';
|
||||||
import 'package:material_symbols_icons/material_symbols_icons.dart';
|
import 'package:material_symbols_icons/material_symbols_icons.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:responsive_framework/responsive_framework.dart';
|
||||||
import 'package:styled_widget/styled_widget.dart';
|
import 'package:styled_widget/styled_widget.dart';
|
||||||
|
import 'package:surface/providers/config.dart';
|
||||||
import 'package:surface/providers/notification.dart';
|
import 'package:surface/providers/notification.dart';
|
||||||
import 'package:surface/providers/sn_network.dart';
|
import 'package:surface/providers/sn_network.dart';
|
||||||
import 'package:surface/providers/userinfo.dart';
|
import 'package:surface/providers/userinfo.dart';
|
||||||
@ -63,6 +65,8 @@ class _NotifyIndicatorState extends State<NotifyIndicator> with SingleTickerProv
|
|||||||
final ua = context.read<UserProvider>();
|
final ua = context.read<UserProvider>();
|
||||||
final nty = context.watch<NotificationProvider>();
|
final nty = context.watch<NotificationProvider>();
|
||||||
|
|
||||||
|
final isMobile = ResponsiveBreakpoints.of(context).smallerOrEqualTo(MOBILE);
|
||||||
|
|
||||||
final show = nty.showingCount > 0 && ua.isAuthorized;
|
final show = nty.showingCount > 0 && ua.isAuthorized;
|
||||||
|
|
||||||
if (show) {
|
if (show) {
|
||||||
@ -83,7 +87,7 @@ class _NotifyIndicatorState extends State<NotifyIndicator> with SingleTickerProv
|
|||||||
controller: _animationController,
|
controller: _animationController,
|
||||||
effects: [
|
effects: [
|
||||||
SlideEffect(
|
SlideEffect(
|
||||||
begin: Offset(0, -1),
|
begin: isMobile ? Offset(0, -1) : Offset(1, 0),
|
||||||
end: Offset(0, 0),
|
end: Offset(0, 0),
|
||||||
duration: Duration(milliseconds: 300),
|
duration: Duration(milliseconds: 300),
|
||||||
curve: Curves.fastEaseInToSlowEaseOut,
|
curve: Curves.fastEaseInToSlowEaseOut,
|
||||||
@ -99,7 +103,7 @@ class _NotifyIndicatorState extends State<NotifyIndicator> with SingleTickerProv
|
|||||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
constraints: BoxConstraints(
|
constraints: BoxConstraints(
|
||||||
maxWidth: min(480, MediaQuery.of(context).size.width - 16),
|
maxWidth: isMobile ? MediaQuery.of(context).size.width - 16 : 360,
|
||||||
),
|
),
|
||||||
child: Material(
|
child: Material(
|
||||||
elevation: 2,
|
elevation: 2,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user