mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-28 06:15:51 +08:00
opt ui
opt req Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -37,127 +37,128 @@ class _FavPgcChildPageState extends State<FavPgcChildPage>
|
||||
super.build(context);
|
||||
final theme = Theme.of(context);
|
||||
final padding = MediaQuery.paddingOf(context);
|
||||
return LayoutBuilder(
|
||||
builder: (context, constraints) => Stack(
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
refreshIndicator(
|
||||
onRefresh: _favPgcController.onRefresh,
|
||||
child: CustomScrollView(
|
||||
controller: _favPgcController.scrollController,
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
slivers: [
|
||||
SliverPadding(
|
||||
padding: EdgeInsets.only(bottom: padding.bottom + 80),
|
||||
sliver: Obx(
|
||||
() => _buildBody(_favPgcController.loadingState.value),
|
||||
),
|
||||
final bottomH = 50 + padding.bottom;
|
||||
return Stack(
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
refreshIndicator(
|
||||
onRefresh: _favPgcController.onRefresh,
|
||||
child: CustomScrollView(
|
||||
controller: _favPgcController.scrollController,
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
slivers: [
|
||||
SliverPadding(
|
||||
padding: EdgeInsets.only(bottom: padding.bottom + 80),
|
||||
sliver: Obx(
|
||||
() => _buildBody(_favPgcController.loadingState.value),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Positioned(
|
||||
top: constraints.maxHeight,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Obx(
|
||||
() => AnimatedSlide(
|
||||
offset: _favPgcController.enableMultiSelect.value
|
||||
? const Offset(0, -1)
|
||||
: Offset.zero,
|
||||
duration: const Duration(milliseconds: 150),
|
||||
child: Container(
|
||||
padding: padding,
|
||||
decoration: BoxDecoration(
|
||||
color: theme.colorScheme.onInverseSurface,
|
||||
border: Border(
|
||||
top: BorderSide(
|
||||
width: 0.5,
|
||||
color: theme.colorScheme.outline.withValues(alpha: 0.5),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: -bottomH,
|
||||
child: Obx(
|
||||
() => AnimatedSlide(
|
||||
offset: _favPgcController.enableMultiSelect.value
|
||||
? const Offset(0, -1)
|
||||
: Offset.zero,
|
||||
duration: const Duration(milliseconds: 150),
|
||||
child: Container(
|
||||
height: bottomH,
|
||||
padding: padding,
|
||||
decoration: BoxDecoration(
|
||||
color: theme.colorScheme.onInverseSurface,
|
||||
border: Border(
|
||||
top: BorderSide(
|
||||
width: 0.5,
|
||||
color: theme.colorScheme.outline.withValues(alpha: 0.5),
|
||||
),
|
||||
),
|
||||
width: double.infinity,
|
||||
child: Row(
|
||||
children: [
|
||||
const SizedBox(width: 16),
|
||||
iconButton(
|
||||
size: 32,
|
||||
tooltip: '取消',
|
||||
context: context,
|
||||
icon: Icons.clear,
|
||||
onPressed: _favPgcController.onDisable,
|
||||
),
|
||||
width: double.infinity,
|
||||
child: Row(
|
||||
children: [
|
||||
const SizedBox(width: 16),
|
||||
iconButton(
|
||||
size: 32,
|
||||
tooltip: '取消',
|
||||
context: context,
|
||||
icon: Icons.clear,
|
||||
onPressed: _favPgcController.onDisable,
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Obx(
|
||||
() => Checkbox(
|
||||
value: _favPgcController.allSelected.value,
|
||||
onChanged: (value) {
|
||||
_favPgcController.handleSelect(
|
||||
checked: !_favPgcController.allSelected.value,
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Obx(
|
||||
() => Checkbox(
|
||||
value: _favPgcController.allSelected.value,
|
||||
onChanged: (value) {
|
||||
_favPgcController.handleSelect(
|
||||
!_favPgcController.allSelected.value,
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: () => _favPgcController.handleSelect(
|
||||
checked: !_favPgcController.allSelected.value,
|
||||
disableSelect: false,
|
||||
),
|
||||
GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: () => _favPgcController.handleSelect(
|
||||
!_favPgcController.allSelected.value,
|
||||
),
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: 14,
|
||||
bottom: 14,
|
||||
right: 12,
|
||||
),
|
||||
child: Text('全选'),
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: 14,
|
||||
bottom: 14,
|
||||
right: 12,
|
||||
),
|
||||
child: Text('全选'),
|
||||
),
|
||||
const Spacer(),
|
||||
...const [
|
||||
(followStatus: 1, title: '想看'),
|
||||
(followStatus: 2, title: '在看'),
|
||||
(followStatus: 3, title: '看过'),
|
||||
]
|
||||
.where(
|
||||
(item) => item.followStatus != widget.followStatus,
|
||||
)
|
||||
.map(
|
||||
(item) => Padding(
|
||||
padding: const EdgeInsets.only(left: 25),
|
||||
child: GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: () {
|
||||
if (_favPgcController.checkedCount != 0) {
|
||||
_favPgcController.onUpdateList(
|
||||
item.followStatus,
|
||||
);
|
||||
}
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 14,
|
||||
horizontal: 5,
|
||||
),
|
||||
child: Text(
|
||||
'标记为${item.title}',
|
||||
style: TextStyle(
|
||||
color: theme.colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
...const [
|
||||
(followStatus: 1, title: '想看'),
|
||||
(followStatus: 2, title: '在看'),
|
||||
(followStatus: 3, title: '看过'),
|
||||
]
|
||||
.where(
|
||||
(item) => item.followStatus != widget.followStatus,
|
||||
)
|
||||
.map(
|
||||
(item) => Padding(
|
||||
padding: const EdgeInsets.only(left: 25),
|
||||
child: GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: () {
|
||||
if (_favPgcController.checkedCount != 0) {
|
||||
_favPgcController.onUpdateList(
|
||||
item.followStatus,
|
||||
);
|
||||
}
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 14,
|
||||
horizontal: 5,
|
||||
),
|
||||
child: Text(
|
||||
'标记为${item.title}',
|
||||
style: TextStyle(
|
||||
color: theme.colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 20),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 20),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,14 +24,9 @@ class FavPgcController
|
||||
}
|
||||
|
||||
@override
|
||||
void onSelect(FavPgcItemModel item, [bool disableSelect = true]) {
|
||||
super.onSelect(item, false);
|
||||
}
|
||||
|
||||
@override
|
||||
void handleSelect([bool checked = false, bool disableSelect = true]) {
|
||||
void handleSelect({bool checked = false, bool disableSelect = true}) {
|
||||
allSelected.value = checked;
|
||||
super.handleSelect(checked, false);
|
||||
super.handleSelect(checked: checked, disableSelect: disableSelect);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -88,10 +83,10 @@ class FavPgcController
|
||||
..refresh();
|
||||
ctr.allSelected.value = false;
|
||||
}
|
||||
afterDelete(removeList);
|
||||
} catch (e) {
|
||||
if (kDebugMode) debugPrint('fav pgc onUpdate: $e');
|
||||
}
|
||||
afterDelete(removeList);
|
||||
}
|
||||
SmartDialog.showToast(res['msg']);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'package:PiliPlus/common/constants.dart';
|
||||
import 'package:PiliPlus/common/widgets/badge.dart';
|
||||
import 'package:PiliPlus/common/widgets/button/icon_button.dart';
|
||||
import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
|
||||
import 'package:PiliPlus/common/widgets/select_mask.dart';
|
||||
import 'package:PiliPlus/models/common/badge_type.dart';
|
||||
import 'package:PiliPlus/models_new/fav/fav_pgc/list.dart';
|
||||
import 'package:PiliPlus/pages/common/multi_select/base.dart';
|
||||
@@ -81,71 +82,11 @@ class FavPgcItem extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
Positioned.fill(
|
||||
child: IgnorePointer(
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) =>
|
||||
AnimatedOpacity(
|
||||
opacity: item.checked == true
|
||||
? 1
|
||||
: 0,
|
||||
duration: const Duration(
|
||||
milliseconds: 200,
|
||||
),
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
height: constraints.maxHeight,
|
||||
width:
|
||||
constraints.maxHeight *
|
||||
StyleString.aspectRatio,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius:
|
||||
const BorderRadius.all(
|
||||
Radius.circular(4),
|
||||
),
|
||||
color: Colors.black.withValues(
|
||||
alpha: 0.6,
|
||||
),
|
||||
),
|
||||
child: SizedBox(
|
||||
width: 34,
|
||||
height: 34,
|
||||
child: AnimatedScale(
|
||||
scale: item.checked == true
|
||||
? 1
|
||||
: 0,
|
||||
duration: const Duration(
|
||||
milliseconds: 250,
|
||||
),
|
||||
curve: Curves.easeInOut,
|
||||
child: IconButton(
|
||||
tooltip: '取消选择',
|
||||
style: ButtonStyle(
|
||||
padding:
|
||||
WidgetStateProperty.all(
|
||||
EdgeInsets.zero,
|
||||
),
|
||||
backgroundColor:
|
||||
WidgetStatePropertyAll(
|
||||
theme
|
||||
.colorScheme
|
||||
.surface
|
||||
.withValues(
|
||||
alpha: 0.8,
|
||||
),
|
||||
),
|
||||
),
|
||||
onPressed: null,
|
||||
icon: Icon(
|
||||
Icons.done_all_outlined,
|
||||
color: theme
|
||||
.colorScheme
|
||||
.primary,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
child: selectMask(
|
||||
theme,
|
||||
item.checked == true,
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(4),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user