Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-05-06 14:14:19 +08:00
parent 1a8c348af1
commit 07843a5e77
239 changed files with 3175 additions and 13237 deletions

View File

@@ -18,119 +18,6 @@ class AiConclusionPanel extends CommonSlidePage {
@override
State<AiConclusionPanel> createState() => _AiDetailState();
static Widget buildContent(
BuildContext context,
ThemeData theme,
AiConclusionResult res, {
Key? key,
bool tap = true,
}) {
return CustomScrollView(
key: key,
shrinkWrap: !tap,
physics: const AlwaysScrollableScrollPhysics(),
slivers: [
if (res.summary?.isNotEmpty == true) ...[
SliverToBoxAdapter(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 14),
child: selectableText(
res.summary!,
style: const TextStyle(
fontSize: 15,
height: 1.5,
),
),
),
),
if (res.outline?.isNotEmpty == true)
SliverToBoxAdapter(
child: Divider(
height: 20,
color: theme.dividerColor.withValues(alpha: 0.1),
thickness: 6,
),
),
],
if (res.outline?.isNotEmpty == true)
SliverPadding(
padding: EdgeInsets.only(
left: 14,
right: 14,
bottom: !tap ? 0 : MediaQuery.viewPaddingOf(context).bottom + 100,
),
sliver: SliverList.builder(
itemCount: res.outline!.length,
itemBuilder: (context, index) {
final item = res.outline![index];
return SelectionArea(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (index != 0) const SizedBox(height: 10),
Text(
item.title!,
style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold,
height: 1.5,
),
),
const SizedBox(height: 6),
...?item.partOutline?.map(
(item) => Wrap(
children: [
Text.rich(
TextSpan(
style: TextStyle(
fontSize: 14,
color: theme.colorScheme.onSurface,
height: 1.5,
),
children: [
TextSpan(
text: DurationUtils.formatDuration(
item.timestamp,
),
style: tap
? TextStyle(
color: theme.colorScheme.primary,
)
: null,
recognizer: tap
? (NoDeadlineTapGestureRecognizer()
..onTap = () {
try {
Get.find<VideoDetailController>(
tag: Get.arguments['heroTag'],
).plPlayerController.seekTo(
Duration(
seconds: item.timestamp!,
),
isSeek: false,
);
} catch (_) {}
})
: null,
),
const TextSpan(text: ' '),
TextSpan(text: item.content!),
],
),
),
],
),
),
],
),
);
},
),
),
],
);
}
}
class _AiDetailState extends State<AiConclusionPanel>
@@ -178,12 +65,7 @@ class _AiDetailState extends State<AiConclusionPanel>
@override
Widget buildList(ThemeData theme) {
final child = AiConclusionPanel.buildContent(
context,
theme,
widget.item,
key: _key,
);
final child = _buildContent(theme, widget.item);
if (_isNested) {
return ExtendedVisibilityDetector(
uniqueKey: const Key('ai-conclusion'),
@@ -192,4 +74,107 @@ class _AiDetailState extends State<AiConclusionPanel>
}
return child;
}
Widget _buildContent(ThemeData theme, AiConclusionResult res) {
return CustomScrollView(
key: _key,
physics: const AlwaysScrollableScrollPhysics(),
slivers: [
if (res.summary?.isNotEmpty == true) ...[
SliverToBoxAdapter(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 14),
child: selectableText(
res.summary!,
style: const TextStyle(
fontSize: 15,
height: 1.5,
),
),
),
),
if (res.outline?.isNotEmpty == true)
SliverToBoxAdapter(
child: Divider(
height: 20,
color: theme.dividerColor.withValues(alpha: 0.1),
thickness: 6,
),
),
],
if (res.outline?.isNotEmpty == true)
SliverPadding(
padding: EdgeInsets.only(
left: 14,
right: 14,
bottom: MediaQuery.viewPaddingOf(context).bottom + 100,
),
sliver: SliverList.builder(
itemCount: res.outline!.length,
itemBuilder: (context, index) {
final item = res.outline![index];
return SelectionArea(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (index != 0) const SizedBox(height: 10),
Text(
item.title!,
style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold,
height: 1.5,
),
),
const SizedBox(height: 6),
...?item.partOutline?.map(
(item) => Wrap(
children: [
Text.rich(
TextSpan(
style: TextStyle(
fontSize: 14,
color: theme.colorScheme.onSurface,
height: 1.5,
),
children: [
TextSpan(
text: DurationUtils.formatDuration(
item.timestamp,
),
style: TextStyle(
color: theme.colorScheme.primary,
),
recognizer:
(NoDeadlineTapGestureRecognizer()
..onTap = () {
try {
Get.find<VideoDetailController>(
tag: Get.arguments['heroTag'],
).plPlayerController.seekTo(
Duration(
seconds: item.timestamp!,
),
isSeek: false,
);
} catch (_) {}
}),
),
const TextSpan(text: ' '),
TextSpan(text: item.content!),
],
),
),
],
),
),
],
),
);
},
),
),
],
);
}
}