mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-23 18:46:53 +08:00
@@ -58,73 +58,78 @@ class _LaterPageState extends State<LaterPage>
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Obx(
|
||||
() => PopScope(
|
||||
canPop: !_baseCtr.enableMultiSelect.value,
|
||||
onPopInvokedWithResult: (didPop, result) {
|
||||
if (_baseCtr.enableMultiSelect.value) {
|
||||
currCtr().handleSelect();
|
||||
}
|
||||
},
|
||||
child: Scaffold(
|
||||
resizeToAvoidBottomInset: false,
|
||||
appBar: _buildAppbar,
|
||||
floatingActionButton: Obx(
|
||||
() => currCtr().loadingState.value.isSuccess
|
||||
? FloatingActionButton.extended(
|
||||
onPressed: currCtr().toViewPlayAll,
|
||||
label: const Text('播放全部'),
|
||||
icon: const Icon(Icons.playlist_play),
|
||||
)
|
||||
: const SizedBox.shrink(),
|
||||
),
|
||||
body: SafeArea(
|
||||
top: false,
|
||||
bottom: false,
|
||||
child: Column(
|
||||
children: [
|
||||
TabBar(
|
||||
// isScrollable: true,
|
||||
// tabAlignment: TabAlignment.start,
|
||||
controller: _tabController,
|
||||
tabs: LaterViewType.values.map((item) {
|
||||
final count = _baseCtr.counts[item];
|
||||
return Tab(
|
||||
text: '${item.title}${count != -1 ? '($count)' : ''}');
|
||||
}).toList(),
|
||||
onTap: (_) {
|
||||
if (!_tabController.indexIsChanging) {
|
||||
currCtr().scrollController.animToTop();
|
||||
} else {
|
||||
if (_baseCtr.enableMultiSelect.value) {
|
||||
currCtr(_tabController.previousIndex).handleSelect();
|
||||
}
|
||||
}
|
||||
},
|
||||
),
|
||||
Expanded(
|
||||
child: TabBarView(
|
||||
physics: _baseCtr.enableMultiSelect.value
|
||||
? const NeverScrollableScrollPhysics()
|
||||
: const CustomTabBarViewScrollPhysics(),
|
||||
() {
|
||||
final enableMultiSelect = _baseCtr.enableMultiSelect.value;
|
||||
return PopScope(
|
||||
canPop: !enableMultiSelect,
|
||||
onPopInvokedWithResult: (didPop, result) {
|
||||
if (enableMultiSelect) {
|
||||
currCtr().handleSelect();
|
||||
}
|
||||
},
|
||||
child: Scaffold(
|
||||
resizeToAvoidBottomInset: false,
|
||||
appBar: _buildAppbar(enableMultiSelect),
|
||||
floatingActionButton: Obx(
|
||||
() => currCtr().loadingState.value.isSuccess
|
||||
? FloatingActionButton.extended(
|
||||
onPressed: currCtr().toViewPlayAll,
|
||||
label: const Text('播放全部'),
|
||||
icon: const Icon(Icons.playlist_play),
|
||||
)
|
||||
: const SizedBox.shrink(),
|
||||
),
|
||||
body: SafeArea(
|
||||
top: false,
|
||||
bottom: false,
|
||||
child: Column(
|
||||
children: [
|
||||
TabBar(
|
||||
// isScrollable: true,
|
||||
// tabAlignment: TabAlignment.start,
|
||||
controller: _tabController,
|
||||
children:
|
||||
LaterViewType.values.map((item) => item.page).toList(),
|
||||
tabs: LaterViewType.values.map((item) {
|
||||
final count = _baseCtr.counts[item];
|
||||
return Tab(
|
||||
text:
|
||||
'${item.title}${count != -1 ? '($count)' : ''}');
|
||||
}).toList(),
|
||||
onTap: (_) {
|
||||
if (!_tabController.indexIsChanging) {
|
||||
currCtr().scrollController.animToTop();
|
||||
} else {
|
||||
if (enableMultiSelect) {
|
||||
currCtr(_tabController.previousIndex).handleSelect();
|
||||
}
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
Expanded(
|
||||
child: TabBarView(
|
||||
physics: enableMultiSelect
|
||||
? const NeverScrollableScrollPhysics()
|
||||
: const CustomTabBarViewScrollPhysics(),
|
||||
controller: _tabController,
|
||||
children: LaterViewType.values
|
||||
.map((item) => item.page)
|
||||
.toList(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
PreferredSizeWidget get _buildAppbar {
|
||||
PreferredSizeWidget _buildAppbar(bool enableMultiSelect) {
|
||||
final theme = Theme.of(context);
|
||||
Color color = theme.colorScheme.secondary;
|
||||
|
||||
return AppBarWidget(
|
||||
visible: _baseCtr.enableMultiSelect.value,
|
||||
visible: enableMultiSelect,
|
||||
child1: AppBar(
|
||||
title: const Text('稍后再看'),
|
||||
actions: [
|
||||
@@ -248,11 +253,7 @@ class _LaterPageState extends State<LaterPage>
|
||||
onPressed: currCtr().handleSelect,
|
||||
icon: const Icon(Icons.close_outlined),
|
||||
),
|
||||
title: Obx(
|
||||
() => Text(
|
||||
'已选: ${_baseCtr.checkedCount.value}',
|
||||
),
|
||||
),
|
||||
title: Obx(() => Text('已选: ${_baseCtr.checkedCount.value}')),
|
||||
actions: [
|
||||
TextButton(
|
||||
style: TextButton.styleFrom(
|
||||
|
||||
Reference in New Issue
Block a user