fix(app): 移除设置页调试服务器地址
This commit is contained in:
1 parent
2b95c79931
commit
061aac6577
6 files changed
+25
-273
No files matched your search
@@ -2,11 +2,9 @@
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../core/config/app_config.dart';
|
||||
import '../../core/data/models/drama.dart';
|
||||
import '../../core/data/models/home_feed.dart';
|
||||
import '../../core/data/services/auth_controller.dart';
|
||||
@@ -19,7 +17,6 @@ import '../../core/theme/app_theme.dart';
|
||||
import '../../core/widgets/app_bottom_nav.dart';
|
||||
import '../../core/widgets/auth_gate.dart';
|
||||
import '../../core/widgets/empty_state.dart';
|
||||
import '../../core/widgets/server_endpoint_dialog.dart';
|
||||
import '../../l10n/app_localizations.dart';
|
||||
import '../discover/discover_view.dart';
|
||||
import '../splash/splash_page.dart';
|
||||
@@ -58,10 +55,7 @@ class HomePage extends StatelessWidget {
|
||||
if (catalog.error != null) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.ink,
|
||||
body: HomeFailureView(
|
||||
onRetry: catalog.load,
|
||||
showDebugTools: kDebugMode,
|
||||
),
|
||||
body: HomeFailureView(onRetry: catalog.load),
|
||||
);
|
||||
}
|
||||
if (catalog.dramas.isEmpty) {
|
||||
@@ -86,53 +80,20 @@ class HomePage extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
/// Home catalog failure with optional debug-only endpoint controls.
|
||||
/// Home catalog failure with a single recovery action.
|
||||
class HomeFailureView extends StatelessWidget {
|
||||
const HomeFailureView({
|
||||
super.key,
|
||||
required this.onRetry,
|
||||
this.showDebugTools = kDebugMode,
|
||||
});
|
||||
const HomeFailureView({super.key, required this.onRetry});
|
||||
|
||||
final VoidCallback onRetry;
|
||||
final bool showDebugTools;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
return Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: EmptyState(
|
||||
icon: Icons.cloud_off_rounded,
|
||||
title: l10n.catalogError,
|
||||
actionLabel: l10n.retry,
|
||||
onAction: onRetry,
|
||||
),
|
||||
),
|
||||
if (showDebugTools) _debugTools(context, l10n),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _debugTools(BuildContext context, AppLocalizations l10n) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(24, 0, 24, 24),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
AppConfig.apiBaseUrl,
|
||||
style: const TextStyle(fontSize: 12, color: AppColors.muted),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
OutlinedButton.icon(
|
||||
key: const Key('home-server-settings'),
|
||||
onPressed: () => showServerEndpointDialog(context, l10n),
|
||||
icon: const Icon(Icons.dns_outlined),
|
||||
label: Text(l10n.serverSettings),
|
||||
),
|
||||
],
|
||||
),
|
||||
return EmptyState(
|
||||
icon: Icons.cloud_off_rounded,
|
||||
title: l10n.catalogError,
|
||||
actionLabel: l10n.retry,
|
||||
onAction: onRetry,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user