generated from dellevin/template
1111
This commit is contained in:
@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import '../utils/user_prefs.dart';
|
||||
import '../utils/server_config.dart';
|
||||
import 'legal_page.dart';
|
||||
|
||||
/// 增强搜索设置页面
|
||||
class EnhancedSearchSettingsPage extends StatefulWidget {
|
||||
@@ -392,19 +393,33 @@ class _EnhancedSearchSettingsPageState
|
||||
}
|
||||
|
||||
Widget _buildSaveButton(ColorScheme colors) {
|
||||
return GestureDetector(
|
||||
onTap: _saveAndVerify,
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
decoration: BoxDecoration(
|
||||
color: colors.primary,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: _saveAndVerify,
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
decoration: BoxDecoration(
|
||||
color: colors.primary,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Center(
|
||||
child: Text('保存并验证', style: TextStyle(fontSize: 14, fontWeight: FontWeight.w500, color: colors.onPrimary)),
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Center(
|
||||
child: Text('保存并验证', style: TextStyle(fontSize: 14, fontWeight: FontWeight.w500, color: colors.onPrimary)),
|
||||
const SizedBox(height: 8),
|
||||
Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: GestureDetector(
|
||||
onTap: () => Navigator.push(context, MaterialPageRoute(
|
||||
builder: (_) => const LegalPage(slug: 'token_doc', title: '获取Token'))),
|
||||
child: Text('点击获取 Token', style: TextStyle(fontSize: 12, color: colors.primary)),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ class _OnlineSearchPageState extends State<OnlineSearchPage> {
|
||||
final url =
|
||||
'${ServerConfig.vipBaseUrl}/api/movie/list?movieName=${Uri.encodeComponent(keyword)}&token=$token&page=$page';
|
||||
final resp =
|
||||
await http.get(Uri.parse(url)).timeout(const Duration(seconds: 10));
|
||||
await http.get(Uri.parse(url)).timeout(const Duration(seconds: 20));
|
||||
if (!mounted) return;
|
||||
|
||||
if (resp.statusCode == 200) {
|
||||
@@ -156,7 +156,12 @@ class _OnlineSearchPageState extends State<OnlineSearchPage> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
} catch (_) {}
|
||||
} catch (e) {
|
||||
if (mounted) {
|
||||
final msg = e.toString().contains('TimeoutException') ? '搜索超时,请稍后重试' : '搜索失败,请检查网络';
|
||||
ToastUtil.show(context, msg);
|
||||
}
|
||||
}
|
||||
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
@@ -186,7 +191,7 @@ class _OnlineSearchPageState extends State<OnlineSearchPage> {
|
||||
final url =
|
||||
'${ServerConfig.vipBaseUrl}/api/book/list?title=${Uri.encodeComponent(keyword)}&token=$token&page=$page';
|
||||
final resp =
|
||||
await http.get(Uri.parse(url)).timeout(const Duration(seconds: 10));
|
||||
await http.get(Uri.parse(url)).timeout(const Duration(seconds: 20));
|
||||
if (!mounted) return;
|
||||
|
||||
if (resp.statusCode == 200) {
|
||||
@@ -219,7 +224,12 @@ class _OnlineSearchPageState extends State<OnlineSearchPage> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
} catch (_) {}
|
||||
} catch (e) {
|
||||
if (mounted) {
|
||||
final msg = e.toString().contains('TimeoutException') ? '搜索超时,请稍后重试' : '搜索失败,请检查网络';
|
||||
ToastUtil.show(context, msg);
|
||||
}
|
||||
}
|
||||
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
|
||||
Reference in New Issue
Block a user