first commit

This commit is contained in:
2026-09-21 17:37:53 +08:00
commit 67d4dd5b7c
141 changed files with 8558 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
import 'package:flutter/material.dart';
import '../core/navigation/navigator_key.dart';
/// 统一提示封装(对齐 uni.showToast 的常用场景)
void showToast(BuildContext context, String message, {bool error = false}) {
ScaffoldMessenger.of(context).hideCurrentSnackBar();
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(message),
backgroundColor: error ? const Color(0xFFB71C1C) : const Color(0xFF323232),
behavior: SnackBarBehavior.floating,
duration: const Duration(seconds: 2),
),
);
}
/// 全局提示:供没有 BuildContext 的地方调用(网络层、Provider)
void showGlobalToast(String message, {bool error = false}) {
final context = navigatorKey.currentContext;
if (context != null) showToast(context, message, error: error);
}