fix(mining-app): 修复贡献值明细页面筛选和文字溢出问题
- 将贡献值记录筛选从客户端过滤改为服务端过滤,解决同伴上贡献值记录无法显示的问题 - 使用 FittedBox 包装三栏统计标签文字,防止"同伴上贡献值"溢出 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
776d181ef3
commit
7560940e14
|
|
@ -279,7 +279,14 @@ class ContributionPage extends ConsumerWidget {
|
|||
padding: const EdgeInsets.symmetric(horizontal: 4),
|
||||
child: Column(
|
||||
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),
|
||||
DataText(
|
||||
data: value != null ? (hideAmounts ? '****' : formatAmount(value)) : null,
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ class _ContributionRecordsListPageState extends ConsumerState<ContributionRecord
|
|||
accountSequence: accountSequence,
|
||||
page: _currentPage,
|
||||
pageSize: _pageSize,
|
||||
sourceType: _selectedSourceType,
|
||||
);
|
||||
final recordsAsync = ref.watch(contributionRecordsProvider(recordsParams));
|
||||
|
||||
|
|
@ -113,6 +114,9 @@ class _ContributionRecordsListPageState extends ConsumerState<ContributionRecord
|
|||
final isSelected = _selectedSourceType == type;
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
if (kDebugMode) {
|
||||
print('[ContributionRecords] Filter tapped: $label (type: $type)');
|
||||
}
|
||||
setState(() {
|
||||
_selectedSourceType = type;
|
||||
_currentPage = 1;
|
||||
|
|
@ -198,6 +202,7 @@ class _ContributionRecordsListPageState extends ConsumerState<ContributionRecord
|
|||
accountSequence: accountSequence,
|
||||
page: _currentPage,
|
||||
pageSize: _pageSize,
|
||||
sourceType: _selectedSourceType,
|
||||
)));
|
||||
},
|
||||
style: ElevatedButton.styleFrom(backgroundColor: _orange),
|
||||
|
|
@ -230,23 +235,14 @@ class _ContributionRecordsListPageState extends ConsumerState<ContributionRecord
|
|||
}
|
||||
|
||||
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(
|
||||
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) {
|
||||
if (index == filteredRecords.length) {
|
||||
if (index == recordsPage.data.length) {
|
||||
return _buildPaginationInfo(recordsPage);
|
||||
}
|
||||
return _buildRecordCard(filteredRecords[index], currentAccountSequence);
|
||||
return _buildRecordCard(recordsPage.data[index], currentAccountSequence);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,11 +47,13 @@ class ContributionRecordsParams {
|
|||
final String accountSequence;
|
||||
final int page;
|
||||
final int pageSize;
|
||||
final ContributionSourceType? sourceType;
|
||||
|
||||
const ContributionRecordsParams({
|
||||
required this.accountSequence,
|
||||
this.page = 1,
|
||||
this.pageSize = 10,
|
||||
this.sourceType,
|
||||
});
|
||||
|
||||
@override
|
||||
|
|
@ -61,10 +63,11 @@ class ContributionRecordsParams {
|
|||
runtimeType == other.runtimeType &&
|
||||
accountSequence == other.accountSequence &&
|
||||
page == other.page &&
|
||||
pageSize == other.pageSize;
|
||||
pageSize == other.pageSize &&
|
||||
sourceType == other.sourceType;
|
||||
|
||||
@override
|
||||
int get hashCode => accountSequence.hashCode ^ page.hashCode ^ pageSize.hashCode;
|
||||
int get hashCode => accountSequence.hashCode ^ page.hashCode ^ pageSize.hashCode ^ sourceType.hashCode;
|
||||
}
|
||||
|
||||
/// 贡献值记录 Provider
|
||||
|
|
@ -78,6 +81,7 @@ final contributionRecordsProvider = FutureProvider.family<ContributionRecordsPag
|
|||
final repository = ref.watch(contributionRepositoryProvider);
|
||||
final result = await repository.getContributionRecords(
|
||||
params.accountSequence,
|
||||
sourceType: params.sourceType,
|
||||
page: params.page,
|
||||
pageSize: params.pageSize,
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in New Issue