diff --git a/lib/app/modules/battle/teams/filter.dart b/lib/app/modules/battle/teams/filter.dart index 47ff648f7..7ab9e423d 100644 --- a/lib/app/modules/battle/teams/filter.dart +++ b/lib/app/modules/battle/teams/filter.dart @@ -5,6 +5,7 @@ import 'package:chaldea/app/modules/common/filter_page_base.dart'; import 'package:chaldea/generated/l10n.dart'; import 'package:chaldea/models/models.dart'; import 'package:chaldea/utils/extension.dart'; +import 'package:chaldea/widgets/widget_builders.dart'; enum TeamFilterMiscType { noOrderChange, @@ -40,6 +41,7 @@ class TeamFilterData with FilterDataMixin { final attackerTdCardType = FilterRadioData(); // attacker only final blockSvts = FilterGroupData(); final useSvts = FilterGroupData(); + int useSvtTdLv = 0; final blockCEs = FilterGroupData(); final blockCEMLBOnly = {}; // true=block MLB only final normalAttackCount = FilterRadioData.nonnull(-1); @@ -67,6 +69,7 @@ class TeamFilterData with FilterDataMixin { void reset() { super.reset(); favorite = false; + useSvtTdLv = 0; blockCEMLBOnly.clear(); } @@ -87,6 +90,13 @@ class TeamFilterData with FilterDataMixin { !filterData.useSvts.options.every((svtId) => data.formation.allSvts.any((e) => e?.svtId == svtId))) { return false; } + if (filterData.useSvts.options.length == 1 && filterData.useSvtTdLv > 0) { + final svtId = filterData.useSvts.options.single; + if (!data.formation.allSvts + .any((e) => e != null && e.svtId == svtId && (e.tdId ?? 0) != 0 && e.tdLv <= filterData.useSvtTdLv)) { + return false; + } + } bool _isCEMismatch(SvtSaveData? svt, int ceId) { if (svt == null || (svt.svtId ?? 0) <= 0) return false; @@ -396,6 +406,32 @@ class _TeamFilterPageState extends FilterPageState( + isDense: true, + value: filterData.useSvtTdLv, + items: [ + for (final tdLv in range(5)) + DropdownMenuItem(value: tdLv, child: Text(tdLv == 0 ? S.current.general_any : '≤Lv$tdLv')) + ], + onChanged: filterData.useSvts.options.length == 1 + ? (v) { + if (v != null) filterData.useSvtTdLv = v; + update(); + } + : null, + ), + ), FilterGroup( title: Text.rich(TextSpan(text: '${S.current.team_block_ce} ( ', children: [ TextSpan(