37 lines
942 B
Dart
37 lines
942 B
Dart
// Author: fruit.com.cn
|
|
|
|
import 'package:flutter/foundation.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
import '../../../core/widgets/catalog_debug_info.dart';
|
|
import '../../../core/widgets/empty_state.dart';
|
|
import '../../../l10n/app_localizations.dart';
|
|
|
|
/// 首页目录加载失败与重试入口。
|
|
class HomeFailureView extends StatelessWidget {
|
|
const HomeFailureView({
|
|
super.key,
|
|
this.error,
|
|
required this.onRetry,
|
|
this.onEditEndpoint,
|
|
});
|
|
|
|
final String? error;
|
|
final VoidCallback onRetry;
|
|
final VoidCallback? onEditEndpoint;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final l10n = AppLocalizations.of(context)!;
|
|
return EmptyState(
|
|
icon: Icons.cloud_off_rounded,
|
|
title: l10n.catalogError,
|
|
actionLabel: l10n.retry,
|
|
onAction: onRetry,
|
|
footer: kDebugMode
|
|
? CatalogDebugInfo(error: error, onEditEndpoint: onEditEndpoint)
|
|
: null,
|
|
);
|
|
}
|
|
}
|