mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-20 03:06:59 +08:00
* opt: sized * fix: self send * feat: ctrl enter to send * opt: checked * opt: download notifier * opt: Future.syncValue * mod: account * mod: loading state * opt: DebounceStreamMixin * opt: report * opt: enum map * opt: file handler * opt: dyn color * opt: Uint8List subview * opt: FileExt * opt: computeLuminance * opt: isNullOrEmpty * opt: Get context * update [skip ci] Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me> * opt dynamicColor [skip ci] Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me> * fixes [skip ci] * update Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me> * update Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me> --------- Signed-off-by: My-Responsitories <107370289+My-Responsitories@users.noreply.github.com> Co-authored-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
63 lines
1.6 KiB
Dart
63 lines
1.6 KiB
Dart
import 'package:PiliPlus/pages/common/multi_select/base.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
|
|
class MultiSelectAppBarWidget extends StatelessWidget
|
|
implements PreferredSizeWidget {
|
|
final MultiSelectBase ctr;
|
|
final bool? visible;
|
|
final AppBar child;
|
|
final List<Widget>? actions;
|
|
|
|
const MultiSelectAppBarWidget({
|
|
super.key,
|
|
required this.ctr,
|
|
this.visible,
|
|
this.actions,
|
|
required this.child,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
if (visible ?? ctr.enableMultiSelect.value) {
|
|
final style = TextButton.styleFrom(visualDensity: VisualDensity.compact);
|
|
final colorScheme = ColorScheme.of(context);
|
|
return AppBar(
|
|
bottom: child.bottom,
|
|
leading: IconButton(
|
|
tooltip: '取消',
|
|
onPressed: ctr.handleSelect,
|
|
icon: const Icon(Icons.close_outlined),
|
|
),
|
|
title: Obx(() => Text('已选: ${ctr.checkedCount}')),
|
|
actions: [
|
|
TextButton(
|
|
style: style,
|
|
onPressed: () => ctr.handleSelect(checked: true),
|
|
child: const Text('全选'),
|
|
),
|
|
...?actions,
|
|
TextButton(
|
|
style: style,
|
|
onPressed: () {
|
|
if (ctr.checkedCount == 0) {
|
|
return;
|
|
}
|
|
ctr.onRemove();
|
|
},
|
|
child: Text(
|
|
'移除',
|
|
style: TextStyle(color: colorScheme.error),
|
|
),
|
|
),
|
|
const SizedBox(width: 6),
|
|
],
|
|
);
|
|
}
|
|
return child;
|
|
}
|
|
|
|
@override
|
|
Size get preferredSize => child.preferredSize;
|
|
}
|