为什么:上一批归档只覆盖了「已跟踪文件的修改」,原型阶段新增的文件(app_config、theme、 home_feed/play_ticket 模型、catalog_api、测试目录等)还是未入库状态 —— 而已入库的代码会 import 它们, 留在工作区会导致 HEAD 处的代码编译不过。一并归档,让 HEAD 自洽。 纯归档,无行为改动。
45 lines
1.0 KiB
Dart
45 lines
1.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../config/app_config.dart';
|
|
|
|
/// 封面图统一入口:后端给的是相对路径,这里补服务地址并处理加载失败。
|
|
class RemoteImage extends StatelessWidget {
|
|
const RemoteImage(
|
|
this.path, {
|
|
super.key,
|
|
this.width,
|
|
this.height,
|
|
this.fit = BoxFit.cover,
|
|
});
|
|
|
|
final String path;
|
|
final double? width;
|
|
final double? height;
|
|
final BoxFit fit;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final url = AppConfig.mediaUrl(path);
|
|
if (url.isEmpty) return _fallback();
|
|
return Image.network(
|
|
url,
|
|
width: width,
|
|
height: height,
|
|
fit: fit,
|
|
errorBuilder: (_, _, _) => _fallback(),
|
|
frameBuilder: (context, child, frame, wasSynchronouslyLoaded) {
|
|
if (wasSynchronouslyLoaded || frame != null) return child;
|
|
return _fallback();
|
|
},
|
|
);
|
|
}
|
|
|
|
Widget _fallback() {
|
|
return Container(
|
|
width: width,
|
|
height: height,
|
|
color: const Color(0xFF1C1F26),
|
|
);
|
|
}
|
|
}
|