mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-01 16:48:16 +08:00
opt update block type
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -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(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user