This commit is contained in:
vipg
2025-11-19 17:00:29 +08:00
parent b2e89bf5bd
commit c8bb3d4ebd

View File

@@ -271,10 +271,12 @@ class _CountryPageState extends State<CountryPage> {
}
Widget _buildBody(ThemeData theme) {
// 加载中且列表为空
if (_isLoading && _countries.isEmpty) {
return const Center(child: CircularProgressIndicator());
}
// 有错误信息且列表为空
if (_errorMessage != null && _countries.isEmpty) {
return Center(
child: Column(
@@ -294,6 +296,43 @@ class _CountryPageState extends State<CountryPage> {
);
}
// 无数据状态(列表为空且无错误)
if (_countries.isEmpty) {
return Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
// 无数据背景图标
Icon(
Icons.flag_outlined,
size: 120,
color: theme.colorScheme.onSurface.withOpacity(0.1),
),
const SizedBox(height: 24),
// 无数据提示文字
Text(
'暂无国家数据',
style: theme.textTheme.titleLarge?.copyWith(
color: theme.colorScheme.onSurface.withOpacity(0.5),
),
),
const SizedBox(height: 16),
// 刷新按钮
IconButton(
icon: Icon(
Icons.refresh,
size: 28,
color: theme.colorScheme.primary,
),
onPressed: () => _fetchCountries(isRefresh: true),
tooltip: '刷新数据',
),
],
),
);
}
// 正常列表展示
return RefreshIndicator(
onRefresh: _refresh,
child: ListView.builder(