showDownloadProgressOverlay static method

Widget showDownloadProgressOverlay({
  1. required bool visible,
  2. required double progress,
  3. String title = "正在下载资源...",
  4. Color color = Colors.brown,
})

Implementation

static Widget showDownloadProgressOverlay({
  required bool visible,
  required double progress,
  String title = "正在下载资源...",
  Color color = Colors.brown,
}) {
  if (!visible) return const SizedBox();

  return Container(
    color: Colors.black54,
    child: Center(
      child: Container(
        width: 260,
        padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 30),
        decoration: BoxDecoration(
          color: Colors.white.withValues(alpha: 0.95),
          borderRadius: BorderRadius.circular(20),
        ),
        child: Column(
          mainAxisSize: MainAxisSize.min,
          children: [
            Icon(Icons.download_rounded, size: 40, color: color),
            const SizedBox(height: 10),
            Text(
              title,
              style: TextStyle(
                fontSize: 16,
                fontWeight: FontWeight.w500,
                color: color,
              ),
            ),
            const SizedBox(height: 20),
            LinearProgressIndicator(
              value: progress,
              minHeight: 8,
              borderRadius: BorderRadius.circular(10),
              backgroundColor: color.withOpacity(0.2),
              color: color,
            ),
            const SizedBox(height: 12),
            Text(
              "${(progress * 100).toStringAsFixed(1)}%",
              style: TextStyle(fontSize: 14, color: color),
            ),
          ],
        ),
      ),
    ),
  );
}