Template
chore: 初始化脚手架 — sunny_mochi 企业级 Flutter 模板
Core 基础设施:Flavor 三包体系、Drift+SQLCipher 加密数据库 7 拦截器 Dio 网络栈、CrashReporter 崩溃日志、Sealed Failure 错误体系 5 色板主题系统、Auth 认证骨架(Clean Architecture)、Dev Panel、Mock Adapter 通过验证:flutter analyze(0 errors)、flutter test(全绿)、staging APK 74.8MB
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// 全屏/局部 loading 遮罩。
|
||||
///
|
||||
/// 用法:
|
||||
/// ```dart
|
||||
/// LoadingOverlay(
|
||||
/// loading: _isLoading,
|
||||
/// child: MyWidget(),
|
||||
/// )
|
||||
/// ```
|
||||
class LoadingOverlay extends StatelessWidget {
|
||||
const LoadingOverlay({
|
||||
super.key,
|
||||
required this.child,
|
||||
this.loading = false,
|
||||
this.label,
|
||||
});
|
||||
|
||||
final Widget child;
|
||||
final bool loading;
|
||||
final String? label;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Stack(
|
||||
children: [
|
||||
child,
|
||||
if (loading)
|
||||
Positioned.fill(
|
||||
child: ColoredBox(
|
||||
color: Colors.black26,
|
||||
child: Center(
|
||||
child: Card(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 32, vertical: 24),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const CircularProgressIndicator(),
|
||||
if (label != null) ...[
|
||||
const SizedBox(height: 12),
|
||||
Text(label!,
|
||||
style: Theme.of(context).textTheme.bodySmall),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user