opt update block type

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-11-30 11:16:48 +08:00
parent fc0af3f284
commit a48f6b1ca5

View File

@@ -370,8 +370,8 @@ mixin HeaderMixin<T extends StatefulWidget> on State<T> {
setState(() {}); setState(() {});
} }
void onUpdateBlockType(int blockType) { void onUpdateBlockType(int blockType, bool blocked) {
if (blockTypes.contains(blockType)) { if (blocked) {
blockTypes.remove(blockType); blockTypes.remove(blockType);
} else { } else {
blockTypes.add(blockType); blockTypes.add(blockType);
@@ -464,15 +464,16 @@ mixin HeaderMixin<T extends StatefulWidget> on State<T> {
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
child: Row( child: Row(
spacing: 10, spacing: 10,
children: blockTypesList children: blockTypesList.map(
.map( (e) {
(e) => ActionRowLineItem( final blocked = blockTypes.contains(e.value);
onTap: () => onUpdateBlockType(e.value), return ActionRowLineItem(
onTap: () => onUpdateBlockType(e.value, blocked),
text: e.label, text: e.label,
selectStatus: blockTypes.contains(e.value), selectStatus: blocked,
), );
) },
.toList(), ).toList(),
), ),
), ),
), ),