Merge branch 'fix-seasonChange'
This commit is contained in:
@ -105,7 +105,8 @@ class _PagesBottomSheetState extends State<PagesBottomSheet>
|
|||||||
List<ScrollController>? _listScrollControllerList;
|
List<ScrollController>? _listScrollControllerList;
|
||||||
final String heroTag = Get.arguments['heroTag'];
|
final String heroTag = Get.arguments['heroTag'];
|
||||||
VideoDetailController? _videoDetailController;
|
VideoDetailController? _videoDetailController;
|
||||||
late RxInt isSubscribe = (-1).obs;
|
RxInt isSubscribe = (-1).obs;
|
||||||
|
bool isVisible = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@ -224,6 +225,13 @@ class _PagesBottomSheetState extends State<PagesBottomSheet>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 更改展开状态
|
||||||
|
void _changeVisible() {
|
||||||
|
setState(() {
|
||||||
|
isVisible = !isVisible;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
try {
|
try {
|
||||||
@ -255,7 +263,9 @@ class _PagesBottomSheetState extends State<PagesBottomSheet>
|
|||||||
UgcSeasonBuild(
|
UgcSeasonBuild(
|
||||||
ugcSeason: widget.ugcSeason!,
|
ugcSeason: widget.ugcSeason!,
|
||||||
isSubscribe: isSubscribe,
|
isSubscribe: isSubscribe,
|
||||||
|
isVisible: isVisible,
|
||||||
changeFucCall: _changeSubscribeStatus,
|
changeFucCall: _changeSubscribeStatus,
|
||||||
|
changeVisible: _changeVisible,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
Expanded(
|
Expanded(
|
||||||
@ -325,19 +335,23 @@ class _PagesBottomSheetState extends State<PagesBottomSheet>
|
|||||||
Widget buildTabBar() {
|
Widget buildTabBar() {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
TabBar(
|
// 背景色
|
||||||
controller: tabController,
|
Container(
|
||||||
isScrollable: true,
|
color: Theme.of(context).colorScheme.surface,
|
||||||
indicatorSize: TabBarIndicatorSize.label,
|
child: TabBar(
|
||||||
tabAlignment: TabAlignment.start,
|
controller: tabController,
|
||||||
splashBorderRadius: BorderRadius.circular(4),
|
isScrollable: true,
|
||||||
tabs: [
|
indicatorSize: TabBarIndicatorSize.label,
|
||||||
...widget.ugcSeason!.sections!.map((SectionItem section) {
|
tabAlignment: TabAlignment.start,
|
||||||
return Tab(
|
splashBorderRadius: BorderRadius.circular(4),
|
||||||
text: section.title,
|
tabs: [
|
||||||
);
|
...widget.ugcSeason!.sections!.map((SectionItem section) {
|
||||||
}).toList()
|
return Tab(
|
||||||
],
|
text: section.title,
|
||||||
|
);
|
||||||
|
}).toList()
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: TabBarView(
|
child: TabBarView(
|
||||||
@ -678,95 +692,133 @@ class EpisodeGridItem extends StatelessWidget {
|
|||||||
class UgcSeasonBuild extends StatelessWidget {
|
class UgcSeasonBuild extends StatelessWidget {
|
||||||
final UgcSeason ugcSeason;
|
final UgcSeason ugcSeason;
|
||||||
final RxInt isSubscribe;
|
final RxInt isSubscribe;
|
||||||
|
final bool isVisible;
|
||||||
final Function changeFucCall;
|
final Function changeFucCall;
|
||||||
|
final Function changeVisible;
|
||||||
|
|
||||||
const UgcSeasonBuild({
|
const UgcSeasonBuild({
|
||||||
Key? key,
|
Key? key,
|
||||||
required this.ugcSeason,
|
required this.ugcSeason,
|
||||||
required this.isSubscribe,
|
required this.isSubscribe,
|
||||||
|
required this.isVisible,
|
||||||
required this.changeFucCall,
|
required this.changeFucCall,
|
||||||
|
required this.changeVisible,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final ThemeData t = Theme.of(context);
|
final ThemeData theme = Theme.of(context);
|
||||||
final Color outline = t.colorScheme.outline;
|
final Color outline = theme.colorScheme.outline;
|
||||||
return Container(
|
final Color surface = theme.colorScheme.surface;
|
||||||
padding: const EdgeInsets.fromLTRB(12, 0, 12, 0),
|
final Color primary = theme.colorScheme.primary;
|
||||||
color: Theme.of(context).colorScheme.surface,
|
final Color onPrimary = theme.colorScheme.onPrimary;
|
||||||
child: Column(
|
final Color onInverseSurface = theme.colorScheme.onInverseSurface;
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
final TextStyle titleMedium = theme.textTheme.titleMedium!;
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
final TextStyle labelMedium = theme.textTheme.labelMedium!;
|
||||||
children: [
|
final Color dividerColor = theme.dividerColor.withOpacity(0.1);
|
||||||
Divider(
|
|
||||||
height: 1,
|
return isVisible
|
||||||
thickness: 1,
|
? Container(
|
||||||
color: Theme.of(context).dividerColor.withOpacity(0.1),
|
padding: const EdgeInsets.fromLTRB(12, 0, 12, 0),
|
||||||
),
|
color: surface,
|
||||||
const SizedBox(height: 10),
|
child: Column(
|
||||||
Text(
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
'合集:${ugcSeason.title}',
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
style: Theme.of(context).textTheme.titleMedium,
|
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
),
|
|
||||||
if (ugcSeason.intro != null && ugcSeason.intro != '') ...[
|
|
||||||
const SizedBox(height: 4),
|
|
||||||
Row(
|
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Divider(height: 1, thickness: 1, color: dividerColor),
|
||||||
child: Text(ugcSeason.intro ?? '',
|
const SizedBox(height: 10),
|
||||||
style: TextStyle(
|
Row(
|
||||||
color: Theme.of(context).colorScheme.outline)),
|
children: [
|
||||||
),
|
Expanded(
|
||||||
Obx(
|
child: Text(
|
||||||
() => isSubscribe.value == -1
|
'合集:${ugcSeason.title}',
|
||||||
? const SizedBox(height: 32)
|
style: titleMedium,
|
||||||
: SizedBox(
|
maxLines: 2,
|
||||||
height: 32,
|
overflow: TextOverflow.ellipsis,
|
||||||
child: FilledButton.tonal(
|
),
|
||||||
onPressed: () => changeFucCall.call(),
|
),
|
||||||
style: TextButton.styleFrom(
|
const SizedBox(width: 10),
|
||||||
padding: const EdgeInsets.only(
|
Obx(
|
||||||
left: 8,
|
() => isSubscribe.value == -1
|
||||||
right: 8,
|
? const SizedBox(height: 32)
|
||||||
|
: SizedBox(
|
||||||
|
height: 32,
|
||||||
|
child: FilledButton.tonal(
|
||||||
|
onPressed: () => changeFucCall.call(),
|
||||||
|
style: TextButton.styleFrom(
|
||||||
|
padding:
|
||||||
|
const EdgeInsets.only(left: 8, right: 8),
|
||||||
|
foregroundColor: isSubscribe.value == 1
|
||||||
|
? outline
|
||||||
|
: onPrimary,
|
||||||
|
backgroundColor: isSubscribe.value == 1
|
||||||
|
? onInverseSurface
|
||||||
|
: primary,
|
||||||
|
),
|
||||||
|
child:
|
||||||
|
Text(isSubscribe.value == 1 ? '已订阅' : '订阅'),
|
||||||
),
|
),
|
||||||
foregroundColor: isSubscribe.value == 1
|
|
||||||
? outline
|
|
||||||
: t.colorScheme.onPrimary,
|
|
||||||
backgroundColor: isSubscribe.value == 1
|
|
||||||
? t.colorScheme.onInverseSurface
|
|
||||||
: t.colorScheme.primary, // 设置按钮背景色
|
|
||||||
),
|
),
|
||||||
child: Text(isSubscribe.value == 1 ? '已订阅' : '订阅'),
|
),
|
||||||
),
|
],
|
||||||
),
|
|
||||||
),
|
),
|
||||||
const SizedBox(width: 6),
|
if (ugcSeason.intro != null && ugcSeason.intro != '') ...[
|
||||||
|
const SizedBox(height: 4),
|
||||||
|
Text(
|
||||||
|
ugcSeason.intro!,
|
||||||
|
style: TextStyle(color: outline, fontSize: 12),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
const SizedBox(height: 4),
|
||||||
|
Text.rich(
|
||||||
|
TextSpan(
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: labelMedium.fontSize, color: outline),
|
||||||
|
children: [
|
||||||
|
TextSpan(
|
||||||
|
text: '${Utils.numFormat(ugcSeason.stat!.view)}播放'),
|
||||||
|
const TextSpan(text: ' · '),
|
||||||
|
TextSpan(
|
||||||
|
text:
|
||||||
|
'${Utils.numFormat(ugcSeason.stat!.danmaku)}弹幕'),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 14),
|
||||||
|
Align(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: Material(
|
||||||
|
color: surface,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () => changeVisible.call(),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
vertical: 10, horizontal: 0),
|
||||||
|
child: Text(
|
||||||
|
'收起简介',
|
||||||
|
style: TextStyle(color: primary, fontSize: 12),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Divider(height: 1, thickness: 1, color: dividerColor),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
)
|
||||||
const SizedBox(height: 4),
|
: Align(
|
||||||
Text.rich(
|
alignment: Alignment.center,
|
||||||
TextSpan(
|
child: InkWell(
|
||||||
style: TextStyle(
|
onTap: () => changeVisible.call(),
|
||||||
fontSize: Theme.of(context).textTheme.labelMedium!.fontSize,
|
child: Padding(
|
||||||
color: Theme.of(context).colorScheme.outline,
|
padding:
|
||||||
|
const EdgeInsets.symmetric(vertical: 10, horizontal: 0),
|
||||||
|
child: Text(
|
||||||
|
'展开简介',
|
||||||
|
style: TextStyle(color: primary, fontSize: 12),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
children: [
|
|
||||||
TextSpan(text: '${Utils.numFormat(ugcSeason.stat!.view)}播放'),
|
|
||||||
const TextSpan(text: ' · '),
|
|
||||||
TextSpan(text: '${Utils.numFormat(ugcSeason.stat!.danmaku)}弹幕'),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
const SizedBox(height: 14),
|
|
||||||
Divider(
|
|
||||||
height: 1,
|
|
||||||
thickness: 1,
|
|
||||||
color: Theme.of(context).dividerColor.withOpacity(0.1),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user