From c8bb3d4ebd49e5da8c80bacd613166b98e8c18b5 Mon Sep 17 00:00:00 2001 From: vipg Date: Wed, 19 Nov 2025 17:00:29 +0800 Subject: [PATCH] add --- .../lib/pages/country_page.dart | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/frontend/asset_assistant/lib/pages/country_page.dart b/frontend/asset_assistant/lib/pages/country_page.dart index c585af2..e594648 100644 --- a/frontend/asset_assistant/lib/pages/country_page.dart +++ b/frontend/asset_assistant/lib/pages/country_page.dart @@ -271,10 +271,12 @@ class _CountryPageState extends State { } 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 { ); } + // 无数据状态(列表为空且无错误) + 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(