Files
App.K12.Student.Miniapp_Flu…/lib/core/providers/privacy_provider.dart
T
2026-09-04 15:22:20 +08:00

16 lines
758 B
Dart
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import 'package:flutter/foundation.dart';
/// ============================================================
/// 【privacyAcceptedNotifier】启动隐私协议同意状态
///
/// 为什么这里不用 Riverpod:
/// 1. go_router 的 redirect 需要一个全局可监听的 Listenable;
/// 2. ValueNotifier 足够轻量,适合这种"一个布尔值控制全局门禁"的场景;
/// 3. main.dart 在 runApp 前就能直接把本地状态恢复进来。
///
/// 值含义:
/// true = 已同意,可以正常进入登录/主页
/// false = 未同意,启动 Gate 和路由守卫都会先拦住
/// ============================================================
final ValueNotifier<bool> privacyAcceptedNotifier = ValueNotifier<bool>(false);