feat: 合集列表自动跳转指定index
This commit is contained in:
@ -27,6 +27,7 @@ class _PagesPanelState extends State<PagesPanel> {
|
|||||||
late int currentIndex;
|
late int currentIndex;
|
||||||
String heroTag = Get.arguments['heroTag'];
|
String heroTag = Get.arguments['heroTag'];
|
||||||
late VideoDetailController _videoDetailController;
|
late VideoDetailController _videoDetailController;
|
||||||
|
final ScrollController _scrollController = ScrollController();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@ -50,6 +51,12 @@ class _PagesPanelState extends State<PagesPanel> {
|
|||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_scrollController.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Column(
|
return Column(
|
||||||
@ -80,73 +87,92 @@ class _PagesPanelState extends State<PagesPanel> {
|
|||||||
onPressed: () {
|
onPressed: () {
|
||||||
showBottomSheet(
|
showBottomSheet(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (_) => Container(
|
builder: (BuildContext context) {
|
||||||
height: widget.sheetHeight,
|
return StatefulBuilder(builder:
|
||||||
color: Theme.of(context).colorScheme.background,
|
(BuildContext context, StateSetter setState) {
|
||||||
child: Column(
|
WidgetsBinding.instance
|
||||||
children: [
|
.addPostFrameCallback((_) async {
|
||||||
Container(
|
await Future.delayed(
|
||||||
height: 45,
|
const Duration(milliseconds: 200));
|
||||||
padding:
|
_scrollController.jumpTo(currentIndex * 56);
|
||||||
const EdgeInsets.only(left: 14, right: 14),
|
});
|
||||||
child: Row(
|
return Container(
|
||||||
mainAxisAlignment:
|
height: widget.sheetHeight,
|
||||||
MainAxisAlignment.spaceBetween,
|
color: Theme.of(context).colorScheme.background,
|
||||||
children: [
|
child: Column(
|
||||||
Text(
|
children: [
|
||||||
'合集(${episodes.length})',
|
Container(
|
||||||
style:
|
height: 45,
|
||||||
Theme.of(context).textTheme.titleMedium,
|
padding: const EdgeInsets.only(
|
||||||
|
left: 14, right: 14),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'合集(${episodes.length})',
|
||||||
|
style: Theme.of(context)
|
||||||
|
.textTheme
|
||||||
|
.titleMedium,
|
||||||
|
),
|
||||||
|
IconButton(
|
||||||
|
icon: const Icon(Icons.close),
|
||||||
|
onPressed: () => Navigator.pop(context),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
IconButton(
|
),
|
||||||
icon: const Icon(Icons.close),
|
Divider(
|
||||||
onPressed: () => Navigator.pop(context),
|
height: 1,
|
||||||
),
|
color: Theme.of(context)
|
||||||
],
|
.dividerColor
|
||||||
),
|
.withOpacity(0.1),
|
||||||
),
|
),
|
||||||
Divider(
|
Expanded(
|
||||||
height: 1,
|
child: Material(
|
||||||
color: Theme.of(context)
|
child: ListView.builder(
|
||||||
.dividerColor
|
controller: _scrollController,
|
||||||
.withOpacity(0.1),
|
itemCount: episodes.length,
|
||||||
),
|
itemBuilder: (context, index) {
|
||||||
Expanded(
|
return ListTile(
|
||||||
child: Material(
|
onTap: () {
|
||||||
child: ListView.builder(
|
changeFucCall(
|
||||||
itemCount: episodes.length,
|
episodes[index], index);
|
||||||
itemBuilder: (context, index) {
|
Get.back();
|
||||||
return InkWell(
|
},
|
||||||
onTap: () {
|
dense: false,
|
||||||
changeFucCall(episodes[index], index);
|
leading: index == currentIndex
|
||||||
Get.back();
|
? Image.asset(
|
||||||
},
|
'assets/images/live.gif',
|
||||||
child: Padding(
|
color: Theme.of(context)
|
||||||
padding: const EdgeInsets.only(
|
.colorScheme
|
||||||
top: 10,
|
.primary,
|
||||||
bottom: 10,
|
height: 12,
|
||||||
left: 15,
|
)
|
||||||
right: 15),
|
: null,
|
||||||
child: Text(
|
title: Text(
|
||||||
episodes[index].pagePart!,
|
episodes[index].pagePart!,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
|
fontSize: 14,
|
||||||
color: index == currentIndex
|
color: index == currentIndex
|
||||||
? Theme.of(context)
|
? Theme.of(context)
|
||||||
.colorScheme
|
.colorScheme
|
||||||
.primary
|
.primary
|
||||||
: Theme.of(context)
|
: Theme.of(context)
|
||||||
.colorScheme
|
.colorScheme
|
||||||
.onSurface),
|
.onSurface,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
],
|
);
|
||||||
),
|
});
|
||||||
),
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
|
|||||||
@ -28,6 +28,7 @@ class _SeasonPanelState extends State<SeasonPanel> {
|
|||||||
late int currentIndex;
|
late int currentIndex;
|
||||||
String heroTag = Get.arguments['heroTag'];
|
String heroTag = Get.arguments['heroTag'];
|
||||||
late VideoDetailController _videoDetailController;
|
late VideoDetailController _videoDetailController;
|
||||||
|
final ScrollController _scrollController = ScrollController();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@ -73,6 +74,12 @@ class _SeasonPanelState extends State<SeasonPanel> {
|
|||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_scrollController.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Builder(builder: (context) {
|
return Builder(builder: (context) {
|
||||||
@ -90,63 +97,82 @@ class _SeasonPanelState extends State<SeasonPanel> {
|
|||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () => showBottomSheet(
|
onTap: () => showBottomSheet(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (_) => Container(
|
builder: (BuildContext context) {
|
||||||
height: widget.sheetHeight,
|
return StatefulBuilder(
|
||||||
color: Theme.of(context).colorScheme.background,
|
builder: (BuildContext context, StateSetter setState) {
|
||||||
child: Column(
|
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||||
children: [
|
await Future.delayed(const Duration(milliseconds: 200));
|
||||||
Container(
|
_scrollController.jumpTo(currentIndex * 56);
|
||||||
height: 45,
|
});
|
||||||
padding: const EdgeInsets.only(left: 14, right: 14),
|
return Container(
|
||||||
child: Row(
|
height: widget.sheetHeight,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
color: Theme.of(context).colorScheme.background,
|
||||||
children: [
|
child: Column(
|
||||||
Text(
|
children: [
|
||||||
'合集(${episodes.length})',
|
Container(
|
||||||
style: Theme.of(context).textTheme.titleMedium,
|
height: 45,
|
||||||
|
padding: const EdgeInsets.only(left: 14, right: 14),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'合集(${episodes.length})',
|
||||||
|
style: Theme.of(context).textTheme.titleMedium,
|
||||||
|
),
|
||||||
|
IconButton(
|
||||||
|
icon: const Icon(Icons.close),
|
||||||
|
onPressed: () => Navigator.pop(context),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
IconButton(
|
),
|
||||||
icon: const Icon(Icons.close),
|
Divider(
|
||||||
onPressed: () => Navigator.pop(context),
|
height: 1,
|
||||||
),
|
color:
|
||||||
],
|
Theme.of(context).dividerColor.withOpacity(0.1),
|
||||||
),
|
),
|
||||||
),
|
Expanded(
|
||||||
Divider(
|
child: Material(
|
||||||
height: 1,
|
child: ListView.builder(
|
||||||
color: Theme.of(context).dividerColor.withOpacity(0.1),
|
controller: _scrollController,
|
||||||
),
|
itemCount: episodes.length,
|
||||||
Expanded(
|
itemBuilder: (context, index) {
|
||||||
child: Material(
|
return ListTile(
|
||||||
child: ListView.builder(
|
onTap: () =>
|
||||||
itemCount: episodes.length,
|
changeFucCall(episodes[index], index),
|
||||||
itemBuilder: (context, index) {
|
dense: false,
|
||||||
return InkWell(
|
leading: index == currentIndex
|
||||||
onTap: () =>
|
? Image.asset(
|
||||||
changeFucCall(episodes[index], index),
|
'assets/images/live.gif',
|
||||||
child: Padding(
|
color: Theme.of(context)
|
||||||
padding: const EdgeInsets.only(
|
.colorScheme
|
||||||
top: 10, bottom: 10, left: 15, right: 15),
|
.primary,
|
||||||
child: Text(
|
height: 12,
|
||||||
episodes[index].title!,
|
)
|
||||||
style: TextStyle(
|
: null,
|
||||||
|
title: Text(
|
||||||
|
episodes[index].title!,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14,
|
||||||
color: index == currentIndex
|
color: index == currentIndex
|
||||||
? Theme.of(context)
|
? Theme.of(context)
|
||||||
.colorScheme
|
.colorScheme
|
||||||
.primary
|
.primary
|
||||||
: Theme.of(context)
|
: Theme.of(context)
|
||||||
.colorScheme
|
.colorScheme
|
||||||
.onSurface),
|
.onSurface,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
],
|
);
|
||||||
),
|
});
|
||||||
),
|
},
|
||||||
),
|
),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.fromLTRB(8, 12, 8, 12),
|
padding: const EdgeInsets.fromLTRB(8, 12, 8, 12),
|
||||||
|
|||||||
Reference in New Issue
Block a user