fix(mining-app): 修复贡献值明细页面筛选和文字溢出问题

- 将贡献值记录筛选从客户端过滤改为服务端过滤,解决同伴上贡献值记录无法显示的问题
- 使用 FittedBox 包装三栏统计标签文字,防止"同伴上贡献值"溢出

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-01-29 09:44:12 -08:00
parent 776d181ef3
commit 7560940e14
3 changed files with 22 additions and 15 deletions

View File

@ -279,7 +279,14 @@ class ContributionPage extends ConsumerWidget {
padding: const EdgeInsets.symmetric(horizontal: 4), padding: const EdgeInsets.symmetric(horizontal: 4),
child: Column( child: Column(
children: [ children: [
Text(label, style: TextStyle(fontSize: 12, color: AppColors.textSecondaryOf(context))), FittedBox(
fit: BoxFit.scaleDown,
child: Text(
label,
style: TextStyle(fontSize: 12, color: AppColors.textSecondaryOf(context)),
maxLines: 1,
),
),
const SizedBox(height: 4), const SizedBox(height: 4),
DataText( DataText(
data: value != null ? (hideAmounts ? '****' : formatAmount(value)) : null, data: value != null ? (hideAmounts ? '****' : formatAmount(value)) : null,

View File

@ -41,6 +41,7 @@ class _ContributionRecordsListPageState extends ConsumerState<ContributionRecord
accountSequence: accountSequence, accountSequence: accountSequence,
page: _currentPage, page: _currentPage,
pageSize: _pageSize, pageSize: _pageSize,
sourceType: _selectedSourceType,
); );
final recordsAsync = ref.watch(contributionRecordsProvider(recordsParams)); final recordsAsync = ref.watch(contributionRecordsProvider(recordsParams));
@ -113,6 +114,9 @@ class _ContributionRecordsListPageState extends ConsumerState<ContributionRecord
final isSelected = _selectedSourceType == type; final isSelected = _selectedSourceType == type;
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
if (kDebugMode) {
print('[ContributionRecords] Filter tapped: $label (type: $type)');
}
setState(() { setState(() {
_selectedSourceType = type; _selectedSourceType = type;
_currentPage = 1; _currentPage = 1;
@ -198,6 +202,7 @@ class _ContributionRecordsListPageState extends ConsumerState<ContributionRecord
accountSequence: accountSequence, accountSequence: accountSequence,
page: _currentPage, page: _currentPage,
pageSize: _pageSize, pageSize: _pageSize,
sourceType: _selectedSourceType,
))); )));
}, },
style: ElevatedButton.styleFrom(backgroundColor: _orange), style: ElevatedButton.styleFrom(backgroundColor: _orange),
@ -230,23 +235,14 @@ class _ContributionRecordsListPageState extends ConsumerState<ContributionRecord
} }
Widget _buildRecordsList(RecordsPageData recordsPage, String currentAccountSequence) { Widget _buildRecordsList(RecordsPageData recordsPage, String currentAccountSequence) {
//
final filteredRecords = _selectedSourceType == null
? recordsPage.data
: recordsPage.data.where((r) => r.sourceType == _selectedSourceType).toList();
if (filteredRecords.isEmpty) {
return _buildEmptyView();
}
return ListView.builder( return ListView.builder(
padding: const EdgeInsets.all(16), padding: const EdgeInsets.all(16),
itemCount: filteredRecords.length + 1, // +1 for pagination info itemCount: recordsPage.data.length + 1, // +1 for pagination info
itemBuilder: (context, index) { itemBuilder: (context, index) {
if (index == filteredRecords.length) { if (index == recordsPage.data.length) {
return _buildPaginationInfo(recordsPage); return _buildPaginationInfo(recordsPage);
} }
return _buildRecordCard(filteredRecords[index], currentAccountSequence); return _buildRecordCard(recordsPage.data[index], currentAccountSequence);
}, },
); );
} }

View File

@ -47,11 +47,13 @@ class ContributionRecordsParams {
final String accountSequence; final String accountSequence;
final int page; final int page;
final int pageSize; final int pageSize;
final ContributionSourceType? sourceType;
const ContributionRecordsParams({ const ContributionRecordsParams({
required this.accountSequence, required this.accountSequence,
this.page = 1, this.page = 1,
this.pageSize = 10, this.pageSize = 10,
this.sourceType,
}); });
@override @override
@ -61,10 +63,11 @@ class ContributionRecordsParams {
runtimeType == other.runtimeType && runtimeType == other.runtimeType &&
accountSequence == other.accountSequence && accountSequence == other.accountSequence &&
page == other.page && page == other.page &&
pageSize == other.pageSize; pageSize == other.pageSize &&
sourceType == other.sourceType;
@override @override
int get hashCode => accountSequence.hashCode ^ page.hashCode ^ pageSize.hashCode; int get hashCode => accountSequence.hashCode ^ page.hashCode ^ pageSize.hashCode ^ sourceType.hashCode;
} }
/// Provider /// Provider
@ -78,6 +81,7 @@ final contributionRecordsProvider = FutureProvider.family<ContributionRecordsPag
final repository = ref.watch(contributionRepositoryProvider); final repository = ref.watch(contributionRepositoryProvider);
final result = await repository.getContributionRecords( final result = await repository.getContributionRecords(
params.accountSequence, params.accountSequence,
sourceType: params.sourceType,
page: params.page, page: params.page,
pageSize: params.pageSize, pageSize: params.pageSize,
); );