Merge branch 'main' into feature-cookies
This commit is contained in:
@ -98,14 +98,16 @@ class _PagesBottomSheetState extends State<PagesBottomSheet>
|
||||
with TickerProviderStateMixin {
|
||||
final ScrollController _listScrollController = ScrollController();
|
||||
late ListObserverController _listObserverController;
|
||||
final ScrollController _scrollController = ScrollController();
|
||||
late GridObserverController _gridObserverController;
|
||||
final ScrollController _gridScrollController = ScrollController();
|
||||
late int currentIndex;
|
||||
TabController? tabController;
|
||||
List<ListObserverController>? _listObserverControllerList;
|
||||
List<ScrollController>? _listScrollControllerList;
|
||||
final String heroTag = Get.arguments['heroTag'];
|
||||
VideoDetailController? _videoDetailController;
|
||||
late RxInt isSubscribe = (-1).obs;
|
||||
RxInt isSubscribe = (-1).obs;
|
||||
bool isVisible = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@ -162,6 +164,9 @@ class _PagesBottomSheetState extends State<PagesBottomSheet>
|
||||
);
|
||||
},
|
||||
);
|
||||
} else {
|
||||
_gridObserverController =
|
||||
GridObserverController(controller: _gridScrollController);
|
||||
}
|
||||
}
|
||||
|
||||
@ -177,25 +182,19 @@ class _PagesBottomSheetState extends State<PagesBottomSheet>
|
||||
isFixedHeight: true,
|
||||
);
|
||||
} else {
|
||||
_listObserverControllerList![widget.currentEpisodeIndex!]
|
||||
_listObserverControllerList![widget.currentEpisodeIndex ?? 0]
|
||||
.initialIndexModel = ObserverIndexPositionModel(
|
||||
index: currentIndex,
|
||||
isFixedHeight: true,
|
||||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
_gridObserverController.initialIndexModel = ObserverIndexPositionModel(
|
||||
index: currentIndex,
|
||||
isFixedHeight: false,
|
||||
);
|
||||
}
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (widget.dataType != VideoEpidoesType.videoEpisode) {
|
||||
double itemHeight = (widget.isFullScreen
|
||||
? 400
|
||||
: Get.size.width - 3 * StyleString.safeSpace) /
|
||||
5.2;
|
||||
double offset = ((currentIndex - 1) / 2).ceil() * itemHeight;
|
||||
_scrollController.jumpTo(offset);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 获取订阅状态
|
||||
@ -224,11 +223,20 @@ class _PagesBottomSheetState extends State<PagesBottomSheet>
|
||||
}
|
||||
}
|
||||
|
||||
// 更改展开状态
|
||||
void _changeVisible() {
|
||||
setState(() {
|
||||
isVisible = !isVisible;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
try {
|
||||
_listObserverController.controller?.dispose();
|
||||
_gridObserverController.controller?.dispose();
|
||||
_listScrollController.dispose();
|
||||
_gridScrollController.dispose();
|
||||
for (var element in _listObserverControllerList!) {
|
||||
element.controller?.dispose();
|
||||
}
|
||||
@ -255,7 +263,9 @@ class _PagesBottomSheetState extends State<PagesBottomSheet>
|
||||
UgcSeasonBuild(
|
||||
ugcSeason: widget.ugcSeason!,
|
||||
isSubscribe: isSubscribe,
|
||||
isVisible: isVisible,
|
||||
changeFucCall: _changeSubscribeStatus,
|
||||
changeVisible: _changeVisible,
|
||||
),
|
||||
],
|
||||
Expanded(
|
||||
@ -293,24 +303,27 @@ class _PagesBottomSheetState extends State<PagesBottomSheet>
|
||||
: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 12.0), // 设置左右间距为12
|
||||
child: GridView.count(
|
||||
controller: _scrollController,
|
||||
crossAxisCount: 2,
|
||||
crossAxisSpacing: StyleString.safeSpace,
|
||||
childAspectRatio: 2.6,
|
||||
children: List.generate(
|
||||
widget.episodes.length,
|
||||
(index) {
|
||||
bool isCurrentIndex = currentIndex == index;
|
||||
return EpisodeGridItem(
|
||||
episode: widget.episodes[index],
|
||||
index: index,
|
||||
isCurrentIndex: isCurrentIndex,
|
||||
dataType: widget.dataType,
|
||||
changeFucCall: widget.changeFucCall,
|
||||
isFullScreen: widget.isFullScreen,
|
||||
);
|
||||
},
|
||||
child: GridViewObserver(
|
||||
controller: _gridObserverController,
|
||||
child: GridView.count(
|
||||
controller: _gridScrollController,
|
||||
crossAxisCount: 2,
|
||||
crossAxisSpacing: StyleString.safeSpace,
|
||||
childAspectRatio: 2.6,
|
||||
children: List.generate(
|
||||
widget.episodes.length,
|
||||
(index) {
|
||||
bool isCurrentIndex = currentIndex == index;
|
||||
return EpisodeGridItem(
|
||||
episode: widget.episodes[index],
|
||||
index: index,
|
||||
isCurrentIndex: isCurrentIndex,
|
||||
dataType: widget.dataType,
|
||||
changeFucCall: widget.changeFucCall,
|
||||
isFullScreen: widget.isFullScreen,
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -325,19 +338,23 @@ class _PagesBottomSheetState extends State<PagesBottomSheet>
|
||||
Widget buildTabBar() {
|
||||
return Column(
|
||||
children: [
|
||||
TabBar(
|
||||
controller: tabController,
|
||||
isScrollable: true,
|
||||
indicatorSize: TabBarIndicatorSize.label,
|
||||
tabAlignment: TabAlignment.start,
|
||||
splashBorderRadius: BorderRadius.circular(4),
|
||||
tabs: [
|
||||
...widget.ugcSeason!.sections!.map((SectionItem section) {
|
||||
return Tab(
|
||||
text: section.title,
|
||||
);
|
||||
}).toList()
|
||||
],
|
||||
// 背景色
|
||||
Container(
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
child: TabBar(
|
||||
controller: tabController,
|
||||
isScrollable: true,
|
||||
indicatorSize: TabBarIndicatorSize.label,
|
||||
tabAlignment: TabAlignment.start,
|
||||
splashBorderRadius: BorderRadius.circular(4),
|
||||
tabs: [
|
||||
...widget.ugcSeason!.sections!.map((SectionItem section) {
|
||||
return Tab(
|
||||
text: section.title,
|
||||
);
|
||||
}).toList()
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: TabBarView(
|
||||
@ -394,17 +411,29 @@ class TitleBar extends StatelessWidget {
|
||||
toolbarHeight: 45,
|
||||
automaticallyImplyLeading: false,
|
||||
centerTitle: false,
|
||||
title: Text(
|
||||
title,
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
elevation: 1,
|
||||
scrolledUnderElevation: 1,
|
||||
title: Padding(
|
||||
padding: const EdgeInsets.only(left: 12),
|
||||
child: Text(
|
||||
title,
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
),
|
||||
actions: !isFullScreen
|
||||
? [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.close, size: 20),
|
||||
onPressed: () => Navigator.pop(context),
|
||||
SizedBox(
|
||||
width: 35,
|
||||
height: 35,
|
||||
child: IconButton(
|
||||
icon: const Icon(Icons.close, size: 20),
|
||||
style: ButtonStyle(
|
||||
padding: MaterialStateProperty.all(EdgeInsets.zero),
|
||||
),
|
||||
onPressed: () => Navigator.pop(context),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 14),
|
||||
const SizedBox(width: 8),
|
||||
]
|
||||
: null,
|
||||
);
|
||||
@ -465,7 +494,7 @@ class EpisodeListItem extends StatelessWidget {
|
||||
dense: false,
|
||||
leading: isCurrentIndex
|
||||
? Image.asset(
|
||||
'assets/images/live.gif',
|
||||
'assets/images/live.png',
|
||||
color: primary,
|
||||
height: 12,
|
||||
)
|
||||
@ -678,95 +707,133 @@ class EpisodeGridItem extends StatelessWidget {
|
||||
class UgcSeasonBuild extends StatelessWidget {
|
||||
final UgcSeason ugcSeason;
|
||||
final RxInt isSubscribe;
|
||||
final bool isVisible;
|
||||
final Function changeFucCall;
|
||||
final Function changeVisible;
|
||||
|
||||
const UgcSeasonBuild({
|
||||
Key? key,
|
||||
required this.ugcSeason,
|
||||
required this.isSubscribe,
|
||||
required this.isVisible,
|
||||
required this.changeFucCall,
|
||||
required this.changeVisible,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final ThemeData t = Theme.of(context);
|
||||
final Color outline = t.colorScheme.outline;
|
||||
return Container(
|
||||
padding: const EdgeInsets.fromLTRB(12, 0, 12, 0),
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Divider(
|
||||
height: 1,
|
||||
thickness: 1,
|
||||
color: Theme.of(context).dividerColor.withOpacity(0.1),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Text(
|
||||
'合集:${ugcSeason.title}',
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
if (ugcSeason.intro != null && ugcSeason.intro != '') ...[
|
||||
const SizedBox(height: 4),
|
||||
Row(
|
||||
final ThemeData theme = Theme.of(context);
|
||||
final Color outline = theme.colorScheme.outline;
|
||||
final Color surface = theme.colorScheme.surface;
|
||||
final Color primary = theme.colorScheme.primary;
|
||||
final Color onPrimary = theme.colorScheme.onPrimary;
|
||||
final Color onInverseSurface = theme.colorScheme.onInverseSurface;
|
||||
final TextStyle titleMedium = theme.textTheme.titleMedium!;
|
||||
final TextStyle labelMedium = theme.textTheme.labelMedium!;
|
||||
final Color dividerColor = theme.dividerColor.withOpacity(0.1);
|
||||
|
||||
return isVisible
|
||||
? Container(
|
||||
padding: const EdgeInsets.fromLTRB(12, 0, 12, 0),
|
||||
color: surface,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(ugcSeason.intro ?? '',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.outline)),
|
||||
),
|
||||
Obx(
|
||||
() => isSubscribe.value == -1
|
||||
? const SizedBox(height: 32)
|
||||
: SizedBox(
|
||||
height: 32,
|
||||
child: FilledButton.tonal(
|
||||
onPressed: () => changeFucCall.call(),
|
||||
style: TextButton.styleFrom(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 8,
|
||||
right: 8,
|
||||
Divider(height: 1, thickness: 1, color: dividerColor),
|
||||
const SizedBox(height: 10),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
'合集:${ugcSeason.title}',
|
||||
style: titleMedium,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Obx(
|
||||
() => isSubscribe.value == -1
|
||||
? 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),
|
||||
Text.rich(
|
||||
TextSpan(
|
||||
style: TextStyle(
|
||||
fontSize: Theme.of(context).textTheme.labelMedium!.fontSize,
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
)
|
||||
: Align(
|
||||
alignment: Alignment.center,
|
||||
child: InkWell(
|
||||
onTap: () => changeVisible.call(),
|
||||
child: Padding(
|
||||
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),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
);
|
||||
}
|
||||
}
|
||||
|
126
lib/common/skeleton/video_intro.dart
Normal file
126
lib/common/skeleton/video_intro.dart
Normal file
@ -0,0 +1,126 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../constants.dart';
|
||||
import 'skeleton.dart';
|
||||
|
||||
class VideoIntroSkeleton extends StatelessWidget {
|
||||
const VideoIntroSkeleton({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Color bgColor = Theme.of(context).colorScheme.onInverseSurface;
|
||||
return Skeleton(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: StyleString.safeSpace),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(height: 18),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
height: 20,
|
||||
margin: const EdgeInsets.only(bottom: 6),
|
||||
color: bgColor,
|
||||
),
|
||||
Container(
|
||||
width: 220,
|
||||
height: 20,
|
||||
margin: const EdgeInsets.only(bottom: 12),
|
||||
color: bgColor,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 45,
|
||||
height: 14,
|
||||
color: bgColor,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Container(
|
||||
width: 45,
|
||||
height: 14,
|
||||
color: bgColor,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Container(
|
||||
width: 45,
|
||||
height: 14,
|
||||
color: bgColor,
|
||||
),
|
||||
const Spacer(),
|
||||
Container(
|
||||
width: 35,
|
||||
height: 14,
|
||||
color: bgColor,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 30),
|
||||
LayoutBuilder(builder: (context, constraints) {
|
||||
// 并列5个正方形
|
||||
double width = (constraints.maxWidth - 30) / 5;
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: List.generate(5, (index) {
|
||||
return Container(
|
||||
width: width - 24,
|
||||
height: width - 24,
|
||||
decoration: BoxDecoration(
|
||||
color: bgColor,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
);
|
||||
}),
|
||||
);
|
||||
}),
|
||||
const SizedBox(height: 20),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
height: 30,
|
||||
margin: const EdgeInsets.symmetric(horizontal: 6),
|
||||
decoration: BoxDecoration(
|
||||
color: bgColor,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Row(
|
||||
children: [
|
||||
ClipOval(
|
||||
child: Container(
|
||||
width: 44,
|
||||
height: 44,
|
||||
color: bgColor,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Container(
|
||||
width: 50,
|
||||
height: 14,
|
||||
color: bgColor,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Container(
|
||||
width: 35,
|
||||
height: 14,
|
||||
color: bgColor,
|
||||
),
|
||||
const Spacer(),
|
||||
Container(
|
||||
width: 55,
|
||||
height: 30,
|
||||
decoration: BoxDecoration(
|
||||
color: bgColor,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 2)
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:pilipala/utils/storage.dart';
|
||||
|
||||
Box<dynamic> setting = GStrorage.setting;
|
||||
Box<dynamic> setting = GStorage.setting;
|
||||
|
||||
class CustomToast extends StatelessWidget {
|
||||
const CustomToast({super.key, required this.msg});
|
||||
|
25
lib/common/widgets/drag_handle.dart
Normal file
25
lib/common/widgets/drag_handle.dart
Normal file
@ -0,0 +1,25 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class DragHandle extends StatelessWidget {
|
||||
const DragHandle({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: Navigator.of(context).pop,
|
||||
child: SizedBox(
|
||||
height: 36,
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: 32,
|
||||
height: 4,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -5,6 +5,8 @@ import 'package:pilipala/plugin/pl_gallery/hero_dialog_route.dart';
|
||||
import 'package:pilipala/plugin/pl_gallery/interactiveviewer_gallery.dart';
|
||||
import 'package:pilipala/utils/highlight.dart';
|
||||
|
||||
import '../../utils/global_data_cache.dart';
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class HtmlRender extends StatelessWidget {
|
||||
const HtmlRender({
|
||||
@ -41,6 +43,8 @@ class HtmlRender extends StatelessWidget {
|
||||
TagExtension(
|
||||
tagsToExtend: <String>{'img'},
|
||||
builder: (ExtensionContext extensionContext) {
|
||||
int defaultImgQuality = 10;
|
||||
defaultImgQuality = GlobalDataCache.imgQuality;
|
||||
try {
|
||||
final Map<String, dynamic> attributes =
|
||||
extensionContext.attributes;
|
||||
@ -99,13 +103,13 @@ class HtmlRender extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
},
|
||||
child: CachedNetworkImage(imageUrl: imgUrl),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
child: CachedNetworkImage(
|
||||
imageUrl: '$imgUrl@${defaultImgQuality}q.webp',
|
||||
),
|
||||
),
|
||||
);
|
||||
// return NetworkImgLayer(
|
||||
// width: isEmote ? 22 : Get.size.width - 24,
|
||||
// height: isEmote ? 22 : 200,
|
||||
// src: imgUrl,
|
||||
// );
|
||||
} catch (err) {
|
||||
return const SizedBox();
|
||||
}
|
||||
@ -138,6 +142,14 @@ class HtmlRender extends StatelessWidget {
|
||||
textAlign: TextAlign.justify,
|
||||
),
|
||||
'img': Style(margin: Margins.only(top: 4, bottom: 4)),
|
||||
'figcaption': Style(
|
||||
textAlign: TextAlign.center,
|
||||
margin: Margins.only(top: 8, bottom: 20),
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
'figure': Style(
|
||||
margin: Margins.zero,
|
||||
),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import 'package:pilipala/utils/global_data_cache.dart';
|
||||
import '../../utils/storage.dart';
|
||||
import '../constants.dart';
|
||||
|
||||
Box<dynamic> setting = GStrorage.setting;
|
||||
Box<dynamic> setting = GStorage.setting;
|
||||
|
||||
class NetworkImgLayer extends StatelessWidget {
|
||||
const NetworkImgLayer({
|
||||
@ -48,7 +48,7 @@ class NetworkImgLayer extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
int defaultImgQuality = 10;
|
||||
try {
|
||||
defaultImgQuality = GlobalDataCache().imgQuality;
|
||||
defaultImgQuality = GlobalDataCache.imgQuality;
|
||||
} catch (_) {}
|
||||
|
||||
if (src == '' || src == null) {
|
||||
|
@ -12,6 +12,7 @@ import '../../http/video.dart';
|
||||
import '../../utils/utils.dart';
|
||||
import '../constants.dart';
|
||||
import 'badge.dart';
|
||||
import 'drag_handle.dart';
|
||||
import 'network_img_layer.dart';
|
||||
import 'stat/danmu.dart';
|
||||
import 'stat/view.dart';
|
||||
@ -373,27 +374,12 @@ class MorePanel extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () => Get.back(),
|
||||
child: Container(
|
||||
height: 35,
|
||||
padding: const EdgeInsets.only(bottom: 2),
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: 32,
|
||||
height: 3,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(3))),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const DragHandle(),
|
||||
ListTile(
|
||||
onTap: () async => await menuActionHandler('block'),
|
||||
minLeadingWidth: 0,
|
||||
|
@ -5,6 +5,7 @@ import 'package:pilipala/utils/feed_back.dart';
|
||||
import 'package:pilipala/utils/image_save.dart';
|
||||
import 'package:pilipala/utils/route_push.dart';
|
||||
import '../../models/model_rec_video_item.dart';
|
||||
import 'drag_handle.dart';
|
||||
import 'stat/danmu.dart';
|
||||
import 'stat/view.dart';
|
||||
import '../../http/dynamics.dart';
|
||||
@ -368,27 +369,12 @@ class MorePanel extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () => Get.back(),
|
||||
child: Container(
|
||||
height: 35,
|
||||
padding: const EdgeInsets.only(bottom: 2),
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: 32,
|
||||
height: 3,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(3))),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const DragHandle(),
|
||||
ListTile(
|
||||
onTap: () async => await menuActionHandler('block'),
|
||||
minLeadingWidth: 0,
|
||||
|
@ -619,4 +619,11 @@ class Api {
|
||||
/// 获取空降区间
|
||||
static const String getSkipSegments =
|
||||
'${HttpString.sponsorBlockBaseUrl}/api/skipSegments';
|
||||
|
||||
/// 视频标签
|
||||
static const String videoTag = '/x/tag/archive/tags';
|
||||
|
||||
/// 修复标题和海报
|
||||
// /api/view?id=${aid} /all/video/av${aid} /video/av${aid}/
|
||||
static const String fixTitleAndPic = '${HttpString.biliplusBaseUrl}/api/view';
|
||||
}
|
||||
|
@ -1,8 +1,15 @@
|
||||
import 'package:pilipala/models/common/invalid_video.dart';
|
||||
import 'dart:convert';
|
||||
import 'dart:math';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:pilipala/models/sponsor_block/segment.dart';
|
||||
|
||||
import 'index.dart';
|
||||
|
||||
class CommonHttp {
|
||||
static final RegExp spmPrefixExp =
|
||||
RegExp(r'<meta name="spm_prefix" content="([^"]+?)">');
|
||||
static Future unReadDynamic() async {
|
||||
var res = await Request().get(Api.getUnreadDynamic,
|
||||
data: {'alltype_offset': 0, 'video_offset': '', 'article_offset': 0});
|
||||
@ -18,10 +25,9 @@ class CommonHttp {
|
||||
}
|
||||
|
||||
static Future querySkipSegments({required String bvid}) async {
|
||||
var res = await Request().get(Api.getSkipSegments, data: {
|
||||
var res = await Request().getWithoutCookie(Api.getSkipSegments, data: {
|
||||
'videoID': bvid,
|
||||
});
|
||||
print(res.data);
|
||||
if (res.data is List && res.data.isNotEmpty) {
|
||||
try {
|
||||
return {
|
||||
@ -39,9 +45,73 @@ class CommonHttp {
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
'status': true,
|
||||
'status': false,
|
||||
'data': [],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
static Future fixVideoPicAndTitle({required int aid}) async {
|
||||
var res = await Request().getWithoutCookie(Api.fixTitleAndPic, data: {
|
||||
'id': aid,
|
||||
});
|
||||
if (res != null) {
|
||||
if (res.data['code'] == -404) {
|
||||
return {
|
||||
'status': false,
|
||||
'data': null,
|
||||
'msg': '没有相关信息',
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
'status': true,
|
||||
'data': InvalidVideoModel.fromJson(res.data),
|
||||
};
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
'status': false,
|
||||
'data': null,
|
||||
'msg': '没有相关信息',
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
static Future buvidActivate() async {
|
||||
try {
|
||||
// 获取 HTML 数据
|
||||
var html = await Request().get(Api.dynamicSpmPrefix);
|
||||
|
||||
// 提取 spmPrefix
|
||||
String spmPrefix = spmPrefixExp.firstMatch(html.data)?.group(1) ?? '';
|
||||
|
||||
// 生成随机 PNG 结束部分
|
||||
Random rand = Random();
|
||||
String randPngEnd = base64.encode(
|
||||
List<int>.generate(32, (_) => rand.nextInt(256))
|
||||
..addAll(List<int>.filled(4, 0))
|
||||
..addAll([73, 69, 78, 68])
|
||||
..addAll(List<int>.generate(4, (_) => rand.nextInt(256))),
|
||||
);
|
||||
|
||||
// 构建 JSON 数据
|
||||
String jsonData = json.encode({
|
||||
'3064': 1,
|
||||
'39c8': '$spmPrefix.fp.risk',
|
||||
'3c43': {
|
||||
'adca': 'Linux',
|
||||
'bfe9': randPngEnd.substring(randPngEnd.length - 50),
|
||||
},
|
||||
});
|
||||
|
||||
// 发送 POST 请求
|
||||
await Request().post(
|
||||
Api.activateBuvidApi,
|
||||
data: {'payload': jsonData},
|
||||
options: Options(contentType: 'application/json'),
|
||||
);
|
||||
} catch (err) {
|
||||
debugPrint('buvidActivate error: $err');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,8 @@ class HttpString {
|
||||
static const String messageBaseUrl = 'https://message.bilibili.com';
|
||||
static const String bangumiBaseUrl = 'https://bili.meark.me';
|
||||
static const String sponsorBlockBaseUrl = 'https://www.bsbsb.top';
|
||||
static const String biliplusBaseUrl = 'https://www.biliplus.com';
|
||||
|
||||
static const List<int> validateStatusCodes = [
|
||||
302,
|
||||
304,
|
||||
|
@ -17,7 +17,9 @@ class DanmakaHttp {
|
||||
var response = await Request().get(
|
||||
Api.webDanmaku,
|
||||
data: params,
|
||||
extra: {'resType': ResponseType.bytes},
|
||||
options: Options(
|
||||
responseType: ResponseType.bytes,
|
||||
),
|
||||
);
|
||||
return DmSegMobileReply.fromBuffer(response.data);
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ class DynamicsHttp {
|
||||
|
||||
//
|
||||
static Future dynamicDetail({
|
||||
String? id,
|
||||
required String id,
|
||||
}) async {
|
||||
var res = await Request().get(Api.dynamicDetail, data: {
|
||||
'timezone_offset': -480,
|
||||
|
@ -1,9 +1,6 @@
|
||||
// ignore_for_file: avoid_print
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:developer';
|
||||
import 'dart:io';
|
||||
import 'dart:math' show Random;
|
||||
import 'package:cookie_jar/cookie_jar.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:dio/io.dart';
|
||||
@ -12,7 +9,6 @@ import 'package:hive/hive.dart';
|
||||
import 'package:pilipala/utils/id_utils.dart';
|
||||
import '../utils/storage.dart';
|
||||
import '../utils/utils.dart';
|
||||
import 'api.dart';
|
||||
import 'constants.dart';
|
||||
import 'interceptor.dart';
|
||||
|
||||
@ -21,19 +17,17 @@ class Request {
|
||||
static late CookieManager cookieManager;
|
||||
static late final Dio dio;
|
||||
factory Request() => _instance;
|
||||
Box setting = GStrorage.setting;
|
||||
static Box localCache = GStrorage.localCache;
|
||||
Box setting = GStorage.setting;
|
||||
static Box localCache = GStorage.localCache;
|
||||
late bool enableSystemProxy;
|
||||
late String systemProxyHost;
|
||||
late String systemProxyPort;
|
||||
static final RegExp spmPrefixExp =
|
||||
RegExp(r'<meta name="spm_prefix" content="([^"]+?)">');
|
||||
static String? buvid;
|
||||
|
||||
/// 设置cookie
|
||||
static setCookie() async {
|
||||
Box userInfoCache = GStrorage.userInfo;
|
||||
Box setting = GStrorage.setting;
|
||||
Box userInfoCache = GStorage.userInfo;
|
||||
Box setting = GStorage.setting;
|
||||
final String cookiePath = await Utils.getCookiePath();
|
||||
final PersistCookieJar cookieJar = PersistCookieJar(
|
||||
ignoreExpires: true,
|
||||
@ -50,11 +44,6 @@ class Request {
|
||||
baseUrlType = 'bangumi';
|
||||
}
|
||||
setBaseUrl(type: baseUrlType);
|
||||
try {
|
||||
await buvidActivate();
|
||||
} catch (e) {
|
||||
log("setCookie, ${e.toString()}");
|
||||
}
|
||||
|
||||
final String cookieString = cookie
|
||||
.map((Cookie cookie) => '${cookie.name}=${cookie.value}')
|
||||
@ -80,9 +69,12 @@ class Request {
|
||||
}
|
||||
|
||||
final List<Cookie> cookies = await cookieManager.cookieJar
|
||||
.loadForRequest(Uri.parse(HttpString.baseUrl));
|
||||
buvid = cookies.firstWhere((cookie) => cookie.name == 'buvid3').value;
|
||||
if (buvid == null) {
|
||||
.loadForRequest(Uri.parse(HttpString.apiBaseUrl));
|
||||
buvid = cookies
|
||||
.firstWhere((cookie) => cookie.name == 'buvid3',
|
||||
orElse: () => Cookie('buvid3', ''))
|
||||
.value;
|
||||
if (buvid == null || buvid!.isEmpty) {
|
||||
try {
|
||||
var result = await Request().get(
|
||||
"${HttpString.apiBaseUrl}/x/frontend/finger/spi",
|
||||
@ -110,30 +102,6 @@ class Request {
|
||||
dio.options.headers['referer'] = 'https://www.bilibili.com/';
|
||||
}
|
||||
|
||||
static Future buvidActivate() async {
|
||||
var html = await Request().get(Api.dynamicSpmPrefix);
|
||||
String spmPrefix = spmPrefixExp.firstMatch(html.data)!.group(1)!;
|
||||
Random rand = Random();
|
||||
String rand_png_end = base64.encode(
|
||||
List<int>.generate(32, (_) => rand.nextInt(256)) +
|
||||
List<int>.filled(4, 0) +
|
||||
[73, 69, 78, 68] +
|
||||
List<int>.generate(4, (_) => rand.nextInt(256)));
|
||||
|
||||
String jsonData = json.encode({
|
||||
'3064': 1,
|
||||
'39c8': '${spmPrefix}.fp.risk',
|
||||
'3c43': {
|
||||
'adca': 'Linux',
|
||||
'bfe9': rand_png_end.substring(rand_png_end.length - 50),
|
||||
},
|
||||
});
|
||||
|
||||
await Request().post(Api.activateBuvidApi,
|
||||
data: {'payload': jsonData},
|
||||
options: Options(contentType: 'application/json'));
|
||||
}
|
||||
|
||||
/*
|
||||
* config it and create
|
||||
*/
|
||||
@ -198,17 +166,13 @@ class Request {
|
||||
*/
|
||||
get(url, {data, Options? options, cancelToken, extra}) async {
|
||||
Response response;
|
||||
options ??= Options(); // 如果 options 为 null,则初始化一个新的 Options 对象
|
||||
ResponseType resType = ResponseType.json;
|
||||
|
||||
if (extra != null) {
|
||||
resType = extra['resType'] ?? ResponseType.json;
|
||||
if (extra['ua'] != null) {
|
||||
options.headers = {'user-agent': headerUa(type: extra['ua'])};
|
||||
options ??= Options();
|
||||
options.headers ??= <String, dynamic>{};
|
||||
options.headers?['user-agent'] = headerUa(type: extra['ua']);
|
||||
}
|
||||
}
|
||||
options.responseType = resType;
|
||||
|
||||
try {
|
||||
response = await dio.get(
|
||||
url,
|
||||
|
@ -4,6 +4,7 @@ import 'package:hive/hive.dart';
|
||||
import 'package:html/parser.dart';
|
||||
import 'package:pilipala/models/member/article.dart';
|
||||
import 'package:pilipala/models/member/like.dart';
|
||||
import 'package:pilipala/models/user/info.dart';
|
||||
import 'package:pilipala/utils/global_data_cache.dart';
|
||||
import '../common/constants.dart';
|
||||
import '../models/dynamics/result.dart';
|
||||
@ -25,7 +26,7 @@ class MemberHttp {
|
||||
}) async {
|
||||
String? wWebid;
|
||||
if ((await getWWebid(mid: mid))['status']) {
|
||||
wWebid = GlobalDataCache().wWebid;
|
||||
wWebid = GlobalDataCache.wWebid;
|
||||
}
|
||||
|
||||
Map params = await WbiSign().makSign({
|
||||
@ -470,11 +471,11 @@ class MemberHttp {
|
||||
SmartDialog.dismiss();
|
||||
if (res.data['code'] == 0) {
|
||||
String accessKey = res.data['data']['access_token'];
|
||||
Box localCache = GStrorage.localCache;
|
||||
Box userInfoCache = GStrorage.userInfo;
|
||||
var userInfo = userInfoCache.get('userInfoCache');
|
||||
Box localCache = GStorage.localCache;
|
||||
Box userInfoCache = GStorage.userInfo;
|
||||
final UserInfoData? userInfo = userInfoCache.get('userInfoCache');
|
||||
localCache.put(
|
||||
LocalCacheKey.accessKey, {'mid': userInfo.mid, 'value': accessKey});
|
||||
LocalCacheKey.accessKey, {'mid': userInfo!.mid, 'value': accessKey});
|
||||
return {'status': true, 'data': [], 'msg': '操作成功'};
|
||||
} else {
|
||||
return {
|
||||
@ -573,7 +574,7 @@ class MemberHttp {
|
||||
}
|
||||
|
||||
static Future getWWebid({required int mid}) async {
|
||||
String? wWebid = GlobalDataCache().wWebid;
|
||||
String? wWebid = GlobalDataCache.wWebid;
|
||||
if (wWebid != null) {
|
||||
return {'status': true, 'data': wWebid};
|
||||
}
|
||||
@ -587,7 +588,7 @@ class MemberHttp {
|
||||
final content = match.group(1);
|
||||
String decodedString = Uri.decodeComponent(content!);
|
||||
Map<String, dynamic> map = jsonDecode(decodedString);
|
||||
GlobalDataCache().wWebid = map['access_id'];
|
||||
GlobalDataCache.wWebid = map['access_id'];
|
||||
return {'status': true, 'data': map['access_id']};
|
||||
} else {
|
||||
return {'status': false, 'data': '请检查登录状态'};
|
||||
@ -604,7 +605,7 @@ class MemberHttp {
|
||||
}) async {
|
||||
String? wWebid;
|
||||
if ((await getWWebid(mid: mid))['status']) {
|
||||
wWebid = GlobalDataCache().wWebid;
|
||||
wWebid = GlobalDataCache.wWebid;
|
||||
}
|
||||
Map params = await WbiSign().makSign({
|
||||
'host_mid': mid,
|
||||
|
@ -1,4 +1,5 @@
|
||||
import 'dart:convert';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:html/parser.dart';
|
||||
import 'package:pilipala/models/read/opus.dart';
|
||||
import 'package:pilipala/models/read/read.dart';
|
||||
@ -65,6 +66,11 @@ class ReadHttp {
|
||||
var res = await Request().get(
|
||||
'https://www.bilibili.com/read/cv$id',
|
||||
extra: {'ua': 'pc'},
|
||||
options: Options(
|
||||
headers: {
|
||||
'cookie': 'opus-goback=1',
|
||||
},
|
||||
),
|
||||
);
|
||||
String scriptContent =
|
||||
extractScriptContents(parse(res.data).body!.outerHtml)[0];
|
||||
|
@ -11,7 +11,7 @@ import '../utils/storage.dart';
|
||||
import 'index.dart';
|
||||
|
||||
class SearchHttp {
|
||||
static Box setting = GStrorage.setting;
|
||||
static Box setting = GStorage.setting;
|
||||
static Future hotSearchList() async {
|
||||
var res = await Request().get(Api.hotSearchList);
|
||||
if (res.data is String) {
|
||||
|
@ -3,6 +3,7 @@ import 'dart:developer';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:pilipala/utils/id_utils.dart';
|
||||
import 'package:pilipala/models/video/tags.dart';
|
||||
import '../common/constants.dart';
|
||||
import '../models/common/reply_type.dart';
|
||||
import '../models/home/rcmd/result.dart';
|
||||
@ -25,11 +26,11 @@ import 'init.dart';
|
||||
/// 返回{'status': bool, 'data': List}
|
||||
/// view层根据 status 判断渲染逻辑
|
||||
class VideoHttp {
|
||||
static Box localCache = GStrorage.localCache;
|
||||
static Box setting = GStrorage.setting;
|
||||
static Box localCache = GStorage.localCache;
|
||||
static Box setting = GStorage.setting;
|
||||
static bool enableRcmdDynamic =
|
||||
setting.get(SettingBoxKey.enableRcmdDynamic, defaultValue: true);
|
||||
static Box userInfoCache = GStrorage.userInfo;
|
||||
static Box userInfoCache = GStorage.userInfo;
|
||||
|
||||
// 首页推荐视频
|
||||
static Future rcmdVideoList({required int ps, required int freshIdx}) async {
|
||||
@ -607,4 +608,19 @@ class VideoHttp {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// 获取视频标签
|
||||
static Future getVideoTag({required String bvid}) async {
|
||||
var res = await Request().get(Api.videoTag, data: {'bvid': bvid});
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': res.data['data'].map<VideoTagItem>((e) {
|
||||
return VideoTagItem.fromJson(e);
|
||||
}).toList()
|
||||
};
|
||||
} else {
|
||||
return {'status': false, 'data': [], 'msg': res.data['message']};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:dynamic_color/dynamic_color.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:pilipala/common/widgets/custom_toast.dart';
|
||||
import 'package:pilipala/http/common.dart';
|
||||
import 'package:pilipala/http/init.dart';
|
||||
import 'package:pilipala/models/common/color_type.dart';
|
||||
import 'package:pilipala/models/common/theme_type.dart';
|
||||
@ -32,7 +33,7 @@ void main() async {
|
||||
MediaKit.ensureInitialized();
|
||||
await SystemChrome.setPreferredOrientations(
|
||||
[DeviceOrientation.portraitUp, DeviceOrientation.portraitDown]);
|
||||
await GStrorage.init();
|
||||
await GStorage.init();
|
||||
clearLogs();
|
||||
Request();
|
||||
await Request.setCookie();
|
||||
@ -65,7 +66,8 @@ void main() async {
|
||||
}
|
||||
|
||||
PiliSchame.init();
|
||||
await GlobalDataCache().initialize();
|
||||
await GlobalDataCache.initialize();
|
||||
CommonHttp.buvidActivate();
|
||||
}
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
@ -73,7 +75,7 @@ class MyApp extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Box setting = GStrorage.setting;
|
||||
Box setting = GStorage.setting;
|
||||
// 主题色
|
||||
Color defaultColor =
|
||||
colorThemeTypes[setting.get(SettingBoxKey.customColor, defaultValue: 0)]
|
||||
@ -222,13 +224,23 @@ class BuildMainApp extends StatelessWidget {
|
||||
elevation: 20,
|
||||
);
|
||||
|
||||
return GetMaterialApp(
|
||||
title: 'PiliPala',
|
||||
theme: ThemeData(
|
||||
colorScheme: currentThemeValue == ThemeType.dark
|
||||
? darkColorScheme
|
||||
: lightColorScheme,
|
||||
AppBarTheme appBarTheme(ColorScheme colorScheme) {
|
||||
return AppBarTheme(
|
||||
backgroundColor: colorScheme.surface,
|
||||
foregroundColor: colorScheme.onSurface,
|
||||
elevation: 0,
|
||||
titleSpacing: 0,
|
||||
scrolledUnderElevation: 0,
|
||||
// titleTextStyle: TextStyle(
|
||||
// fontSize: Theme.of(context).textTheme.titleLarge!.fontSize),
|
||||
);
|
||||
}
|
||||
|
||||
ThemeData buildThemeData(ColorScheme colorScheme) {
|
||||
return ThemeData(
|
||||
colorScheme: colorScheme,
|
||||
snackBarTheme: snackBarTheme,
|
||||
appBarTheme: appBarTheme(colorScheme),
|
||||
pageTransitionsTheme: const PageTransitionsTheme(
|
||||
builders: <TargetPlatform, PageTransitionsBuilder>{
|
||||
TargetPlatform.android: ZoomPageTransitionsBuilder(
|
||||
@ -236,12 +248,20 @@ class BuildMainApp extends StatelessWidget {
|
||||
),
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return GetMaterialApp(
|
||||
title: 'PiliPala',
|
||||
theme: buildThemeData(
|
||||
currentThemeValue == ThemeType.dark
|
||||
? darkColorScheme
|
||||
: lightColorScheme,
|
||||
),
|
||||
darkTheme: ThemeData(
|
||||
colorScheme: currentThemeValue == ThemeType.light
|
||||
darkTheme: buildThemeData(
|
||||
currentThemeValue == ThemeType.light
|
||||
? lightColorScheme
|
||||
: darkColorScheme,
|
||||
snackBarTheme: snackBarTheme,
|
||||
),
|
||||
localizationsDelegates: const [
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
|
18
lib/models/common/comment_range_type.dart
Normal file
18
lib/models/common/comment_range_type.dart
Normal file
@ -0,0 +1,18 @@
|
||||
enum CommentRangeType {
|
||||
video,
|
||||
bangumi,
|
||||
// dynamic,
|
||||
}
|
||||
|
||||
extension ActionTypeExtension on CommentRangeType {
|
||||
String get value => [
|
||||
'video',
|
||||
'bangumi',
|
||||
// 'dynamic',
|
||||
][index];
|
||||
String get label => [
|
||||
'视频',
|
||||
'番剧',
|
||||
// '动态',
|
||||
][index];
|
||||
}
|
73
lib/models/common/invalid_video.dart
Normal file
73
lib/models/common/invalid_video.dart
Normal file
@ -0,0 +1,73 @@
|
||||
class InvalidVideoModel {
|
||||
final int? id;
|
||||
final int? ver;
|
||||
final int? aid;
|
||||
final String? lastupdate;
|
||||
final int? lastupdatets;
|
||||
final String? title;
|
||||
final String? description;
|
||||
final String? pic;
|
||||
final int? tid;
|
||||
final String? typename;
|
||||
final int? created;
|
||||
final String? createdAt;
|
||||
final String? author;
|
||||
final int? mid;
|
||||
final String? play;
|
||||
final String? coins;
|
||||
final String? review;
|
||||
final String? videoReview;
|
||||
final String? favorites;
|
||||
final String? tag;
|
||||
final List<String>? tagList;
|
||||
|
||||
InvalidVideoModel({
|
||||
this.id,
|
||||
this.ver,
|
||||
this.aid,
|
||||
this.lastupdate,
|
||||
this.lastupdatets,
|
||||
this.title,
|
||||
this.description,
|
||||
this.pic,
|
||||
this.tid,
|
||||
this.typename,
|
||||
this.created,
|
||||
this.createdAt,
|
||||
this.author,
|
||||
this.mid,
|
||||
this.play,
|
||||
this.coins,
|
||||
this.review,
|
||||
this.videoReview,
|
||||
this.favorites,
|
||||
this.tag,
|
||||
this.tagList,
|
||||
});
|
||||
|
||||
factory InvalidVideoModel.fromJson(Map<String, dynamic> json) {
|
||||
return InvalidVideoModel(
|
||||
id: json['id'],
|
||||
ver: json['ver'],
|
||||
aid: json['aid'],
|
||||
lastupdate: json['lastupdate'],
|
||||
lastupdatets: json['lastupdatets'],
|
||||
title: json['title'],
|
||||
description: json['description'],
|
||||
pic: json['pic'],
|
||||
tid: json['tid'],
|
||||
typename: json['typename'],
|
||||
created: json['created'],
|
||||
createdAt: json['created_at'],
|
||||
author: json['author'],
|
||||
mid: json['mid'],
|
||||
play: json['play'],
|
||||
coins: json['coins'],
|
||||
review: json['review'],
|
||||
videoReview: json['video_review'],
|
||||
favorites: json['favorites'],
|
||||
tag: json['tag'],
|
||||
tagList: json['tag'].toString().split(',').toList(),
|
||||
);
|
||||
}
|
||||
}
|
@ -125,6 +125,7 @@ class ReplyControl {
|
||||
this.upLike,
|
||||
this.isShow,
|
||||
this.entryText,
|
||||
this.entryTextNum,
|
||||
this.titleText,
|
||||
this.time,
|
||||
this.location,
|
||||
@ -135,6 +136,7 @@ class ReplyControl {
|
||||
bool? upLike;
|
||||
bool? isShow;
|
||||
String? entryText;
|
||||
int? entryTextNum;
|
||||
String? titleText;
|
||||
String? time;
|
||||
String? location;
|
||||
@ -155,6 +157,10 @@ class ReplyControl {
|
||||
}
|
||||
|
||||
entryText = json['sub_reply_entry_text'];
|
||||
// 正则匹配
|
||||
entryTextNum = json['sub_reply_entry_text'] != null
|
||||
? int.parse(RegExp(r"\d+").stringMatch(json['sub_reply_entry_text']!)!)
|
||||
: 0;
|
||||
titleText = json['sub_reply_title_text'];
|
||||
time = json['time_desc'];
|
||||
location = json['location'] != null ? json['location'].split(':')[1] : '';
|
||||
|
@ -29,7 +29,7 @@ class ReplyMember {
|
||||
avatar = json['avatar'];
|
||||
level = json['level_info']['current_level'];
|
||||
pendant = Pendant.fromJson(json['pendant']);
|
||||
officialVerify = json['officia_verify'];
|
||||
officialVerify = json['official_verify'];
|
||||
vip = json['vip'];
|
||||
fansDetail = json['fans_detail'];
|
||||
userSailing = json['user_sailing'] != null
|
||||
|
17
lib/models/video/tags.dart
Normal file
17
lib/models/video/tags.dart
Normal file
@ -0,0 +1,17 @@
|
||||
class VideoTagItem {
|
||||
String? tagName;
|
||||
int? tagId;
|
||||
int? tagType;
|
||||
|
||||
VideoTagItem({
|
||||
this.tagName,
|
||||
this.tagId,
|
||||
this.tagType,
|
||||
});
|
||||
|
||||
VideoTagItem.fromJson(Map<String, dynamic> json) {
|
||||
tagName = json['tag_name'];
|
||||
tagId = json['tag_id'];
|
||||
tagType = json['type'];
|
||||
}
|
||||
}
|
@ -39,9 +39,7 @@ class _AboutPageState extends State<AboutPage> {
|
||||
TextStyle subTitleStyle =
|
||||
TextStyle(fontSize: 13, color: Theme.of(context).colorScheme.outline);
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('关于', style: Theme.of(context).textTheme.titleMedium),
|
||||
),
|
||||
appBar: AppBar(title: const Text('关于')),
|
||||
body: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
|
@ -3,6 +3,7 @@ import 'package:get/get.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:pilipala/http/bangumi.dart';
|
||||
import 'package:pilipala/models/bangumi/list.dart';
|
||||
import 'package:pilipala/models/user/info.dart';
|
||||
import 'package:pilipala/utils/storage.dart';
|
||||
|
||||
class BangumiController extends GetxController {
|
||||
@ -12,17 +13,17 @@ class BangumiController extends GetxController {
|
||||
RxInt total = 0.obs;
|
||||
int _currentPage = 1;
|
||||
bool isLoadingMore = true;
|
||||
Box userInfoCache = GStrorage.userInfo;
|
||||
Box userInfoCache = GStorage.userInfo;
|
||||
RxBool userLogin = false.obs;
|
||||
late int mid;
|
||||
var userInfo;
|
||||
UserInfoData? userInfo;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
userInfo = userInfoCache.get('userInfoCache');
|
||||
if (userInfo != null) {
|
||||
mid = userInfo.mid;
|
||||
mid = userInfo!.mid!;
|
||||
}
|
||||
userLogin.value = userInfo != null;
|
||||
}
|
||||
@ -55,7 +56,7 @@ class BangumiController extends GetxController {
|
||||
if (userInfo == null) {
|
||||
return;
|
||||
}
|
||||
var result = await BangumiHttp.getRecentBangumi(mid: userInfo.mid);
|
||||
var result = await BangumiHttp.getRecentBangumi(mid: userInfo!.mid!);
|
||||
if (result['status']) {
|
||||
bangumiFollowList.value = result['data'].list;
|
||||
total.value = result['data'].total;
|
||||
|
@ -8,6 +8,7 @@ import 'package:pilipala/http/search.dart';
|
||||
import 'package:pilipala/http/video.dart';
|
||||
import 'package:pilipala/models/bangumi/info.dart';
|
||||
import 'package:pilipala/models/user/fav_folder.dart';
|
||||
import 'package:pilipala/models/user/info.dart';
|
||||
import 'package:pilipala/pages/video/detail/index.dart';
|
||||
import 'package:pilipala/pages/video/detail/reply/index.dart';
|
||||
import 'package:pilipala/plugin/pl_player/models/play_repeat.dart';
|
||||
@ -48,7 +49,7 @@ class BangumiIntroController extends GetxController {
|
||||
RxBool hasCoin = false.obs;
|
||||
// 是否收藏
|
||||
RxBool hasFav = false.obs;
|
||||
Box userInfoCache = GStrorage.userInfo;
|
||||
Box userInfoCache = GStorage.userInfo;
|
||||
bool userLogin = false;
|
||||
Rx<FavFolderData> favFolderData = FavFolderData().obs;
|
||||
List addMediaIdsNew = [];
|
||||
@ -57,7 +58,7 @@ class BangumiIntroController extends GetxController {
|
||||
RxBool isFollowed = false.obs;
|
||||
RxInt followStatus = 1.obs;
|
||||
int _tempThemeValue = -1;
|
||||
var userInfo;
|
||||
UserInfoData? userInfo;
|
||||
PersistentBottomSheetController? bottomSheetController;
|
||||
List<Map<String, dynamic>> followStatusList = [
|
||||
{'title': '标记为 「想看」', 'status': 1},
|
||||
@ -259,7 +260,7 @@ class BangumiIntroController extends GetxController {
|
||||
|
||||
Future queryVideoInFolder() async {
|
||||
var result = await VideoHttp.videoInFolder(
|
||||
mid: userInfo.mid, rid: IdUtils.bv2av(bvid));
|
||||
mid: userInfo!.mid!, rid: IdUtils.bv2av(bvid));
|
||||
if (result['status']) {
|
||||
favFolderData.value = result['data'];
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import 'package:get/get.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:pilipala/common/constants.dart';
|
||||
import 'package:pilipala/common/widgets/badge.dart';
|
||||
import 'package:pilipala/common/widgets/drag_handle.dart';
|
||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||
import 'package:pilipala/common/widgets/stat/danmu.dart';
|
||||
import 'package:pilipala/common/widgets/stat/view.dart';
|
||||
@ -116,7 +117,7 @@ class _BangumiInfoState extends State<BangumiInfo> {
|
||||
String heroTag = Get.arguments['heroTag'];
|
||||
late final BangumiIntroController bangumiIntroController;
|
||||
late final VideoDetailController videoDetailCtr;
|
||||
Box localCache = GStrorage.localCache;
|
||||
Box localCache = GStorage.localCache;
|
||||
late double sheetHeight;
|
||||
int? cid;
|
||||
bool isProcessing = false;
|
||||
@ -148,7 +149,7 @@ class _BangumiInfoState extends State<BangumiInfo> {
|
||||
|
||||
// 收藏
|
||||
showFavBottomSheet() async {
|
||||
if (bangumiIntroController.userInfo.mid == null) {
|
||||
if (bangumiIntroController.userInfo?.mid == null) {
|
||||
SmartDialog.showToast('账号未登录');
|
||||
return;
|
||||
}
|
||||
@ -445,27 +446,12 @@ class BangumiStatusWidget extends StatelessWidget {
|
||||
}
|
||||
|
||||
Widget morePanel(BuildContext context, BangumiIntroController ctr) {
|
||||
return Container(
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () => Get.back(),
|
||||
child: Container(
|
||||
height: 35,
|
||||
padding: const EdgeInsets.only(bottom: 2),
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: 32,
|
||||
height: 3,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(3))),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const DragHandle(),
|
||||
...ctr.followStatusList
|
||||
.map(
|
||||
(e) => ListTile(
|
||||
|
@ -1,10 +1,11 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:pilipala/common/widgets/drag_handle.dart';
|
||||
import 'package:pilipala/common/widgets/stat/danmu.dart';
|
||||
import 'package:pilipala/common/widgets/stat/view.dart';
|
||||
import 'package:pilipala/utils/storage.dart';
|
||||
|
||||
Box localCache = GStrorage.localCache;
|
||||
Box localCache = GStorage.localCache;
|
||||
late double sheetHeight;
|
||||
|
||||
class IntroDetail extends StatelessWidget {
|
||||
@ -23,94 +24,81 @@ class IntroDetail extends StatelessWidget {
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
);
|
||||
return Container(
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
padding: const EdgeInsets.only(left: 14, right: 14),
|
||||
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
|
||||
height: sheetHeight,
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
height: 35,
|
||||
padding: const EdgeInsets.only(bottom: 2),
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: 32,
|
||||
height: 3,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.onSecondaryContainer
|
||||
.withOpacity(0.5),
|
||||
borderRadius: const BorderRadius.all(Radius.circular(3))),
|
||||
),
|
||||
),
|
||||
),
|
||||
const DragHandle(),
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
bangumiDetail!.title,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 16, right: 16),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
bangumiDetail!.title,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Row(
|
||||
children: [
|
||||
StatView(
|
||||
view: bangumiDetail!.stat!['views'],
|
||||
size: 'medium',
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
StatDanMu(
|
||||
danmu: bangumiDetail!.stat!['danmakus'],
|
||||
size: 'medium',
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
bangumiDetail!.areas!.first['name'],
|
||||
style: smallTitle,
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
bangumiDetail!.publish!['pub_time_show'],
|
||||
style: smallTitle,
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
bangumiDetail!.newEp!['desc'],
|
||||
style: smallTitle,
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Text(
|
||||
'简介:',
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'${bangumiDetail!.evaluate!}',
|
||||
style: smallTitle.copyWith(fontSize: 13),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Text(
|
||||
'声优:',
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
bangumiDetail.actors,
|
||||
style: smallTitle.copyWith(fontSize: 13),
|
||||
),
|
||||
SizedBox(height: MediaQuery.of(context).padding.bottom + 20)
|
||||
],
|
||||
const SizedBox(height: 4),
|
||||
Row(
|
||||
children: [
|
||||
StatView(
|
||||
view: bangumiDetail!.stat!['views'],
|
||||
size: 'medium',
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
StatDanMu(
|
||||
danmu: bangumiDetail!.stat!['danmakus'],
|
||||
size: 'medium',
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
bangumiDetail!.areas!.first['name'],
|
||||
style: smallTitle,
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
bangumiDetail!.publish!['pub_time_show'],
|
||||
style: smallTitle,
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
bangumiDetail!.newEp!['desc'],
|
||||
style: smallTitle,
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Text(
|
||||
'简介:',
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'${bangumiDetail!.evaluate!}',
|
||||
style: smallTitle.copyWith(fontSize: 13),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Text(
|
||||
'声优:',
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
bangumiDetail.actors,
|
||||
style: smallTitle.copyWith(fontSize: 13),
|
||||
),
|
||||
SizedBox(height: MediaQuery.of(context).padding.bottom + 20)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
|
@ -5,6 +5,7 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:pilipala/models/bangumi/info.dart';
|
||||
import 'package:pilipala/models/user/info.dart';
|
||||
import 'package:pilipala/pages/video/detail/index.dart';
|
||||
import 'package:pilipala/utils/storage.dart';
|
||||
import '../../../common/pages_bottom_sheet.dart';
|
||||
@ -36,8 +37,8 @@ class BangumiPanel extends StatefulWidget {
|
||||
class _BangumiPanelState extends State<BangumiPanel> {
|
||||
late RxInt currentIndex = (-1).obs;
|
||||
final ScrollController listViewScrollCtr = ScrollController();
|
||||
Box userInfoCache = GStrorage.userInfo;
|
||||
dynamic userInfo;
|
||||
Box userInfoCache = GStorage.userInfo;
|
||||
UserInfoData? userInfo;
|
||||
// 默认未开通
|
||||
int vipStatus = 0;
|
||||
late int cid;
|
||||
@ -63,7 +64,7 @@ class _BangumiPanelState extends State<BangumiPanel> {
|
||||
/// 获取大会员状态
|
||||
userInfo = userInfoCache.get('userInfoCache');
|
||||
if (userInfo != null) {
|
||||
vipStatus = userInfo.vipStatus;
|
||||
vipStatus = userInfo!.vipStatus!;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@ class _BlackListPageState extends State<BlackListPage> {
|
||||
final ScrollController scrollController = ScrollController();
|
||||
Future? _futureBuilderFuture;
|
||||
bool _isLoadingMore = false;
|
||||
Box setting = GStrorage.setting;
|
||||
Box setting = GStorage.setting;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@ -55,14 +55,9 @@ class _BlackListPageState extends State<BlackListPage> {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
elevation: 0,
|
||||
scrolledUnderElevation: 0,
|
||||
titleSpacing: 0,
|
||||
centerTitle: false,
|
||||
title: Obx(
|
||||
() => Text(
|
||||
'黑名单管理 ${_blackListController.total.value == 0 ? '' : '- ${_blackListController.total.value}'}',
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -32,7 +32,7 @@ class _PlDanmakuState extends State<PlDanmaku> {
|
||||
late PlDanmakuController _plDanmakuController;
|
||||
DanmakuController? _controller;
|
||||
// bool danmuPlayStatus = true;
|
||||
Box setting = GStrorage.setting;
|
||||
Box setting = GStorage.setting;
|
||||
late bool enableShowDanmaku;
|
||||
late List blockTypes;
|
||||
late double showArea;
|
||||
|
@ -10,6 +10,7 @@ import 'package:pilipala/models/common/dynamics_type.dart';
|
||||
import 'package:pilipala/models/dynamics/result.dart';
|
||||
import 'package:pilipala/models/dynamics/up.dart';
|
||||
import 'package:pilipala/models/live/item.dart';
|
||||
import 'package:pilipala/models/user/info.dart';
|
||||
import 'package:pilipala/utils/feed_back.dart';
|
||||
import 'package:pilipala/utils/id_utils.dart';
|
||||
import 'package:pilipala/utils/route_push.dart';
|
||||
@ -50,11 +51,11 @@ class DynamicsController extends GetxController {
|
||||
];
|
||||
bool flag = false;
|
||||
RxInt initialValue = 0.obs;
|
||||
Box userInfoCache = GStrorage.userInfo;
|
||||
Box userInfoCache = GStorage.userInfo;
|
||||
RxBool userLogin = false.obs;
|
||||
var userInfo;
|
||||
UserInfoData? userInfo;
|
||||
RxBool isLoadingDynamic = false.obs;
|
||||
Box setting = GStrorage.setting;
|
||||
Box setting = GStorage.setting;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
@ -246,7 +247,7 @@ class DynamicsController extends GetxController {
|
||||
}
|
||||
upData.value.upList!.insertAll(0, [
|
||||
UpItem(face: '', uname: '全部动态', mid: -1),
|
||||
UpItem(face: userInfo.face, uname: '我', mid: userInfo.mid),
|
||||
UpItem(face: userInfo!.face, uname: '我', mid: userInfo!.mid),
|
||||
]);
|
||||
}
|
||||
return res;
|
||||
|
@ -24,7 +24,7 @@ class DynamicDetailController extends GetxController {
|
||||
ReplySortType _sortType = ReplySortType.time;
|
||||
RxString sortTypeTitle = ReplySortType.time.titles.obs;
|
||||
RxString sortTypeLabel = ReplySortType.time.labels.obs;
|
||||
Box setting = GStrorage.setting;
|
||||
Box setting = GStorage.setting;
|
||||
RxInt replyReqCode = 200.obs;
|
||||
bool isEnd = false;
|
||||
|
||||
@ -37,13 +37,13 @@ class DynamicDetailController extends GetxController {
|
||||
acount.value =
|
||||
int.parse(item!.modules!.moduleStat!.comment!.count ?? '0');
|
||||
}
|
||||
int deaultReplySortIndex =
|
||||
int defaultReplySortIndex =
|
||||
setting.get(SettingBoxKey.replySortType, defaultValue: 0);
|
||||
if (deaultReplySortIndex == 2) {
|
||||
if (defaultReplySortIndex == 2) {
|
||||
setting.put(SettingBoxKey.replySortType, 0);
|
||||
deaultReplySortIndex = 0;
|
||||
defaultReplySortIndex = 0;
|
||||
}
|
||||
_sortType = ReplySortType.values[deaultReplySortIndex];
|
||||
_sortType = ReplySortType.values[defaultReplySortIndex];
|
||||
sortTypeTitle.value = _sortType.titles;
|
||||
sortTypeLabel.value = _sortType.labels;
|
||||
}
|
||||
@ -123,4 +123,15 @@ class DynamicDetailController extends GetxController {
|
||||
Future onLoad() async {
|
||||
queryReplyList(reqType: 'onLoad');
|
||||
}
|
||||
|
||||
Future removeReply(int? rpid, int? frpid) async {
|
||||
// 移除一楼评论
|
||||
if (rpid != null) {
|
||||
replyList.removeWhere((item) {
|
||||
return item.rpid == rpid;
|
||||
});
|
||||
}
|
||||
|
||||
/// TODO 移除二楼评论
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,6 @@ import '../../../models/video/reply/item.dart';
|
||||
import '../widgets/dynamic_panel.dart';
|
||||
|
||||
class DynamicDetailPage extends StatefulWidget {
|
||||
// const DynamicDetailPage({super.key});
|
||||
const DynamicDetailPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
@ -90,19 +89,22 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
|
||||
_dynamicDetailController = Get.put(
|
||||
DynamicDetailController(oid, replyType),
|
||||
tag: opusId.toString());
|
||||
_futureBuilderFuture = _dynamicDetailController.queryReplyList();
|
||||
await _dynamicDetailController.reqHtmlByOpusId(opusId!);
|
||||
setState(() {});
|
||||
}
|
||||
} else {
|
||||
oid = moduleDynamic.major!.draw!.id!;
|
||||
}
|
||||
} catch (_) {}
|
||||
} catch (err) {
|
||||
print('err:${err.toString()}');
|
||||
}
|
||||
}
|
||||
if (!isOpusId) {
|
||||
_dynamicDetailController =
|
||||
Get.put(DynamicDetailController(oid, replyType), tag: oid.toString());
|
||||
_futureBuilderFuture ??= _dynamicDetailController.queryReplyList();
|
||||
}
|
||||
_futureBuilderFuture = _dynamicDetailController.queryReplyList();
|
||||
}
|
||||
|
||||
// 查看二级评论
|
||||
@ -111,14 +113,7 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
|
||||
int rpid = replyItem.rpid!;
|
||||
Get.to(
|
||||
() => Scaffold(
|
||||
appBar: AppBar(
|
||||
titleSpacing: 0,
|
||||
centerTitle: false,
|
||||
title: Text(
|
||||
'评论详情',
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
),
|
||||
appBar: AppBar(title: const Text('评论详情')),
|
||||
body: VideoReplyReplyPanel(
|
||||
oid: oid,
|
||||
rpid: rpid,
|
||||
@ -139,7 +134,7 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
|
||||
// 分页加载
|
||||
if (scrollController.position.pixels >=
|
||||
scrollController.position.maxScrollExtent - 300) {
|
||||
EasyThrottle.throttle('replylist', const Duration(seconds: 2), () {
|
||||
EasyThrottle.throttle('replyList', const Duration(seconds: 2), () {
|
||||
_dynamicDetailController.onLoad();
|
||||
});
|
||||
}
|
||||
@ -192,10 +187,7 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
elevation: 0,
|
||||
scrolledUnderElevation: 1,
|
||||
centerTitle: false,
|
||||
titleSpacing: 0,
|
||||
title: StreamBuilder(
|
||||
stream: titleStreamC.stream,
|
||||
initialData: false,
|
||||
@ -335,6 +327,8 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
|
||||
.replies!
|
||||
.add(replyItem);
|
||||
},
|
||||
onDelete:
|
||||
_dynamicDetailController.removeReply,
|
||||
);
|
||||
}
|
||||
},
|
||||
|
@ -47,7 +47,7 @@ class _DynamicForwardPageState extends State<DynamicForwardPage> {
|
||||
widget.cb?.call();
|
||||
_onClose();
|
||||
} else {
|
||||
SmartDialog.showToast(res['message']);
|
||||
SmartDialog.showToast(res['msg']);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ class _DynamicsPageState extends State<DynamicsPage>
|
||||
final MineController mineController = Get.put(MineController());
|
||||
late Future _futureBuilderFuture;
|
||||
late Future _futureBuilderFutureUp;
|
||||
Box userInfoCache = GStrorage.userInfo;
|
||||
Box userInfoCache = GStorage.userInfo;
|
||||
late ScrollController scrollController;
|
||||
|
||||
@override
|
||||
@ -78,8 +78,6 @@ class _DynamicsPageState extends State<DynamicsPage>
|
||||
super.build(context);
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
elevation: 0,
|
||||
scrolledUnderElevation: 0,
|
||||
title: SizedBox(
|
||||
height: 34,
|
||||
child: Stack(
|
||||
|
@ -90,7 +90,7 @@ class _ActionPanelState extends State<ActionPanel>
|
||||
SmartDialog.showToast('请先登录');
|
||||
return;
|
||||
}
|
||||
int mid = userInfo.mid;
|
||||
int mid = userInfo.mid!;
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
enableDrag: true,
|
||||
|
@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:pilipala/common/widgets/drag_handle.dart';
|
||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||
import 'package:pilipala/http/user.dart';
|
||||
import 'package:pilipala/utils/feed_back.dart';
|
||||
@ -108,28 +109,12 @@ class MorePanel extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
|
||||
// clipBehavior: Clip.hardEdge,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () => Get.back(),
|
||||
child: Container(
|
||||
height: 35,
|
||||
padding: const EdgeInsets.only(bottom: 2),
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: 32,
|
||||
height: 3,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(3))),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const DragHandle(),
|
||||
ListTile(
|
||||
onTap: () async {
|
||||
try {
|
||||
|
@ -34,6 +34,7 @@ class _UpPanelState extends State<UpPanel> {
|
||||
List<LiveUserItem> liveList = [];
|
||||
static const itemPadding = EdgeInsets.symmetric(horizontal: 5, vertical: 0);
|
||||
late MyInfo userInfo;
|
||||
RxBool showLiveUser = false.obs;
|
||||
|
||||
void listFormat() {
|
||||
userInfo = widget.upData.myInfo!;
|
||||
@ -131,21 +132,70 @@ class _UpPanelState extends State<UpPanel> {
|
||||
children: [
|
||||
const SizedBox(width: 10),
|
||||
if (liveList.isNotEmpty) ...[
|
||||
for (int i = 0; i < liveList.length; i++) ...[
|
||||
upItemBuild(liveList[i], i)
|
||||
],
|
||||
VerticalDivider(
|
||||
indent: 20,
|
||||
endIndent: 40,
|
||||
width: 26,
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.primary
|
||||
.withOpacity(0.5),
|
||||
Obx(
|
||||
() => AnimatedSwitcher(
|
||||
duration: const Duration(milliseconds: 300),
|
||||
transitionBuilder: (Widget child,
|
||||
Animation<double> animation) {
|
||||
return FadeTransition(
|
||||
opacity: animation, child: child);
|
||||
},
|
||||
child: showLiveUser.value
|
||||
? Row(
|
||||
key: ValueKey<bool>(showLiveUser.value),
|
||||
children: [
|
||||
for (int i = 0;
|
||||
i < liveList.length;
|
||||
i++)
|
||||
UpItemWidget(
|
||||
data: liveList[i],
|
||||
index: i,
|
||||
currentMid: currentMid,
|
||||
onClickUp: onClickUp,
|
||||
onClickUpAni: onClickUpAni,
|
||||
itemPadding: itemPadding,
|
||||
contentWidth: contentWidth,
|
||||
)
|
||||
],
|
||||
)
|
||||
: SizedBox.shrink(
|
||||
key: ValueKey<bool>(showLiveUser.value),
|
||||
),
|
||||
),
|
||||
),
|
||||
Obx(
|
||||
() => IconButton(
|
||||
onPressed: () {
|
||||
showLiveUser.value = !showLiveUser.value;
|
||||
},
|
||||
icon: AnimatedSwitcher(
|
||||
duration: const Duration(milliseconds: 300),
|
||||
transitionBuilder: (Widget child,
|
||||
Animation<double> animation) {
|
||||
return ScaleTransition(
|
||||
scale: animation, child: child);
|
||||
},
|
||||
child: Icon(
|
||||
!showLiveUser.value
|
||||
? Icons.arrow_forward_ios_rounded
|
||||
: Icons.arrow_back_ios_rounded,
|
||||
key: ValueKey<bool>(showLiveUser.value),
|
||||
size: 18,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
for (int i = 0; i < upList.length; i++) ...[
|
||||
upItemBuild(upList[i], i)
|
||||
UpItemWidget(
|
||||
data: upList[i],
|
||||
index: i,
|
||||
currentMid: currentMid,
|
||||
onClickUp: onClickUp,
|
||||
onClickUpAni: onClickUpAni,
|
||||
itemPadding: itemPadding,
|
||||
contentWidth: contentWidth,
|
||||
)
|
||||
],
|
||||
const SizedBox(width: 10),
|
||||
],
|
||||
@ -165,18 +215,103 @@ class _UpPanelState extends State<UpPanel> {
|
||||
)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Widget upItemBuild(data, i) {
|
||||
class _SliverHeaderDelegate extends SliverPersistentHeaderDelegate {
|
||||
_SliverHeaderDelegate({required this.height, required this.child});
|
||||
|
||||
final double height;
|
||||
final Widget child;
|
||||
|
||||
@override
|
||||
Widget build(
|
||||
BuildContext context, double shrinkOffset, bool overlapsContent) {
|
||||
return child;
|
||||
}
|
||||
|
||||
@override
|
||||
double get maxExtent => height;
|
||||
|
||||
@override
|
||||
double get minExtent => height;
|
||||
|
||||
@override
|
||||
bool shouldRebuild(covariant SliverPersistentHeaderDelegate oldDelegate) =>
|
||||
true;
|
||||
}
|
||||
|
||||
class UpPanelSkeleton extends StatelessWidget {
|
||||
const UpPanelSkeleton({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListView.builder(
|
||||
scrollDirection: Axis.horizontal,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
itemCount: 10,
|
||||
itemBuilder: ((context, index) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 0),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
width: 50,
|
||||
height: 50,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.onInverseSurface,
|
||||
borderRadius: BorderRadius.circular(50),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: const EdgeInsets.only(top: 6),
|
||||
width: 45,
|
||||
height: 12,
|
||||
color: Theme.of(context).colorScheme.onInverseSurface,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class UpItemWidget extends StatelessWidget {
|
||||
final dynamic data;
|
||||
final int index;
|
||||
final RxInt currentMid;
|
||||
final Function(dynamic, int) onClickUp;
|
||||
final Function(dynamic, int) onClickUpAni;
|
||||
// final Function() feedBack;
|
||||
final EdgeInsets itemPadding;
|
||||
final double contentWidth;
|
||||
|
||||
const UpItemWidget({
|
||||
Key? key,
|
||||
required this.data,
|
||||
required this.index,
|
||||
required this.currentMid,
|
||||
required this.onClickUp,
|
||||
required this.onClickUpAni,
|
||||
// required this.feedBack,
|
||||
required this.itemPadding,
|
||||
required this.contentWidth,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
feedBack();
|
||||
if (data.type == 'up') {
|
||||
EasyThrottle.throttle('follow', const Duration(milliseconds: 300),
|
||||
() {
|
||||
if (GlobalDataCache().enableDynamicSwitch) {
|
||||
onClickUp(data, i);
|
||||
if (GlobalDataCache.enableDynamicSwitch) {
|
||||
onClickUp(data, index);
|
||||
} else {
|
||||
onClickUpAni(data, i);
|
||||
onClickUpAni(data, index);
|
||||
}
|
||||
});
|
||||
} else if (data.type == 'live') {
|
||||
@ -251,13 +386,12 @@ class _UpPanelState extends State<UpPanel> {
|
||||
softWrap: false,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: currentMid.value == data.mid
|
||||
? Theme.of(context).colorScheme.primary
|
||||
: Theme.of(context).colorScheme.outline,
|
||||
fontSize: Theme.of(context)
|
||||
.textTheme
|
||||
.labelMedium!
|
||||
.fontSize),
|
||||
color: currentMid.value == data.mid
|
||||
? Theme.of(context).colorScheme.primary
|
||||
: Theme.of(context).colorScheme.outline,
|
||||
fontSize:
|
||||
Theme.of(context).textTheme.labelMedium!.fontSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -269,64 +403,3 @@ class _UpPanelState extends State<UpPanel> {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _SliverHeaderDelegate extends SliverPersistentHeaderDelegate {
|
||||
_SliverHeaderDelegate({required this.height, required this.child});
|
||||
|
||||
final double height;
|
||||
final Widget child;
|
||||
|
||||
@override
|
||||
Widget build(
|
||||
BuildContext context, double shrinkOffset, bool overlapsContent) {
|
||||
return child;
|
||||
}
|
||||
|
||||
@override
|
||||
double get maxExtent => height;
|
||||
|
||||
@override
|
||||
double get minExtent => height;
|
||||
|
||||
@override
|
||||
bool shouldRebuild(covariant SliverPersistentHeaderDelegate oldDelegate) =>
|
||||
true;
|
||||
}
|
||||
|
||||
class UpPanelSkeleton extends StatelessWidget {
|
||||
const UpPanelSkeleton({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListView.builder(
|
||||
scrollDirection: Axis.horizontal,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
itemCount: 10,
|
||||
itemBuilder: ((context, index) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 0),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
width: 50,
|
||||
height: 50,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.onInverseSurface,
|
||||
borderRadius: BorderRadius.circular(50),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: const EdgeInsets.only(top: 6),
|
||||
width: 45,
|
||||
height: 12,
|
||||
color: Theme.of(context).colorScheme.onInverseSurface,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -3,17 +3,18 @@ import 'package:get/get.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:pilipala/http/fan.dart';
|
||||
import 'package:pilipala/models/fans/result.dart';
|
||||
import 'package:pilipala/models/user/info.dart';
|
||||
import 'package:pilipala/utils/storage.dart';
|
||||
|
||||
class FansController extends GetxController {
|
||||
Box userInfoCache = GStrorage.userInfo;
|
||||
Box userInfoCache = GStorage.userInfo;
|
||||
int pn = 1;
|
||||
int ps = 20;
|
||||
int total = 0;
|
||||
RxList<FansItemModel> fansList = <FansItemModel>[].obs;
|
||||
late int mid;
|
||||
late String name;
|
||||
var userInfo;
|
||||
UserInfoData? userInfo;
|
||||
RxString loadingText = '加载中...'.obs;
|
||||
RxBool isOwner = false.obs;
|
||||
|
||||
@ -23,9 +24,9 @@ class FansController extends GetxController {
|
||||
userInfo = userInfoCache.get('userInfoCache');
|
||||
mid = Get.parameters['mid'] != null
|
||||
? int.parse(Get.parameters['mid']!)
|
||||
: userInfo.mid;
|
||||
isOwner.value = mid == userInfo.mid;
|
||||
name = Get.parameters['name'] ?? userInfo.uname;
|
||||
: userInfo!.mid!;
|
||||
isOwner.value = mid == userInfo?.mid;
|
||||
name = Get.parameters['name'] ?? userInfo?.uname ?? '';
|
||||
}
|
||||
|
||||
Future queryFans(type) async {
|
||||
|
@ -49,13 +49,8 @@ class _FansPageState extends State<FansPage> {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
elevation: 0,
|
||||
scrolledUnderElevation: 0,
|
||||
centerTitle: false,
|
||||
titleSpacing: 0,
|
||||
title: Text(
|
||||
_fansController.isOwner.value ? '我的粉丝' : '${_fansController.name}的粉丝',
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
),
|
||||
body: RefreshIndicator(
|
||||
|
@ -11,7 +11,7 @@ class FavController extends GetxController {
|
||||
final ScrollController scrollController = ScrollController();
|
||||
Rx<FavFolderData> favFolderData = FavFolderData().obs;
|
||||
RxList<FavFolderItemData> favFolderList = <FavFolderItemData>[].obs;
|
||||
Box userInfoCache = GStrorage.userInfo;
|
||||
Box userInfoCache = GStorage.userInfo;
|
||||
UserInfoData? userInfo;
|
||||
int currentPage = 1;
|
||||
int pageSize = 60;
|
||||
|
@ -40,11 +40,8 @@ class _FavPageState extends State<FavPage> {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
centerTitle: false,
|
||||
titleSpacing: 0,
|
||||
title: Obx(() => Text(
|
||||
'${_favController.isOwner.value ? '我' : 'Ta'}的收藏',
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
)),
|
||||
actions: [
|
||||
Obx(() => !_favController.isOwner.value
|
||||
|
@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:pilipala/http/common.dart';
|
||||
import 'package:pilipala/http/user.dart';
|
||||
import 'package:pilipala/http/video.dart';
|
||||
import 'package:pilipala/models/user/fav_detail.dart';
|
||||
@ -8,6 +9,8 @@ import 'package:pilipala/models/user/fav_folder.dart';
|
||||
import 'package:pilipala/pages/fav/index.dart';
|
||||
import 'package:pilipala/utils/utils.dart';
|
||||
|
||||
import 'widget/invalid_video_card.dart';
|
||||
|
||||
class FavDetailController extends GetxController {
|
||||
FavFolderItemData? item;
|
||||
RxString title = ''.obs;
|
||||
@ -131,8 +134,9 @@ class FavDetailController extends GetxController {
|
||||
'privacy': [22, 0].contains(item!.attr) ? 0 : 1,
|
||||
},
|
||||
);
|
||||
title.value = res['title'];
|
||||
print(title);
|
||||
if (res != null) {
|
||||
title.value = res['title'];
|
||||
}
|
||||
}
|
||||
|
||||
Future toViewPlayAll() async {
|
||||
@ -152,4 +156,22 @@ class FavDetailController extends GetxController {
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
// 查看无效视频信息
|
||||
Future toViewInvalidVideo(FavDetailItemData item) async {
|
||||
SmartDialog.showLoading(msg: '加载中...');
|
||||
var res = await CommonHttp.fixVideoPicAndTitle(aid: item.id!);
|
||||
SmartDialog.dismiss();
|
||||
if (res['status']) {
|
||||
showModalBottomSheet(
|
||||
context: Get.context!,
|
||||
isScrollControlled: true,
|
||||
builder: (context) {
|
||||
return InvalidVideoCard(videoInfo: res['data']);
|
||||
},
|
||||
);
|
||||
} else {
|
||||
SmartDialog.showToast(res['msg']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -226,6 +226,8 @@ class _FavDetailPageState extends State<FavDetailPage> {
|
||||
isOwner: _favDetailController.isOwner,
|
||||
callFn: () => _favDetailController
|
||||
.onCancelFav(favList[index].id),
|
||||
viewInvalidVideoCb: () => _favDetailController
|
||||
.toViewInvalidVideo(favList[index]),
|
||||
);
|
||||
}, childCount: favList.length),
|
||||
),
|
||||
|
@ -19,6 +19,7 @@ class FavVideoCardH extends StatelessWidget {
|
||||
final Function? callFn;
|
||||
final int? searchType;
|
||||
final String isOwner;
|
||||
final Function? viewInvalidVideoCb;
|
||||
|
||||
const FavVideoCardH({
|
||||
Key? key,
|
||||
@ -26,6 +27,7 @@ class FavVideoCardH extends StatelessWidget {
|
||||
this.callFn,
|
||||
this.searchType,
|
||||
required this.isOwner,
|
||||
this.viewInvalidVideoCb,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
@ -36,6 +38,10 @@ class FavVideoCardH extends StatelessWidget {
|
||||
return InkWell(
|
||||
onTap: () async {
|
||||
// int? seasonId;
|
||||
if (videoItem.title == '已失效视频') {
|
||||
viewInvalidVideoCb?.call();
|
||||
return;
|
||||
}
|
||||
String? epId;
|
||||
if (videoItem.ogv != null &&
|
||||
(videoItem.ogv['type_name'] == '番剧' ||
|
||||
@ -65,11 +71,17 @@ class FavVideoCardH extends StatelessWidget {
|
||||
epId != null ? SearchType.media_bangumi : SearchType.video,
|
||||
});
|
||||
},
|
||||
onLongPress: () => imageSaveDialog(
|
||||
context,
|
||||
videoItem,
|
||||
SmartDialog.dismiss,
|
||||
),
|
||||
onLongPress: () {
|
||||
if (videoItem.title == '已失效视频') {
|
||||
SmartDialog.showToast('视频已失效');
|
||||
return;
|
||||
}
|
||||
imageSaveDialog(
|
||||
context,
|
||||
videoItem,
|
||||
SmartDialog.dismiss,
|
||||
);
|
||||
},
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
|
97
lib/pages/fav_detail/widget/invalid_video_card.dart
Normal file
97
lib/pages/fav_detail/widget/invalid_video_card.dart
Normal file
@ -0,0 +1,97 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||
import 'package:pilipala/models/common/invalid_video.dart';
|
||||
|
||||
class InvalidVideoCard extends StatelessWidget {
|
||||
const InvalidVideoCard({required this.videoInfo, Key? key}) : super(key: key);
|
||||
final InvalidVideoModel videoInfo;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
const TextStyle textStyle = TextStyle(fontSize: 14.0);
|
||||
return Padding(
|
||||
padding: EdgeInsets.fromLTRB(
|
||||
12,
|
||||
14,
|
||||
12,
|
||||
MediaQuery.of(context).padding.bottom + 20,
|
||||
),
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
double maxWidth = constraints.maxWidth;
|
||||
double maxHeight = maxWidth * 9 / 16;
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
NetworkImgLayer(
|
||||
width: maxWidth,
|
||||
height: maxHeight,
|
||||
src: videoInfo.pic,
|
||||
radius: 20,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
SelectableText(
|
||||
videoInfo.title!,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
SelectableText(videoInfo.author!, style: textStyle),
|
||||
const SizedBox(height: 2),
|
||||
SelectableText('创建时间:${videoInfo.createdAt}', style: textStyle),
|
||||
SelectableText('更新时间:${videoInfo.lastupdate}',
|
||||
style: textStyle),
|
||||
SelectableText('分类:${videoInfo.typename}', style: textStyle),
|
||||
SelectableText(
|
||||
'投币:${videoInfo.coins} 收藏:${videoInfo.favorites}',
|
||||
style: textStyle),
|
||||
if (videoInfo.tagList != null &&
|
||||
videoInfo.tagList!.isNotEmpty) ...[
|
||||
const SizedBox(height: 6),
|
||||
_buildTags(context, videoInfo.tagList),
|
||||
],
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildTags(BuildContext context, List<String>? videoTags) {
|
||||
final ColorScheme colorScheme = Theme.of(context).colorScheme;
|
||||
return Wrap(
|
||||
spacing: 6,
|
||||
runSpacing: 6,
|
||||
direction: Axis.horizontal,
|
||||
textDirection: TextDirection.ltr,
|
||||
children: videoTags!.map((tag) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
Get.toNamed('/searchResult', parameters: {'keyword': tag});
|
||||
},
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: colorScheme.surfaceVariant.withOpacity(0.5),
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(vertical: 4, horizontal: 10),
|
||||
child: Text(
|
||||
tag,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
);
|
||||
}
|
||||
}
|
@ -53,6 +53,7 @@ class FavEditController extends GetxController {
|
||||
intro: intro,
|
||||
mediaId: mediaId!,
|
||||
cover: cover,
|
||||
privacy: privacy.value,
|
||||
);
|
||||
if (res['status']) {
|
||||
SmartDialog.showToast('编辑成功');
|
||||
@ -74,4 +75,14 @@ class FavEditController extends GetxController {
|
||||
SmartDialog.showToast(res['msg']);
|
||||
}
|
||||
}
|
||||
|
||||
void togglePrivacy() {
|
||||
if (privacy.value == 0) {
|
||||
privacy.value = 1;
|
||||
SmartDialog.showToast('设置为私密后,只有自己可见');
|
||||
} else {
|
||||
privacy.value = 0;
|
||||
SmartDialog.showToast('设置为公开后,所有人可见');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,36 +19,24 @@ class _FavEditPageState extends State<FavEditPage> {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
elevation: 0,
|
||||
scrolledUnderElevation: 0,
|
||||
title: Obx(
|
||||
() => _favEditController.type.value == 'add'
|
||||
? Text(
|
||||
'新建收藏夹',
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
)
|
||||
: Text(
|
||||
'编辑收藏夹',
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
? const Text('新建收藏夹')
|
||||
: const Text('编辑收藏夹'),
|
||||
),
|
||||
centerTitle: false,
|
||||
actions: [
|
||||
Obx(
|
||||
() => _favEditController.privacy.value == 0
|
||||
? IconButton(
|
||||
onPressed: () {
|
||||
_favEditController.privacy.value = 1;
|
||||
},
|
||||
icon: const Icon(Icons.lock_open_outlined))
|
||||
: IconButton(
|
||||
onPressed: () {
|
||||
_favEditController.privacy.value = 0;
|
||||
},
|
||||
icon: Icon(
|
||||
Icons.lock_outlined,
|
||||
color: Theme.of(context).colorScheme.error,
|
||||
)),
|
||||
() => IconButton(
|
||||
onPressed: _favEditController.togglePrivacy,
|
||||
icon: Icon(
|
||||
_favEditController.privacy.value == 0
|
||||
? Icons.lock_open_outlined
|
||||
: Icons.lock_outlined,
|
||||
color: _favEditController.privacy.value == 0
|
||||
? null
|
||||
: Theme.of(context).colorScheme.error,
|
||||
),
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: _favEditController.onSubmit, child: const Text('保存')),
|
||||
|
@ -47,7 +47,6 @@ class _FavSearchPageState extends State<FavSearchPage> {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
titleSpacing: 0,
|
||||
actions: [
|
||||
IconButton(
|
||||
onPressed: () => _favSearchCtr.submit(),
|
||||
|
@ -6,19 +6,20 @@ import 'package:pilipala/http/follow.dart';
|
||||
import 'package:pilipala/http/member.dart';
|
||||
import 'package:pilipala/models/follow/result.dart';
|
||||
import 'package:pilipala/models/member/tags.dart';
|
||||
import 'package:pilipala/models/user/info.dart';
|
||||
import 'package:pilipala/utils/storage.dart';
|
||||
|
||||
/// 查看自己的关注时,可以查看分类
|
||||
/// 查看其他人的关注时,只可以看全部
|
||||
class FollowController extends GetxController with GetTickerProviderStateMixin {
|
||||
Box userInfoCache = GStrorage.userInfo;
|
||||
Box userInfoCache = GStorage.userInfo;
|
||||
int pn = 1;
|
||||
int ps = 20;
|
||||
int total = 0;
|
||||
RxList<FollowItemModel> followList = <FollowItemModel>[].obs;
|
||||
late int mid;
|
||||
late String name;
|
||||
var userInfo;
|
||||
UserInfoData? userInfo;
|
||||
RxString loadingText = '加载中...'.obs;
|
||||
RxBool isOwner = false.obs;
|
||||
late List<MemberTagItemModel> followTags;
|
||||
@ -30,9 +31,9 @@ class FollowController extends GetxController with GetTickerProviderStateMixin {
|
||||
userInfo = userInfoCache.get('userInfoCache');
|
||||
mid = Get.parameters['mid'] != null
|
||||
? int.parse(Get.parameters['mid']!)
|
||||
: userInfo.mid;
|
||||
isOwner.value = mid == userInfo.mid;
|
||||
name = Get.parameters['name'] ?? userInfo.uname;
|
||||
: userInfo!.mid!;
|
||||
isOwner.value = mid == userInfo?.mid;
|
||||
name = Get.parameters['name'] ?? userInfo?.uname ?? '';
|
||||
}
|
||||
|
||||
Future queryFollowings(type) async {
|
||||
@ -68,7 +69,7 @@ class FollowController extends GetxController with GetTickerProviderStateMixin {
|
||||
|
||||
// 当查看当前用户的关注时,请求关注分组
|
||||
Future followUpTags() async {
|
||||
if (userInfo != null && mid == userInfo.mid) {
|
||||
if (userInfo != null && mid == userInfo!.mid) {
|
||||
var res = await MemberHttp.followUpTags();
|
||||
if (res['status']) {
|
||||
followTags = res['data'];
|
||||
|
@ -27,15 +27,10 @@ class _FollowPageState extends State<FollowPage> {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
elevation: 0,
|
||||
scrolledUnderElevation: 0,
|
||||
titleSpacing: 0,
|
||||
centerTitle: false,
|
||||
title: Text(
|
||||
_followController.isOwner.value
|
||||
? '我的关注'
|
||||
: '${_followController.name}的关注',
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
actions: [
|
||||
IconButton(
|
||||
|
@ -47,7 +47,6 @@ class _FollowSearchPageState extends State<FollowSearchPage> {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
titleSpacing: 0,
|
||||
actions: [
|
||||
IconButton(
|
||||
onPressed: reRequest,
|
||||
|
@ -12,11 +12,11 @@ class HistoryController extends GetxController {
|
||||
RxList<HisListItem> historyList = <HisListItem>[].obs;
|
||||
RxBool isLoadingMore = false.obs;
|
||||
RxBool pauseStatus = false.obs;
|
||||
Box localCache = GStrorage.localCache;
|
||||
Box localCache = GStorage.localCache;
|
||||
RxBool isLoading = false.obs;
|
||||
RxBool enableMultiple = false.obs;
|
||||
RxInt checkedCount = 0.obs;
|
||||
Box userInfoCache = GStrorage.userInfo;
|
||||
Box userInfoCache = GStorage.userInfo;
|
||||
UserInfoData? userInfo;
|
||||
|
||||
@override
|
||||
|
@ -69,12 +69,7 @@ class _HistoryPageState extends State<HistoryPage> {
|
||||
appBar: AppBarWidget(
|
||||
visible: _historyController.enableMultiple.value,
|
||||
child1: AppBar(
|
||||
titleSpacing: 0,
|
||||
centerTitle: false,
|
||||
title: Text(
|
||||
'观看记录',
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
title: const Text('观看记录'),
|
||||
actions: [
|
||||
IconButton(
|
||||
onPressed: () => Get.toNamed('/historySearch'),
|
||||
@ -127,8 +122,6 @@ class _HistoryPageState extends State<HistoryPage> {
|
||||
],
|
||||
),
|
||||
child2: AppBar(
|
||||
titleSpacing: 0,
|
||||
centerTitle: false,
|
||||
leading: IconButton(
|
||||
onPressed: () {
|
||||
_historyController.enableMultiple.value = false;
|
||||
@ -143,7 +136,6 @@ class _HistoryPageState extends State<HistoryPage> {
|
||||
title: Obx(
|
||||
() => Text(
|
||||
'已选择${_historyController.checkedCount.value}项',
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
|
@ -45,7 +45,6 @@ class _HistorySearchPageState extends State<HistorySearchPage> {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
titleSpacing: 0,
|
||||
actions: [
|
||||
IconButton(
|
||||
onPressed: () => _hisCtr.submit(),
|
||||
|
@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:pilipala/models/common/tab_type.dart';
|
||||
import 'package:pilipala/models/user/info.dart';
|
||||
import 'package:pilipala/utils/storage.dart';
|
||||
import '../../http/index.dart';
|
||||
|
||||
@ -14,12 +15,12 @@ class HomeController extends GetxController with GetTickerProviderStateMixin {
|
||||
late TabController tabController;
|
||||
late List tabsCtrList;
|
||||
late List<Widget> tabsPageList;
|
||||
Box userInfoCache = GStrorage.userInfo;
|
||||
Box settingStorage = GStrorage.setting;
|
||||
Box userInfoCache = GStorage.userInfo;
|
||||
Box settingStorage = GStorage.setting;
|
||||
RxBool userLogin = false.obs;
|
||||
RxString userFace = ''.obs;
|
||||
var userInfo;
|
||||
Box setting = GStrorage.setting;
|
||||
UserInfoData? userInfo;
|
||||
Box setting = GStorage.setting;
|
||||
late final StreamController<bool> searchBarStream =
|
||||
StreamController<bool>.broadcast();
|
||||
late bool hideSearchBar;
|
||||
@ -33,7 +34,7 @@ class HomeController extends GetxController with GetTickerProviderStateMixin {
|
||||
super.onInit();
|
||||
userInfo = userInfoCache.get('userInfoCache');
|
||||
userLogin.value = userInfo != null;
|
||||
userFace.value = userInfo != null ? userInfo.face : '';
|
||||
userFace.value = userInfo != null ? userInfo!.face! : '';
|
||||
hideSearchBar =
|
||||
setting.get(SettingBoxKey.hideSearchBar, defaultValue: false);
|
||||
if (setting.get(SettingBoxKey.enableSearchWord, defaultValue: true)) {
|
||||
@ -62,7 +63,7 @@ class HomeController extends GetxController with GetTickerProviderStateMixin {
|
||||
userInfo = await userInfoCache.get('userInfoCache');
|
||||
userLogin.value = val ?? false;
|
||||
if (val) return;
|
||||
userFace.value = userInfo != null ? userInfo.face : '';
|
||||
userFace.value = userInfo != null ? userInfo!.face! : '';
|
||||
}
|
||||
|
||||
void setTabConfig() async {
|
||||
|
@ -54,7 +54,6 @@ class _HomePageState extends State<HomePage>
|
||||
backgroundColor: Colors.transparent,
|
||||
appBar: AppBar(
|
||||
toolbarHeight: 0,
|
||||
elevation: 0,
|
||||
backgroundColor: Colors.transparent,
|
||||
systemOverlayStyle: Platform.isAndroid
|
||||
? SystemUiOverlayStyle(
|
||||
|
@ -3,16 +3,17 @@ import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||
import 'package:pilipala/models/user/info.dart';
|
||||
import 'package:pilipala/utils/storage.dart';
|
||||
|
||||
Box userInfoCache = GStrorage.userInfo;
|
||||
Box userInfoCache = GStorage.userInfo;
|
||||
|
||||
class HomeAppBar extends StatelessWidget {
|
||||
const HomeAppBar({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var userInfo = userInfoCache.get('userInfoCache');
|
||||
final UserInfoData? userInfo = userInfoCache.get('userInfoCache');
|
||||
return SliverAppBar(
|
||||
// forceElevated: true,
|
||||
scrolledUnderElevation: 0,
|
||||
@ -28,7 +29,6 @@ class HomeAppBar extends StatelessWidget {
|
||||
background: Column(
|
||||
children: [
|
||||
AppBar(
|
||||
centerTitle: false,
|
||||
title: const Text(
|
||||
'PiLiPaLa',
|
||||
style: TextStyle(
|
||||
@ -73,8 +73,6 @@ class HomeAppBar extends StatelessWidget {
|
||||
|
||||
const SizedBox(width: 10)
|
||||
],
|
||||
elevation: 0,
|
||||
scrolledUnderElevation: 0,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -25,7 +25,7 @@ class HtmlRenderController extends GetxController {
|
||||
ReplySortType _sortType = ReplySortType.time;
|
||||
RxString sortTypeTitle = ReplySortType.time.titles.obs;
|
||||
RxString sortTypeLabel = ReplySortType.time.labels.obs;
|
||||
Box setting = GStrorage.setting;
|
||||
Box setting = GStorage.setting;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
|
@ -104,14 +104,7 @@ class _HtmlRenderPageState extends State<HtmlRenderPage>
|
||||
int rpid = replyItem.rpid!;
|
||||
Get.to(
|
||||
() => Scaffold(
|
||||
appBar: AppBar(
|
||||
titleSpacing: 0,
|
||||
centerTitle: false,
|
||||
title: Text(
|
||||
'评论详情',
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
),
|
||||
appBar: AppBar(title: const Text('评论详情')),
|
||||
body: VideoReplyReplyPanel(
|
||||
oid: oid,
|
||||
rpid: rpid,
|
||||
@ -127,12 +120,7 @@ class _HtmlRenderPageState extends State<HtmlRenderPage>
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
centerTitle: false,
|
||||
titleSpacing: 0,
|
||||
title: Text(
|
||||
title,
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
title: Text(title),
|
||||
actions: [
|
||||
const SizedBox(width: 4),
|
||||
IconButton(
|
||||
|
@ -13,7 +13,7 @@ class LaterController extends GetxController {
|
||||
RxList<HotVideoItemModel> laterList = <HotVideoItemModel>[].obs;
|
||||
int count = 0;
|
||||
RxBool isLoading = false.obs;
|
||||
Box userInfoCache = GStrorage.userInfo;
|
||||
Box userInfoCache = GStorage.userInfo;
|
||||
UserInfoData? userInfo;
|
||||
|
||||
@override
|
||||
|
@ -28,18 +28,12 @@ class _LaterPageState extends State<LaterPage> {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
titleSpacing: 0,
|
||||
centerTitle: false,
|
||||
title: Obx(
|
||||
() => _laterController.laterList.isNotEmpty
|
||||
? Text(
|
||||
'稍后再看 (${_laterController.laterList.length})',
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
)
|
||||
: Text(
|
||||
'稍后再看',
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
: const Text('稍后再看'),
|
||||
),
|
||||
actions: [
|
||||
Obx(
|
||||
|
@ -17,7 +17,7 @@ class LiveController extends GetxController {
|
||||
RxInt liveFollowingCount = 0.obs;
|
||||
bool flag = false;
|
||||
OverlayEntry? popupDialog;
|
||||
Box setting = GStrorage.setting;
|
||||
Box setting = GStorage.setting;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
|
@ -7,7 +7,7 @@ import 'package:pilipala/utils/storage.dart';
|
||||
|
||||
class LiveFollowController extends GetxController {
|
||||
RxInt crossAxisCount = 2.obs;
|
||||
Box setting = GStrorage.setting;
|
||||
Box setting = GStorage.setting;
|
||||
int _currentPage = 1;
|
||||
RxInt liveFollowingCount = 0.obs;
|
||||
RxList<LiveFollowingItemModel> liveFollowingList =
|
||||
|
@ -42,13 +42,8 @@ class _LiveFollowPageState extends State<LiveFollowPage> {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
elevation: 0,
|
||||
scrolledUnderElevation: 0,
|
||||
titleSpacing: 0,
|
||||
centerTitle: false,
|
||||
title: Obx(() => Text(
|
||||
'${_liveFollowController.liveFollowingCount}人正在直播中',
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
)),
|
||||
),
|
||||
body: Container(
|
||||
|
@ -33,7 +33,7 @@ class LiveRoomController extends GetxController {
|
||||
int? tempCurrentQn;
|
||||
late List<Map<String, dynamic>> acceptQnList;
|
||||
RxString currentQnDesc = ''.obs;
|
||||
Box userInfoCache = GStrorage.userInfo;
|
||||
Box userInfoCache = GStorage.userInfo;
|
||||
int userId = 0;
|
||||
PlSocket? plSocket;
|
||||
List<String> danmuHostList = [];
|
||||
@ -69,7 +69,7 @@ class LiveRoomController extends GetxController {
|
||||
Request.getBuvid().then((value) => buvid = value);
|
||||
}
|
||||
// CDN优化
|
||||
enableCDN = setting.get(SettingBoxKey.enableCDN, defaultValue: true);
|
||||
enableCDN = setting.get(SettingBoxKey.enableCDN, defaultValue: false);
|
||||
final userInfo = userInfoCache.get('userInfoCache');
|
||||
if (userInfo != null && userInfo.mid != null) {
|
||||
userId = userInfo.mid;
|
||||
|
@ -259,8 +259,6 @@ class _LiveRoomPageState extends State<LiveRoomPage>
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: AppBar(
|
||||
centerTitle: false,
|
||||
titleSpacing: 0,
|
||||
backgroundColor: Colors.transparent,
|
||||
foregroundColor: Colors.white,
|
||||
toolbarHeight: isPortrait ? 56 : 0,
|
||||
@ -314,25 +312,28 @@ class _LiveRoomPageState extends State<LiveRoomPage>
|
||||
),
|
||||
),
|
||||
// 消息列表
|
||||
Obx(
|
||||
() => Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(
|
||||
bottom: 90 + padding.bottom,
|
||||
),
|
||||
height: Get.size.height -
|
||||
(padding.top +
|
||||
kToolbarHeight +
|
||||
(_liveRoomController.isPortrait.value
|
||||
? Get.size.width
|
||||
: Get.size.width * 9 / 16) +
|
||||
100 +
|
||||
padding.bottom),
|
||||
child: buildMessageListUI(
|
||||
context,
|
||||
_liveRoomController,
|
||||
_scrollController,
|
||||
Visibility(
|
||||
visible: !isLandscape,
|
||||
child: Obx(
|
||||
() => Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(
|
||||
bottom: 90 + padding.bottom,
|
||||
),
|
||||
height: Get.size.height -
|
||||
(padding.top +
|
||||
kToolbarHeight +
|
||||
(_liveRoomController.isPortrait.value
|
||||
? Get.size.width
|
||||
: Get.size.width * 9 / 16) +
|
||||
100 +
|
||||
padding.bottom),
|
||||
child: buildMessageListUI(
|
||||
context,
|
||||
_liveRoomController,
|
||||
_scrollController,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -35,7 +35,7 @@ class _BottomControlState extends State<BottomControl> {
|
||||
TextStyle subTitleStyle = const TextStyle(fontSize: 12);
|
||||
TextStyle titleStyle = const TextStyle(fontSize: 14);
|
||||
Size get preferredSize => const Size(double.infinity, kToolbarHeight);
|
||||
Box localCache = GStrorage.localCache;
|
||||
Box localCache = GStorage.localCache;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@ -47,10 +47,7 @@ class _BottomControlState extends State<BottomControl> {
|
||||
return AppBar(
|
||||
backgroundColor: Colors.transparent,
|
||||
foregroundColor: Colors.white,
|
||||
elevation: 0,
|
||||
scrolledUnderElevation: 0,
|
||||
primary: false,
|
||||
centerTitle: false,
|
||||
automaticallyImplyLeading: false,
|
||||
titleSpacing: 14,
|
||||
title: Row(
|
||||
|
@ -7,6 +7,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||
import 'package:pilipala/http/common.dart';
|
||||
import 'package:pilipala/models/user/info.dart';
|
||||
import 'package:pilipala/utils/storage.dart';
|
||||
import 'package:pilipala/utils/utils.dart';
|
||||
import '../../models/common/dynamic_badge_mode.dart';
|
||||
@ -20,13 +21,13 @@ class MainController extends GetxController {
|
||||
late List<int> navBarSort;
|
||||
final StreamController<bool> bottomBarStream =
|
||||
StreamController<bool>.broadcast();
|
||||
Box setting = GStrorage.setting;
|
||||
Box setting = GStorage.setting;
|
||||
DateTime? _lastPressedAt;
|
||||
late bool hideTabBar;
|
||||
late PageController pageController;
|
||||
int selectedIndex = 0;
|
||||
Box userInfoCache = GStrorage.userInfo;
|
||||
dynamic userInfo;
|
||||
Box userInfoCache = GStorage.userInfo;
|
||||
UserInfoData? userInfo;
|
||||
RxBool userLogin = false.obs;
|
||||
late Rx<DynamicBadgeMode> dynamicBadgeType = DynamicBadgeMode.number.obs;
|
||||
late bool enableGradientBg;
|
||||
@ -85,7 +86,7 @@ class MainController extends GetxController {
|
||||
}
|
||||
if (mineItemIndex != -1 && userInfo != null) {
|
||||
Widget avatar = NetworkImgLayer(
|
||||
width: 28, height: 28, src: userInfo.face, type: 'avatar');
|
||||
width: 28, height: 28, src: userInfo!.face, type: 'avatar');
|
||||
navigationBars[mineItemIndex]['icon'] = avatar;
|
||||
navigationBars[mineItemIndex]['selectIcon'] = avatar;
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ class _MainAppState extends State<MainApp> with SingleTickerProviderStateMixin {
|
||||
late MineController _mineController;
|
||||
|
||||
int? _lastSelectTime; //上次点击时间
|
||||
Box setting = GStrorage.setting;
|
||||
Box setting = GStorage.setting;
|
||||
late bool enableMYBar;
|
||||
|
||||
@override
|
||||
@ -113,19 +113,19 @@ class _MainAppState extends State<MainApp> with SingleTickerProviderStateMixin {
|
||||
|
||||
@override
|
||||
void dispose() async {
|
||||
await GStrorage.close();
|
||||
await GStorage.close();
|
||||
EventBus().off(EventName.loginEvent);
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Box localCache = GStrorage.localCache;
|
||||
Box localCache = GStorage.localCache;
|
||||
double statusBarHeight = MediaQuery.of(context).padding.top;
|
||||
double sheetHeight = MediaQuery.sizeOf(context).height -
|
||||
MediaQuery.of(context).padding.top -
|
||||
MediaQuery.sizeOf(context).width * 9 / 16;
|
||||
GlobalDataCache().sheetHeight = sheetHeight;
|
||||
GlobalDataCache.sheetHeight = sheetHeight;
|
||||
localCache.put('sheetHeight', sheetHeight);
|
||||
localCache.put('statusBarHeight', statusBarHeight);
|
||||
|
||||
|
@ -9,6 +9,7 @@ import 'package:pilipala/models/member/archive.dart';
|
||||
import 'package:pilipala/models/member/coin.dart';
|
||||
import 'package:pilipala/models/member/info.dart';
|
||||
import 'package:pilipala/models/member/like.dart';
|
||||
import 'package:pilipala/models/user/info.dart';
|
||||
import 'package:pilipala/utils/storage.dart';
|
||||
import 'package:share_plus/share_plus.dart';
|
||||
|
||||
@ -18,11 +19,11 @@ class MemberController extends GetxController {
|
||||
late Map userStat;
|
||||
RxString face = ''.obs;
|
||||
String? heroTag;
|
||||
Box userInfoCache = GStrorage.userInfo;
|
||||
Box userInfoCache = GStorage.userInfo;
|
||||
late int ownerMid;
|
||||
// 投稿列表
|
||||
RxList<VListItemModel>? archiveList = <VListItemModel>[].obs;
|
||||
dynamic userInfo;
|
||||
UserInfoData? userInfo;
|
||||
RxInt attribute = (-1).obs;
|
||||
RxString attributeText = '关注'.obs;
|
||||
RxList<MemberCoinsDataModel> recentCoinsList = <MemberCoinsDataModel>[].obs;
|
||||
@ -34,7 +35,7 @@ class MemberController extends GetxController {
|
||||
super.onInit();
|
||||
mid = int.tryParse(Get.parameters['mid']!) ?? -2;
|
||||
userInfo = userInfoCache.get('userInfoCache');
|
||||
ownerMid = userInfo != null ? userInfo.mid : -1;
|
||||
ownerMid = userInfo != null ? userInfo!.mid! : -1;
|
||||
isOwner.value = mid == ownerMid;
|
||||
face.value = Get.arguments['face'] ?? '';
|
||||
heroTag = Get.arguments['heroTag'] ?? '';
|
||||
|
@ -122,7 +122,7 @@ class ProfilePanel extends StatelessWidget {
|
||||
),
|
||||
child: Row(children: [
|
||||
Image.asset(
|
||||
'assets/images/live.gif',
|
||||
'assets/images/live.png',
|
||||
height: 10,
|
||||
),
|
||||
Text(
|
||||
|
@ -28,9 +28,8 @@ class MemberArchiveController extends GetxController {
|
||||
super.onInit();
|
||||
mid = int.parse(Get.parameters['mid']!);
|
||||
currentOrder.value = orderList.first;
|
||||
ownerMid = GlobalDataCache().userInfo != null
|
||||
? GlobalDataCache().userInfo!.mid!
|
||||
: -1;
|
||||
ownerMid =
|
||||
GlobalDataCache.userInfo != null ? GlobalDataCache.userInfo!.mid! : -1;
|
||||
isOwner.value = mid == -1 || mid == ownerMid;
|
||||
}
|
||||
|
||||
|
@ -47,12 +47,9 @@ class _MemberArchivePageState extends State<MemberArchivePage> {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
titleSpacing: 0,
|
||||
centerTitle: false,
|
||||
title: Obx(
|
||||
() => Text(
|
||||
'${_memberArchivesController.isOwner.value ? '我' : 'Ta'}的投稿 - ${_memberArchivesController.currentOrder['label']}',
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
@ -120,7 +117,7 @@ class _MemberArchivePageState extends State<MemberArchivePage> {
|
||||
}
|
||||
} else {
|
||||
return HttpError(
|
||||
errMsg: snapshot.data['msg'],
|
||||
errMsg: snapshot.data?['msg'] ?? '请求异常',
|
||||
fn: () {},
|
||||
);
|
||||
}
|
||||
|
@ -20,9 +20,8 @@ class MemberArticleController extends GetxController {
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
mid = int.parse(Get.parameters['mid']!);
|
||||
ownerMid = GlobalDataCache().userInfo != null
|
||||
? GlobalDataCache().userInfo!.mid!
|
||||
: -1;
|
||||
ownerMid =
|
||||
GlobalDataCache.userInfo != null ? GlobalDataCache.userInfo!.mid! : -1;
|
||||
isOwner.value = mid == -1 || mid == ownerMid;
|
||||
}
|
||||
|
||||
|
@ -48,12 +48,9 @@ class _MemberArticlePageState extends State<MemberArticlePage> {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
titleSpacing: 0,
|
||||
centerTitle: false,
|
||||
title: Obx(
|
||||
() => Text(
|
||||
'${_memberArticleController.isOwner.value ? '我' : 'Ta'}的图文',
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -20,7 +20,6 @@ class MemberCoinsItem extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
String heroTag = Utils.makeHeroTag(coinItem.aid);
|
||||
return Card(
|
||||
elevation: 0,
|
||||
clipBehavior: Clip.hardEdge,
|
||||
margin: EdgeInsets.zero,
|
||||
child: InkWell(
|
||||
|
@ -18,9 +18,8 @@ class MemberDynamicsController extends GetxController {
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
mid = int.parse(Get.parameters['mid']!);
|
||||
ownerMid = GlobalDataCache().userInfo != null
|
||||
? GlobalDataCache().userInfo!.mid!
|
||||
: -1;
|
||||
ownerMid =
|
||||
GlobalDataCache.userInfo != null ? GlobalDataCache.userInfo!.mid! : -1;
|
||||
isOwner.value = mid == -1 || mid == ownerMid;
|
||||
}
|
||||
|
||||
|
@ -54,12 +54,9 @@ class _MemberDynamicsPageState extends State<MemberDynamicsPage> {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
titleSpacing: 0,
|
||||
centerTitle: false,
|
||||
title: Obx(
|
||||
() => Text(
|
||||
'${_memberDynamicController.isOwner.value ? '我' : 'Ta'}的动态',
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -49,7 +49,6 @@ class _MemberSearchPageState extends State<MemberSearchPage>
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
titleSpacing: 0,
|
||||
actions: [
|
||||
IconButton(
|
||||
onPressed: () => _memberSearchCtr.submit(),
|
||||
|
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:pilipala/http/member.dart';
|
||||
import 'package:pilipala/models/member/seasons.dart';
|
||||
import 'package:pilipala/utils/global_data_cache.dart';
|
||||
|
||||
class MemberSeasonsController extends GetxController {
|
||||
final ScrollController scrollController = ScrollController();
|
||||
@ -58,7 +59,7 @@ class MemberSeasonsController extends GetxController {
|
||||
mid: mid,
|
||||
seriesId: seriesId!,
|
||||
pn: pn,
|
||||
currentMid: 17340771,
|
||||
currentMid: GlobalDataCache.userInfo?.mid ?? -1,
|
||||
);
|
||||
if (res['status']) {
|
||||
seasonsList.addAll(res['data'].seriesList);
|
||||
|
@ -2,6 +2,8 @@ import 'package:easy_debounce/easy_throttle.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:pilipala/common/constants.dart';
|
||||
import 'package:pilipala/common/skeleton/video_card_h.dart';
|
||||
import 'package:pilipala/common/widgets/http_error.dart';
|
||||
import 'controller.dart';
|
||||
import 'widgets/item.dart';
|
||||
|
||||
@ -41,12 +43,7 @@ class _MemberSeasonsPageState extends State<MemberSeasonsPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
titleSpacing: 0,
|
||||
centerTitle: false,
|
||||
title: Text(Get.parameters['seasonName']!,
|
||||
style: Theme.of(context).textTheme.titleMedium),
|
||||
),
|
||||
appBar: AppBar(title: Text(Get.parameters['seasonName']!)),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: StyleString.safeSpace,
|
||||
@ -59,9 +56,9 @@ class _MemberSeasonsPageState extends State<MemberSeasonsPage> {
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.done) {
|
||||
if (snapshot.data != null) {
|
||||
Map data = snapshot.data as Map;
|
||||
Map? data = snapshot.data;
|
||||
List list = _memberSeasonsController.seasonsList;
|
||||
if (data['status']) {
|
||||
if (data?['status']) {
|
||||
return Obx(
|
||||
() => list.isNotEmpty
|
||||
? LayoutBuilder(
|
||||
@ -87,16 +84,44 @@ class _MemberSeasonsPageState extends State<MemberSeasonsPage> {
|
||||
);
|
||||
},
|
||||
)
|
||||
: const SizedBox(),
|
||||
: const HttpError(
|
||||
errMsg: '没有数据',
|
||||
isInSliver: false,
|
||||
isShowBtn: false,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return const SizedBox();
|
||||
return HttpError(
|
||||
errMsg: snapshot.data['msg'],
|
||||
isInSliver: false,
|
||||
fn: () {
|
||||
setState(() {
|
||||
_futureBuilderFuture =
|
||||
_memberSeasonsController.onRefresh();
|
||||
});
|
||||
},
|
||||
);
|
||||
}
|
||||
} else {
|
||||
return const SizedBox();
|
||||
return HttpError(
|
||||
errMsg: snapshot.data['msg'] ?? '请求异常',
|
||||
isInSliver: false,
|
||||
fn: () {
|
||||
setState(() {
|
||||
_futureBuilderFuture =
|
||||
_memberSeasonsController.onRefresh();
|
||||
});
|
||||
},
|
||||
);
|
||||
}
|
||||
} else {
|
||||
return const SizedBox();
|
||||
return ListView.builder(
|
||||
itemCount: 10,
|
||||
shrinkWrap: true,
|
||||
itemBuilder: (context, index) {
|
||||
return const VideoCardHSkeleton();
|
||||
},
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
|
@ -47,9 +47,7 @@ class _MessageAtPageState extends State<MessageAtPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('@我的'),
|
||||
),
|
||||
appBar: AppBar(title: const Text('@我的')),
|
||||
body: RefreshIndicator(
|
||||
onRefresh: () async {
|
||||
await _messageAtCtr.queryMessageAt(type: 'init');
|
||||
@ -129,7 +127,7 @@ class AtItem extends StatelessWidget {
|
||||
|
||||
return InkWell(
|
||||
onTap: () async {
|
||||
MessageUtils.onClickMessage(context, uri, nativeUri, type);
|
||||
MessageUtils.onClickMessage(context, uri, nativeUri, type, null);
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(14),
|
||||
|
@ -47,9 +47,7 @@ class _MessageLikePageState extends State<MessageLikePage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('收到的赞'),
|
||||
),
|
||||
appBar: AppBar(title: const Text('收到的赞')),
|
||||
body: RefreshIndicator(
|
||||
onRefresh: () async {
|
||||
await _messageLikeCtr.queryMessageLike(type: 'init');
|
||||
@ -127,7 +125,7 @@ class LikeItem extends StatelessWidget {
|
||||
final String type = item.item!.type!;
|
||||
return InkWell(
|
||||
onTap: () async {
|
||||
MessageUtils.onClickMessage(context, uri, nativeUri, type);
|
||||
MessageUtils.onClickMessage(context, uri, nativeUri, type, null);
|
||||
},
|
||||
child: Stack(
|
||||
children: [
|
||||
|
@ -48,9 +48,7 @@ class _MessageReplyPageState extends State<MessageReplyPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('回复我的'),
|
||||
),
|
||||
appBar: AppBar(title: const Text('回复我的')),
|
||||
body: RefreshIndicator(
|
||||
onRefresh: () async {
|
||||
await _messageReplyCtr.queryMessageReply(type: 'init');
|
||||
@ -119,7 +117,7 @@ class ReplyItem extends StatelessWidget {
|
||||
final String type = item.item!.type!;
|
||||
return InkWell(
|
||||
onTap: () async {
|
||||
MessageUtils.onClickMessage(context, uri, nativeUri, type);
|
||||
MessageUtils.onClickMessage(context, uri, nativeUri, type, item.item!);
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(14),
|
||||
@ -157,6 +155,9 @@ class ReplyItem extends StatelessWidget {
|
||||
text: '回复了我的评论',
|
||||
style: TextStyle(color: outline),
|
||||
),
|
||||
if (item.item!.type! == 'dynamic')
|
||||
TextSpan(
|
||||
text: '对我的动态发表了评论', style: TextStyle(color: outline)),
|
||||
])),
|
||||
const SizedBox(height: 6),
|
||||
Text.rich(
|
||||
@ -199,11 +200,32 @@ class ReplyItem extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
if (item.item!.type! == 'video')
|
||||
NetworkImgLayer(
|
||||
// NetworkImgLayer(
|
||||
// width: 60,
|
||||
// height: 60,
|
||||
// src: item.item!.image,
|
||||
// radius: 6,
|
||||
// ),
|
||||
Container(
|
||||
width: 60,
|
||||
height: 60,
|
||||
src: item.item!.image,
|
||||
radius: 6,
|
||||
clipBehavior: Clip.hardEdge,
|
||||
decoration: const BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(6)),
|
||||
),
|
||||
child: Image.network(item.item!.image!, fit: BoxFit.cover),
|
||||
),
|
||||
if (item.item!.type! == 'dynamic')
|
||||
Container(
|
||||
width: 60,
|
||||
height: 80,
|
||||
padding: const EdgeInsets.all(4),
|
||||
child: Text(
|
||||
item.item!.title!,
|
||||
maxLines: 4,
|
||||
style: const TextStyle(fontSize: 12, letterSpacing: 0.3),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -29,9 +29,7 @@ class _MessageSystemPageState extends State<MessageSystemPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('系统通知'),
|
||||
),
|
||||
appBar: AppBar(title: const Text('系统通知')),
|
||||
body: RefreshIndicator(
|
||||
onRefresh: () async {
|
||||
await _messageSystemCtr.queryAndProcessMessages();
|
||||
|
@ -1,8 +1,12 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:pilipala/http/dynamics.dart';
|
||||
import 'package:pilipala/http/search.dart';
|
||||
import 'package:pilipala/models/common/reply_type.dart';
|
||||
import 'package:pilipala/models/dynamics/result.dart';
|
||||
import 'package:pilipala/models/msg/reply.dart';
|
||||
import 'package:pilipala/pages/dynamics/index.dart';
|
||||
import 'package:pilipala/pages/video/detail/reply_reply/index.dart';
|
||||
import 'package:pilipala/utils/app_scheme.dart';
|
||||
import 'package:pilipala/utils/utils.dart';
|
||||
@ -10,7 +14,12 @@ import 'package:pilipala/utils/utils.dart';
|
||||
class MessageUtils {
|
||||
// 回复我的、收到的赞点击
|
||||
static void onClickMessage(
|
||||
BuildContext context, Uri uri, Uri nativeUri, String type) async {
|
||||
BuildContext context,
|
||||
Uri uri,
|
||||
Uri nativeUri,
|
||||
String type,
|
||||
ReplyContentItem? item,
|
||||
) async {
|
||||
final String path = uri.path;
|
||||
final String bvid = path.split('/').last;
|
||||
String? sourceType;
|
||||
@ -24,8 +33,8 @@ class MessageUtils {
|
||||
if (nativePath.contains('detail')) {
|
||||
// 动态详情
|
||||
sourceType = 'opus';
|
||||
oid = nativePath.split('/')[3];
|
||||
commentRootId = nativePath.split('/')[4];
|
||||
oid = item?.subjectId!.toString() ?? nativePath.split('/')[3];
|
||||
commentRootId = item?.sourceId!.toString() ?? nativePath.split('/')[4];
|
||||
}
|
||||
switch (type) {
|
||||
case 'video':
|
||||
@ -47,6 +56,7 @@ class MessageUtils {
|
||||
}
|
||||
break;
|
||||
case 'reply':
|
||||
case 'dynamic':
|
||||
debugPrint('commentRootId: $oid, $commentRootId');
|
||||
navigateToComment(
|
||||
context,
|
||||
@ -155,4 +165,14 @@ class MessageUtils {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// 跳转查看动态详情
|
||||
static void navigateToDynamicDetail(String opusId) async {
|
||||
DynamicsController dynamicsController = Get.put(DynamicsController());
|
||||
var res = await DynamicsHttp.dynamicDetail(id: opusId);
|
||||
if (res['status']) {
|
||||
DynamicItemModel item = res['data'];
|
||||
dynamicsController.pushDetail(item, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,8 +17,8 @@ class MineController extends GetxController {
|
||||
Rx<UserInfoData> userInfo = UserInfoData().obs;
|
||||
Rx<ThemeType> themeType = ThemeType.system.obs;
|
||||
Rx<FavFolderData> favFolderData = FavFolderData().obs;
|
||||
Box setting = GStrorage.setting;
|
||||
Box userInfoCache = GStrorage.userInfo;
|
||||
Box setting = GStorage.setting;
|
||||
Box userInfoCache = GStorage.userInfo;
|
||||
List menuList = [
|
||||
{
|
||||
'icon': Icons.history,
|
||||
|
@ -44,8 +44,6 @@ class _MinePageState extends State<MinePage>
|
||||
super.build(context);
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
scrolledUnderElevation: 0,
|
||||
elevation: 0,
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.search_outlined),
|
||||
@ -355,7 +353,8 @@ class _MinePageState extends State<MinePage>
|
||||
itemBuilder: (context, index) {
|
||||
if (flag && index == favFolderList.length) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(right: 14),
|
||||
padding:
|
||||
const EdgeInsets.only(right: 14, bottom: 70),
|
||||
child: Center(
|
||||
child: IconButton(
|
||||
style: ButtonStyle(
|
||||
@ -488,7 +487,7 @@ class FavFolderItem extends StatelessWidget {
|
||||
child: NetworkImgLayer(
|
||||
src: item!.cover,
|
||||
width: 180,
|
||||
height: 110,
|
||||
height: MediaQuery.textScalerOf(context).scale(110),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -3,17 +3,18 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:pilipala/http/user.dart';
|
||||
import 'package:pilipala/models/user/info.dart';
|
||||
import 'package:pilipala/utils/storage.dart';
|
||||
|
||||
class MineEditController extends GetxController {
|
||||
Box userInfoCache = GStrorage.userInfo;
|
||||
Box userInfoCache = GStorage.userInfo;
|
||||
final formKey = GlobalKey<FormState>();
|
||||
final TextEditingController unameCtr = TextEditingController();
|
||||
final TextEditingController useridCtr = TextEditingController();
|
||||
final TextEditingController signCtr = TextEditingController();
|
||||
final TextEditingController birthdayCtr = TextEditingController();
|
||||
String? sex;
|
||||
dynamic userInfo;
|
||||
UserInfoData? userInfo;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
|
@ -23,9 +23,7 @@ class _MineEditPageState extends State<MineEditPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('编辑资料'),
|
||||
),
|
||||
appBar: AppBar(title: const Text('编辑资料')),
|
||||
body: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: FutureBuilder(
|
||||
|
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||
import 'package:pilipala/models/read/opus.dart';
|
||||
|
||||
import 'controller.dart';
|
||||
import 'text_helper.dart';
|
||||
|
||||
@ -26,16 +27,18 @@ class _OpusPageState extends State<OpusPage> {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: _buildAppBar(),
|
||||
body: SingleChildScrollView(
|
||||
body: CustomScrollView(
|
||||
controller: controller.scrollController,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_buildTitle(),
|
||||
_buildFutureContent(),
|
||||
],
|
||||
),
|
||||
slivers: [
|
||||
SliverList(
|
||||
delegate: SliverChildListDelegate(
|
||||
[
|
||||
_buildTitle(),
|
||||
_buildFutureContent(),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ class RankController extends GetxController with GetTickerProviderStateMixin {
|
||||
late TabController tabController;
|
||||
late List tabsCtrList;
|
||||
late List<Widget> tabsPageList;
|
||||
Box setting = GStrorage.setting;
|
||||
Box setting = GStorage.setting;
|
||||
late final StreamController<bool> searchBarStream =
|
||||
StreamController<bool>.broadcast();
|
||||
|
||||
|
@ -38,7 +38,6 @@ class _RankPageState extends State<RankPage>
|
||||
backgroundColor: Colors.transparent,
|
||||
appBar: AppBar(
|
||||
toolbarHeight: 0,
|
||||
elevation: 0,
|
||||
backgroundColor: Colors.transparent,
|
||||
systemOverlayStyle: Platform.isAndroid
|
||||
? SystemUiOverlayStyle(
|
||||
|
@ -14,7 +14,7 @@ class RcmdController extends GetxController {
|
||||
// RxList<RecVideoItemModel> webVideoList = <RecVideoItemModel>[].obs;
|
||||
bool isLoadingMore = true;
|
||||
OverlayEntry? popupDialog;
|
||||
Box setting = GStrorage.setting;
|
||||
Box setting = GStorage.setting;
|
||||
RxInt crossAxisCount = 2.obs;
|
||||
late bool enableSaveLastData;
|
||||
late String defaultRcmdType = 'web';
|
||||
|
@ -6,6 +6,7 @@ import 'package:pilipala/models/read/opus.dart';
|
||||
import 'package:pilipala/models/read/read.dart';
|
||||
import 'package:pilipala/pages/opus/text_helper.dart';
|
||||
import 'package:pilipala/utils/utils.dart';
|
||||
|
||||
import 'controller.dart';
|
||||
|
||||
class ReadPage extends StatefulWidget {
|
||||
@ -38,16 +39,18 @@ class _ReadPageState extends State<ReadPage> {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: _buildAppBar(),
|
||||
body: SingleChildScrollView(
|
||||
body: CustomScrollView(
|
||||
controller: controller.scrollController,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_buildTitle(),
|
||||
_buildFutureContent(),
|
||||
],
|
||||
),
|
||||
slivers: [
|
||||
SliverList(
|
||||
delegate: SliverChildListDelegate(
|
||||
[
|
||||
_buildTitle(),
|
||||
_buildFutureContent(),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ class SSearchController extends GetxController {
|
||||
RxString searchKeyWord = ''.obs;
|
||||
Rx<TextEditingController> controller = TextEditingController().obs;
|
||||
RxList<HotSearchItem> hotSearchList = <HotSearchItem>[].obs;
|
||||
Box localCache = GStrorage.localCache;
|
||||
Box localCache = GStorage.localCache;
|
||||
List historyCacheList = [];
|
||||
RxList historyList = [].obs;
|
||||
RxList<SearchSuggestItem> searchSuggestList = <SearchSuggestItem>[].obs;
|
||||
@ -23,7 +23,7 @@ class SSearchController extends GetxController {
|
||||
Debouncer(delay: const Duration(milliseconds: 200)); // 设置延迟时间
|
||||
String hintText = '搜索';
|
||||
RxString defaultSearch = ''.obs;
|
||||
Box setting = GStrorage.setting;
|
||||
Box setting = GStorage.setting;
|
||||
bool enableHotKey = true;
|
||||
bool enableSearchSuggest = true;
|
||||
|
||||
@ -43,10 +43,10 @@ class SSearchController extends GetxController {
|
||||
hintText = hint;
|
||||
}
|
||||
}
|
||||
historyCacheList = GlobalDataCache().historyCacheList;
|
||||
historyCacheList = GlobalDataCache.historyCacheList;
|
||||
historyList.value = historyCacheList;
|
||||
enableHotKey = setting.get(SettingBoxKey.enableHotKey, defaultValue: true);
|
||||
enableSearchSuggest = GlobalDataCache().enableSearchSuggest;
|
||||
enableSearchSuggest = GlobalDataCache.enableSearchSuggest;
|
||||
}
|
||||
|
||||
void onChange(value) {
|
||||
@ -128,7 +128,7 @@ class SSearchController extends GetxController {
|
||||
historyCacheList = [];
|
||||
historyList.refresh();
|
||||
localCache.put('cacheList', []);
|
||||
GlobalDataCache().historyCacheList = [];
|
||||
GlobalDataCache.historyCacheList = [];
|
||||
SmartDialog.showToast('搜索历史已清空');
|
||||
}
|
||||
|
||||
@ -139,7 +139,7 @@ class SSearchController extends GetxController {
|
||||
historyList.value = historyCacheList;
|
||||
historyList.refresh();
|
||||
localCache.put('cacheList', historyCacheList);
|
||||
GlobalDataCache().historyCacheList = historyCacheList;
|
||||
GlobalDataCache.historyCacheList = historyCacheList;
|
||||
searchFocusNode.unfocus();
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,6 @@ class _SearchPageState extends State<SearchPage> with RouteAware {
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
titleSpacing: 0,
|
||||
actions: [
|
||||
IconButton(
|
||||
onPressed: () => _searchController.submit(),
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user