2d37ef1e7b
- notification_bell.dart: VoidCallback? → VoidCallback(字段非空) - content_top_bar.dart: 在 null-guard 内用 onBell! 传给 NotificationBell - flutter analyze: No issues found Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
43 lines
1.3 KiB
Dart
43 lines
1.3 KiB
Dart
// notification_bell.dart — 顶栏通知铃铛(带未读红点)
|
|
//
|
|
// 桌面顶栏(content_top_bar.dart)在主题切换旁挂一枚铃铛,点击进 NavView.notifications。
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
|
|
import '../pangolin_theme.dart';
|
|
import 'pangolin_icons.dart';
|
|
|
|
class NotificationBell extends ConsumerWidget {
|
|
const NotificationBell({super.key, required this.onTap, this.hasUnread = false});
|
|
|
|
final VoidCallback onTap;
|
|
final bool hasUnread;
|
|
|
|
@override
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
final c = context.pangolin;
|
|
|
|
return InkWell(
|
|
onTap: onTap,
|
|
borderRadius: BorderRadius.circular(PangolinRadius.sm),
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(6),
|
|
child: Stack(clipBehavior: Clip.none, children: [
|
|
Icon(PangolinIcons.bell, size: 18, color: c.fg2),
|
|
// TODO(spec-3): 未读态来自 notices provider,现暂由调用方写死演示。
|
|
if (hasUnread)
|
|
Positioned(
|
|
top: -1,
|
|
right: -1,
|
|
child: Container(
|
|
width: 7,
|
|
height: 7,
|
|
decoration: BoxDecoration(color: c.danger, shape: BoxShape.circle),
|
|
),
|
|
),
|
|
]),
|
|
),
|
|
);
|
|
}
|
|
}
|