mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
opt: get theme color
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -179,7 +179,7 @@ class _BangumiInfoState extends State<BangumiInfo> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final ThemeData t = Theme.of(context);
|
||||
final ThemeData theme = Theme.of(context);
|
||||
bool isLandscape =
|
||||
MediaQuery.of(context).orientation == Orientation.landscape;
|
||||
return SliverPadding(
|
||||
@@ -282,12 +282,12 @@ class _BangumiInfoState extends State<BangumiInfo> {
|
||||
foregroundColor:
|
||||
bangumiIntroController
|
||||
.isFollowed.value
|
||||
? t.colorScheme.outline
|
||||
? theme.colorScheme.outline
|
||||
: null,
|
||||
backgroundColor:
|
||||
bangumiIntroController
|
||||
.isFollowed.value
|
||||
? t.colorScheme
|
||||
? theme.colorScheme
|
||||
.onInverseSurface
|
||||
: null,
|
||||
),
|
||||
@@ -353,28 +353,32 @@ class _BangumiInfoState extends State<BangumiInfo> {
|
||||
if (isLandscape) ...[
|
||||
const SizedBox(width: 6),
|
||||
AreasAndPubTime(
|
||||
widget: widget,
|
||||
bangumiItem: bangumiItem,
|
||||
t: t),
|
||||
widget: widget,
|
||||
bangumiItem: bangumiItem,
|
||||
theme: theme,
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
NewEpDesc(
|
||||
widget: widget,
|
||||
bangumiItem: bangumiItem,
|
||||
t: t),
|
||||
widget: widget,
|
||||
bangumiItem: bangumiItem,
|
||||
theme: theme,
|
||||
),
|
||||
]
|
||||
],
|
||||
),
|
||||
SizedBox(height: isLandscape ? 2 : 6),
|
||||
if (!isLandscape)
|
||||
AreasAndPubTime(
|
||||
widget: widget,
|
||||
bangumiItem: bangumiItem,
|
||||
t: t),
|
||||
widget: widget,
|
||||
bangumiItem: bangumiItem,
|
||||
theme: theme,
|
||||
),
|
||||
if (!isLandscape)
|
||||
NewEpDesc(
|
||||
widget: widget,
|
||||
bangumiItem: bangumiItem,
|
||||
t: t),
|
||||
widget: widget,
|
||||
bangumiItem: bangumiItem,
|
||||
theme: theme,
|
||||
),
|
||||
const Spacer(),
|
||||
Text(
|
||||
'简介:${!widget.isLoading ? widget.bangumiDetail!.evaluate! : bangumiItem!.evaluate!}',
|
||||
@@ -382,7 +386,7 @@ class _BangumiInfoState extends State<BangumiInfo> {
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: t.colorScheme.outline,
|
||||
color: theme.colorScheme.outline,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -394,7 +398,7 @@ class _BangumiInfoState extends State<BangumiInfo> {
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
// 点赞收藏转发 布局样式2
|
||||
actionGrid(context, bangumiIntroController),
|
||||
actionGrid(theme, bangumiIntroController),
|
||||
// 番剧分p
|
||||
if ((!widget.isLoading &&
|
||||
widget.bangumiDetail!.episodes!.isNotEmpty) ||
|
||||
@@ -427,115 +431,111 @@ class _BangumiInfoState extends State<BangumiInfo> {
|
||||
}
|
||||
|
||||
Widget actionGrid(
|
||||
BuildContext context, BangumiIntroController bangumiIntroController) {
|
||||
return LayoutBuilder(
|
||||
builder: (BuildContext context, BoxConstraints constraints) {
|
||||
return Material(
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(top: 1),
|
||||
child: SizedBox(
|
||||
height: 48,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: <Widget>[
|
||||
Obx(
|
||||
() => ActionItem(
|
||||
icon: const Icon(FontAwesomeIcons.thumbsUp),
|
||||
selectIcon: const Icon(FontAwesomeIcons.solidThumbsUp),
|
||||
onTap: () =>
|
||||
handleState(bangumiIntroController.actionLikeVideo),
|
||||
onLongPress: bangumiIntroController.actionOneThree,
|
||||
selectStatus: bangumiIntroController.hasLike.value,
|
||||
loadingStatus: false,
|
||||
semanticsLabel: '点赞',
|
||||
text: !widget.isLoading
|
||||
? Utils.numFormat(widget.bangumiDetail!.stat!['likes']!)
|
||||
: Utils.numFormat(
|
||||
bangumiItem!.stat!['likes']!,
|
||||
),
|
||||
needAnim: true,
|
||||
hasTriple: bangumiIntroController.hasLike.value &&
|
||||
bangumiIntroController.hasCoin &&
|
||||
bangumiIntroController.hasFav.value,
|
||||
callBack: (start) {
|
||||
if (start) {
|
||||
HapticFeedback.lightImpact();
|
||||
_coinKey.currentState?.controller?.forward();
|
||||
_favKey.currentState?.controller?.forward();
|
||||
} else {
|
||||
_coinKey.currentState?.controller?.reverse();
|
||||
_favKey.currentState?.controller?.reverse();
|
||||
}
|
||||
},
|
||||
),
|
||||
ThemeData theme, BangumiIntroController bangumiIntroController) {
|
||||
return Material(
|
||||
color: theme.colorScheme.surface,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(top: 1),
|
||||
child: SizedBox(
|
||||
height: 48,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: <Widget>[
|
||||
Obx(
|
||||
() => ActionItem(
|
||||
icon: const Icon(FontAwesomeIcons.thumbsUp),
|
||||
selectIcon: const Icon(FontAwesomeIcons.solidThumbsUp),
|
||||
onTap: () =>
|
||||
handleState(bangumiIntroController.actionLikeVideo),
|
||||
onLongPress: bangumiIntroController.actionOneThree,
|
||||
selectStatus: bangumiIntroController.hasLike.value,
|
||||
loadingStatus: false,
|
||||
semanticsLabel: '点赞',
|
||||
text: !widget.isLoading
|
||||
? Utils.numFormat(widget.bangumiDetail!.stat!['likes']!)
|
||||
: Utils.numFormat(
|
||||
bangumiItem!.stat!['likes']!,
|
||||
),
|
||||
needAnim: true,
|
||||
hasTriple: bangumiIntroController.hasLike.value &&
|
||||
bangumiIntroController.hasCoin &&
|
||||
bangumiIntroController.hasFav.value,
|
||||
callBack: (start) {
|
||||
if (start) {
|
||||
HapticFeedback.lightImpact();
|
||||
_coinKey.currentState?.controller?.forward();
|
||||
_favKey.currentState?.controller?.forward();
|
||||
} else {
|
||||
_coinKey.currentState?.controller?.reverse();
|
||||
_favKey.currentState?.controller?.reverse();
|
||||
}
|
||||
},
|
||||
),
|
||||
Obx(
|
||||
() => ActionItem(
|
||||
key: _coinKey,
|
||||
icon: const Icon(FontAwesomeIcons.b),
|
||||
selectIcon: const Icon(FontAwesomeIcons.b),
|
||||
onTap: () =>
|
||||
handleState(bangumiIntroController.actionCoinVideo),
|
||||
selectStatus: bangumiIntroController.hasCoin,
|
||||
loadingStatus: false,
|
||||
semanticsLabel: '投币',
|
||||
text: !widget.isLoading
|
||||
? Utils.numFormat(widget.bangumiDetail!.stat!['coins']!)
|
||||
: Utils.numFormat(
|
||||
bangumiItem!.stat!['coins']!,
|
||||
),
|
||||
needAnim: true,
|
||||
),
|
||||
),
|
||||
Obx(
|
||||
() => ActionItem(
|
||||
key: _coinKey,
|
||||
icon: const Icon(FontAwesomeIcons.b),
|
||||
selectIcon: const Icon(FontAwesomeIcons.b),
|
||||
onTap: () =>
|
||||
handleState(bangumiIntroController.actionCoinVideo),
|
||||
selectStatus: bangumiIntroController.hasCoin,
|
||||
loadingStatus: false,
|
||||
semanticsLabel: '投币',
|
||||
text: !widget.isLoading
|
||||
? Utils.numFormat(widget.bangumiDetail!.stat!['coins']!)
|
||||
: Utils.numFormat(
|
||||
bangumiItem!.stat!['coins']!,
|
||||
),
|
||||
needAnim: true,
|
||||
),
|
||||
Obx(
|
||||
() => ActionItem(
|
||||
key: _favKey,
|
||||
icon: const Icon(FontAwesomeIcons.star),
|
||||
selectIcon: const Icon(FontAwesomeIcons.solidStar),
|
||||
onTap: () =>
|
||||
bangumiIntroController.showFavBottomSheet(context),
|
||||
onLongPress: () => bangumiIntroController
|
||||
.showFavBottomSheet(context, type: 'longPress'),
|
||||
selectStatus: bangumiIntroController.hasFav.value,
|
||||
loadingStatus: false,
|
||||
semanticsLabel: '收藏',
|
||||
text: !widget.isLoading
|
||||
? Utils.numFormat(
|
||||
widget.bangumiDetail!.stat!['favorite']!)
|
||||
: Utils.numFormat(
|
||||
bangumiItem!.stat!['favorite']!,
|
||||
),
|
||||
needAnim: true,
|
||||
),
|
||||
),
|
||||
Obx(
|
||||
() => ActionItem(
|
||||
key: _favKey,
|
||||
icon: const Icon(FontAwesomeIcons.star),
|
||||
selectIcon: const Icon(FontAwesomeIcons.solidStar),
|
||||
onTap: () =>
|
||||
bangumiIntroController.showFavBottomSheet(context),
|
||||
onLongPress: () => bangumiIntroController
|
||||
.showFavBottomSheet(context, type: 'longPress'),
|
||||
selectStatus: bangumiIntroController.hasFav.value,
|
||||
loadingStatus: false,
|
||||
semanticsLabel: '收藏',
|
||||
text: !widget.isLoading
|
||||
? Utils.numFormat(
|
||||
widget.bangumiDetail!.stat!['favorite']!)
|
||||
: Utils.numFormat(
|
||||
bangumiItem!.stat!['favorite']!,
|
||||
),
|
||||
needAnim: true,
|
||||
),
|
||||
ActionItem(
|
||||
icon: const Icon(FontAwesomeIcons.comment),
|
||||
selectIcon: const Icon(FontAwesomeIcons.reply),
|
||||
onTap: () => videoDetailCtr.tabCtr.animateTo(1),
|
||||
),
|
||||
ActionItem(
|
||||
icon: const Icon(FontAwesomeIcons.comment),
|
||||
selectIcon: const Icon(FontAwesomeIcons.reply),
|
||||
onTap: () => videoDetailCtr.tabCtr.animateTo(1),
|
||||
selectStatus: false,
|
||||
loadingStatus: false,
|
||||
semanticsLabel: '评论',
|
||||
text: !widget.isLoading
|
||||
? Utils.numFormat(widget.bangumiDetail!.stat!['reply']!)
|
||||
: Utils.numFormat(bangumiItem!.stat!['reply']!),
|
||||
),
|
||||
ActionItem(
|
||||
icon: const Icon(FontAwesomeIcons.shareFromSquare),
|
||||
onTap: () => bangumiIntroController.actionShareVideo(context),
|
||||
selectStatus: false,
|
||||
loadingStatus: false,
|
||||
semanticsLabel: '评论',
|
||||
semanticsLabel: '转发',
|
||||
text: !widget.isLoading
|
||||
? Utils.numFormat(widget.bangumiDetail!.stat!['reply']!)
|
||||
: Utils.numFormat(bangumiItem!.stat!['reply']!),
|
||||
),
|
||||
ActionItem(
|
||||
icon: const Icon(FontAwesomeIcons.shareFromSquare),
|
||||
onTap: () =>
|
||||
bangumiIntroController.actionShareVideo(context),
|
||||
selectStatus: false,
|
||||
loadingStatus: false,
|
||||
semanticsLabel: '转发',
|
||||
text: !widget.isLoading
|
||||
? Utils.numFormat(widget.bangumiDetail!.stat!['share']!)
|
||||
: Utils.numFormat(bangumiItem!.stat!['share']!)),
|
||||
],
|
||||
),
|
||||
? Utils.numFormat(widget.bangumiDetail!.stat!['share']!)
|
||||
: Utils.numFormat(bangumiItem!.stat!['share']!)),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
});
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget actionRow(
|
||||
@@ -609,12 +609,12 @@ class AreasAndPubTime extends StatelessWidget {
|
||||
super.key,
|
||||
required this.widget,
|
||||
required this.bangumiItem,
|
||||
required this.t,
|
||||
required this.theme,
|
||||
});
|
||||
|
||||
final BangumiInfo widget;
|
||||
final BangumiInfoModel? bangumiItem;
|
||||
final ThemeData t;
|
||||
final ThemeData theme;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -630,7 +630,7 @@ class AreasAndPubTime extends StatelessWidget {
|
||||
: ''),
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: t.colorScheme.outline,
|
||||
color: theme.colorScheme.outline,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
@@ -640,7 +640,7 @@ class AreasAndPubTime extends StatelessWidget {
|
||||
: bangumiItem!.publish!['pub_time_show'],
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: t.colorScheme.outline,
|
||||
color: theme.colorScheme.outline,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -653,12 +653,12 @@ class NewEpDesc extends StatelessWidget {
|
||||
super.key,
|
||||
required this.widget,
|
||||
required this.bangumiItem,
|
||||
required this.t,
|
||||
required this.theme,
|
||||
});
|
||||
|
||||
final BangumiInfo widget;
|
||||
final BangumiInfoModel? bangumiItem;
|
||||
final ThemeData t;
|
||||
final ThemeData theme;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -668,7 +668,7 @@ class NewEpDesc extends StatelessWidget {
|
||||
: bangumiItem!.newEp!['desc'],
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: t.colorScheme.outline,
|
||||
color: theme.colorScheme.outline,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -22,15 +22,10 @@ class IntroDetail extends CommonCollapseSlidePage {
|
||||
}
|
||||
|
||||
class _IntroDetailState extends CommonCollapseSlidePageState<IntroDetail> {
|
||||
late final TextStyle smallTitle = TextStyle(
|
||||
fontSize: 12,
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
);
|
||||
|
||||
@override
|
||||
Widget get buildPage {
|
||||
Widget buildPage(ThemeData theme) {
|
||||
return Material(
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
color: theme.colorScheme.surface,
|
||||
child: Column(
|
||||
children: [
|
||||
GestureDetector(
|
||||
@@ -44,16 +39,14 @@ class _IntroDetailState extends CommonCollapseSlidePageState<IntroDetail> {
|
||||
width: 32,
|
||||
height: 3,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.onSecondaryContainer
|
||||
.withOpacity(0.5),
|
||||
color:
|
||||
theme.colorScheme.onSecondaryContainer.withOpacity(0.5),
|
||||
borderRadius: const BorderRadius.all(Radius.circular(3))),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: enableSlide ? slideList() : buildList,
|
||||
child: enableSlide ? slideList(theme) : buildList(theme),
|
||||
)
|
||||
],
|
||||
),
|
||||
@@ -61,98 +54,104 @@ class _IntroDetailState extends CommonCollapseSlidePageState<IntroDetail> {
|
||||
}
|
||||
|
||||
@override
|
||||
Widget get buildList => ListView(
|
||||
controller: ScrollController(),
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
padding: EdgeInsets.only(
|
||||
left: 14,
|
||||
right: 14,
|
||||
bottom: MediaQuery.paddingOf(context).bottom + 80,
|
||||
Widget buildList(ThemeData theme) {
|
||||
final TextStyle smallTitle = TextStyle(
|
||||
fontSize: 12,
|
||||
color: theme.colorScheme.onSurface,
|
||||
);
|
||||
return ListView(
|
||||
controller: ScrollController(),
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
padding: EdgeInsets.only(
|
||||
left: 14,
|
||||
right: 14,
|
||||
bottom: MediaQuery.paddingOf(context).bottom + 80,
|
||||
),
|
||||
children: [
|
||||
SelectableText(
|
||||
widget.bangumiDetail.title!,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
children: [
|
||||
SelectableText(
|
||||
widget.bangumiDetail.title!,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
const SizedBox(height: 4),
|
||||
Row(
|
||||
children: [
|
||||
StatView(
|
||||
context: context,
|
||||
theme: 'gray',
|
||||
value: Utils.numFormat(widget.bangumiDetail.stat!['views']),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
StatDanMu(
|
||||
context: context,
|
||||
theme: 'gray',
|
||||
value: Utils.numFormat(widget.bangumiDetail.stat!['danmakus']),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Row(
|
||||
children: [
|
||||
StatView(
|
||||
context: context,
|
||||
theme: 'gray',
|
||||
value: Utils.numFormat(widget.bangumiDetail.stat!['views']),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
StatDanMu(
|
||||
context: context,
|
||||
theme: 'gray',
|
||||
value: Utils.numFormat(widget.bangumiDetail.stat!['danmakus']),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
widget.bangumiDetail.areas!.first['name'],
|
||||
style: smallTitle,
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
widget.bangumiDetail.publish!['pub_time_show'],
|
||||
style: smallTitle,
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
widget.bangumiDetail.newEp!['desc'],
|
||||
style: smallTitle,
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Text(
|
||||
'简介:',
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
SelectableText(
|
||||
widget.bangumiDetail.evaluate!,
|
||||
style: smallTitle.copyWith(fontSize: 14),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Text(
|
||||
'声优:',
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
SelectableText(
|
||||
widget.bangumiDetail.actors!,
|
||||
style: smallTitle.copyWith(fontSize: 14),
|
||||
),
|
||||
if (widget.videoTags is List && widget.videoTags.isNotEmpty) ...[
|
||||
const SizedBox(height: 10),
|
||||
Wrap(
|
||||
spacing: 8,
|
||||
runSpacing: 8,
|
||||
children: (widget.videoTags as List)
|
||||
.map(
|
||||
(item) => SearchText(
|
||||
fontSize: 13,
|
||||
text: item['tag_name'],
|
||||
onTap: (_) => Get.toNamed(
|
||||
'/searchResult',
|
||||
parameters: {
|
||||
'keyword': item['tag_name'],
|
||||
},
|
||||
),
|
||||
onLongPress: (_) => Utils.copyText(item['tag_name']),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
)
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
widget.bangumiDetail.areas!.first['name'],
|
||||
style: smallTitle,
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
widget.bangumiDetail.publish!['pub_time_show'],
|
||||
style: smallTitle,
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
widget.bangumiDetail.newEp!['desc'],
|
||||
style: smallTitle,
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Text(
|
||||
'简介:',
|
||||
style: theme.textTheme.titleMedium,
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
SelectableText(
|
||||
widget.bangumiDetail.evaluate!,
|
||||
style: smallTitle.copyWith(fontSize: 14),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Text(
|
||||
'声优:',
|
||||
style: theme.textTheme.titleMedium,
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
SelectableText(
|
||||
widget.bangumiDetail.actors!,
|
||||
style: smallTitle.copyWith(fontSize: 14),
|
||||
),
|
||||
if (widget.videoTags is List && widget.videoTags.isNotEmpty) ...[
|
||||
const SizedBox(height: 10),
|
||||
Wrap(
|
||||
spacing: 8,
|
||||
runSpacing: 8,
|
||||
children: (widget.videoTags as List)
|
||||
.map(
|
||||
(item) => SearchText(
|
||||
fontSize: 13,
|
||||
text: item['tag_name'],
|
||||
onTap: (_) => Get.toNamed(
|
||||
'/searchResult',
|
||||
parameters: {
|
||||
'keyword': item['tag_name'],
|
||||
},
|
||||
),
|
||||
onLongPress: (_) => Utils.copyText(item['tag_name']),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
)
|
||||
],
|
||||
);
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,15 +35,16 @@ class _PgcIndexPageState extends State<PgcIndexPage>
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
super.build(context);
|
||||
final theme = Theme.of(context);
|
||||
return widget.indexType == null
|
||||
? Scaffold(
|
||||
appBar: AppBar(title: const Text('索引')),
|
||||
body: Obx(() => _buildBody(_ctr.conditionState.value)),
|
||||
body: Obx(() => _buildBody(theme, _ctr.conditionState.value)),
|
||||
)
|
||||
: Obx(() => _buildBody(_ctr.conditionState.value));
|
||||
: Obx(() => _buildBody(theme, _ctr.conditionState.value));
|
||||
}
|
||||
|
||||
Widget _buildBody(LoadingState loadingState) {
|
||||
Widget _buildBody(ThemeData theme, LoadingState loadingState) {
|
||||
return switch (loadingState) {
|
||||
Loading() => loadingWidget,
|
||||
Success() => Builder(builder: (context) {
|
||||
@@ -63,8 +64,8 @@ class _PgcIndexPageState extends State<PgcIndexPage>
|
||||
alignment: Alignment.topCenter,
|
||||
duration: const Duration(milliseconds: 200),
|
||||
child: count > 5
|
||||
? Obx(() => _buildSortWidget(count, data))
|
||||
: _buildSortWidget(count, data),
|
||||
? Obx(() => _buildSortWidget(theme, count, data))
|
||||
: _buildSortWidget(theme, count, data),
|
||||
),
|
||||
),
|
||||
SliverPadding(
|
||||
@@ -90,7 +91,7 @@ class _PgcIndexPageState extends State<PgcIndexPage>
|
||||
};
|
||||
}
|
||||
|
||||
Widget _buildSortWidget(count, data) => Column(
|
||||
Widget _buildSortWidget(ThemeData theme, count, data) => Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@@ -129,9 +130,7 @@ class _PgcIndexPageState extends State<PgcIndexPage>
|
||||
(item[childIndex] is Order
|
||||
? item[childIndex].field
|
||||
: item[childIndex].keyword)
|
||||
? Theme.of(context)
|
||||
.colorScheme
|
||||
.secondaryContainer
|
||||
? theme.colorScheme.secondaryContainer
|
||||
: Colors.transparent,
|
||||
textColor: (item[childIndex] is Order
|
||||
? _ctr.indexParams['order']
|
||||
@@ -144,12 +143,8 @@ class _PgcIndexPageState extends State<PgcIndexPage>
|
||||
(item[childIndex] is Order
|
||||
? item[childIndex].field
|
||||
: item[childIndex].keyword)
|
||||
? Theme.of(context)
|
||||
.colorScheme
|
||||
.onSecondaryContainer
|
||||
: Theme.of(context)
|
||||
.colorScheme
|
||||
.onSurfaceVariant,
|
||||
? theme.colorScheme.onSecondaryContainer
|
||||
: theme.colorScheme.onSurfaceVariant,
|
||||
text: item[childIndex].name,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 6,
|
||||
@@ -192,14 +187,14 @@ class _PgcIndexPageState extends State<PgcIndexPage>
|
||||
Text(
|
||||
_ctr.isExpand.value ? '收起' : '展开',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
color: theme.colorScheme.outline,
|
||||
),
|
||||
),
|
||||
Icon(
|
||||
_ctr.isExpand.value
|
||||
? Icons.keyboard_arrow_up
|
||||
: Icons.keyboard_arrow_down,
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
color: theme.colorScheme.outline,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -46,6 +46,7 @@ class _BangumiPageState extends CommonPageState<BangumiPage, BangumiController>
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
super.build(context);
|
||||
final ThemeData theme = Theme.of(context);
|
||||
return refreshIndicator(
|
||||
onRefresh: () async {
|
||||
await controller.onRefresh();
|
||||
@@ -54,17 +55,17 @@ class _BangumiPageState extends CommonPageState<BangumiPage, BangumiController>
|
||||
controller: controller.scrollController,
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
slivers: [
|
||||
_buildFollow,
|
||||
_buildFollow(theme),
|
||||
if (controller.showPgcTimeline)
|
||||
SliverToBoxAdapter(
|
||||
child: SizedBox(
|
||||
height: Grid.smallCardWidth / 2 / 0.75 +
|
||||
MediaQuery.textScalerOf(context).scale(96),
|
||||
child:
|
||||
Obx(() => _buildTimeline(controller.timelineState.value)),
|
||||
child: Obx(() =>
|
||||
_buildTimeline(theme, controller.timelineState.value)),
|
||||
),
|
||||
),
|
||||
..._buildRcmd,
|
||||
..._buildRcmd(theme),
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -80,7 +81,8 @@ class _BangumiPageState extends CommonPageState<BangumiPage, BangumiController>
|
||||
'日',
|
||||
];
|
||||
|
||||
Widget _buildTimeline(LoadingState<List<Result>?> loadingState) =>
|
||||
Widget _buildTimeline(
|
||||
ThemeData theme, LoadingState<List<Result>?> loadingState) =>
|
||||
switch (loadingState) {
|
||||
Loading() => loadingWidget,
|
||||
Success() => loadingState.response?.isNotEmpty == true
|
||||
@@ -99,7 +101,7 @@ class _BangumiPageState extends CommonPageState<BangumiPage, BangumiController>
|
||||
const SizedBox(width: 16),
|
||||
Text(
|
||||
'追番时间表',
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
style: theme.textTheme.titleMedium,
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
@@ -118,16 +120,13 @@ class _BangumiPageState extends CommonPageState<BangumiPage, BangumiController>
|
||||
vertical: 10,
|
||||
),
|
||||
indicator: BoxDecoration(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.secondaryContainer,
|
||||
color: theme.colorScheme.secondaryContainer,
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(20)),
|
||||
),
|
||||
indicatorSize: TabBarIndicatorSize.tab,
|
||||
labelColor: Theme.of(context)
|
||||
.colorScheme
|
||||
.onSecondaryContainer,
|
||||
labelColor:
|
||||
theme.colorScheme.onSecondaryContainer,
|
||||
labelStyle: TabBarTheme.of(context)
|
||||
.labelStyle
|
||||
?.copyWith(fontSize: 14) ??
|
||||
@@ -200,8 +199,8 @@ class _BangumiPageState extends CommonPageState<BangumiPage, BangumiController>
|
||||
),
|
||||
};
|
||||
|
||||
List<Widget> get _buildRcmd => [
|
||||
_buildRcmdTitle,
|
||||
List<Widget> _buildRcmd(ThemeData theme) => [
|
||||
_buildRcmdTitle(theme),
|
||||
SliverPadding(
|
||||
padding: const EdgeInsets.fromLTRB(
|
||||
StyleString.safeSpace, 0, StyleString.safeSpace, 0),
|
||||
@@ -211,7 +210,7 @@ class _BangumiPageState extends CommonPageState<BangumiPage, BangumiController>
|
||||
),
|
||||
];
|
||||
|
||||
Widget get _buildRcmdTitle => SliverToBoxAdapter(
|
||||
Widget _buildRcmdTitle(ThemeData theme) => SliverToBoxAdapter(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 10,
|
||||
@@ -224,7 +223,7 @@ class _BangumiPageState extends CommonPageState<BangumiPage, BangumiController>
|
||||
children: [
|
||||
Text(
|
||||
'推荐',
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
style: theme.textTheme.titleMedium,
|
||||
),
|
||||
GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
@@ -279,12 +278,12 @@ class _BangumiPageState extends CommonPageState<BangumiPage, BangumiController>
|
||||
strutStyle: StrutStyle(leading: 0, height: 1),
|
||||
style: TextStyle(
|
||||
height: 1,
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
color: theme.colorScheme.secondary,
|
||||
),
|
||||
),
|
||||
Icon(
|
||||
Icons.chevron_right,
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
color: theme.colorScheme.secondary,
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -332,12 +331,12 @@ class _BangumiPageState extends CommonPageState<BangumiPage, BangumiController>
|
||||
};
|
||||
}
|
||||
|
||||
Widget get _buildFollow => SliverToBoxAdapter(
|
||||
Widget _buildFollow(ThemeData theme) => SliverToBoxAdapter(
|
||||
child: Obx(
|
||||
() => controller.isLogin.value
|
||||
? Column(
|
||||
children: [
|
||||
_buildFollowTitle,
|
||||
_buildFollowTitle(theme),
|
||||
SizedBox(
|
||||
height: Grid.smallCardWidth / 2 / 0.75 +
|
||||
MediaQuery.textScalerOf(context).scale(50),
|
||||
@@ -351,14 +350,14 @@ class _BangumiPageState extends CommonPageState<BangumiPage, BangumiController>
|
||||
),
|
||||
);
|
||||
|
||||
Widget get _buildFollowTitle => Padding(
|
||||
Widget _buildFollowTitle(ThemeData theme) => Padding(
|
||||
padding: const EdgeInsets.only(left: 16),
|
||||
child: Row(
|
||||
children: [
|
||||
Obx(
|
||||
() => Text(
|
||||
'最近${widget.tabType == TabType.bangumi ? '追番' : '追剧'}${controller.followCount.value == -1 ? '' : ' ${controller.followCount.value}'}',
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
style: theme.textTheme.titleMedium,
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
@@ -398,13 +397,12 @@ class _BangumiPageState extends CommonPageState<BangumiPage, BangumiController>
|
||||
strutStyle: StrutStyle(leading: 0, height: 1),
|
||||
style: TextStyle(
|
||||
height: 1,
|
||||
color:
|
||||
Theme.of(context).colorScheme.secondary,
|
||||
color: theme.colorScheme.secondary,
|
||||
),
|
||||
),
|
||||
Icon(
|
||||
Icons.chevron_right,
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
color: theme.colorScheme.secondary,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -23,7 +23,6 @@ class BangumiCardV extends StatelessWidget {
|
||||
margin: EdgeInsets.zero,
|
||||
child: InkWell(
|
||||
onLongPress: () => imageSaveDialog(
|
||||
context: context,
|
||||
title: bangumiItem.title,
|
||||
cover: bangumiItem.cover,
|
||||
),
|
||||
@@ -88,6 +87,11 @@ class BangumiCardV extends StatelessWidget {
|
||||
}
|
||||
|
||||
Widget bagumiContent(context) {
|
||||
final theme = Theme.of(context);
|
||||
final style = TextStyle(
|
||||
fontSize: theme.textTheme.labelMedium!.fontSize,
|
||||
color: theme.colorScheme.outline,
|
||||
);
|
||||
return Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(4, 5, 0, 3),
|
||||
@@ -108,19 +112,13 @@ class BangumiCardV extends StatelessWidget {
|
||||
Text(
|
||||
bangumiItem.indexShow,
|
||||
maxLines: 1,
|
||||
style: TextStyle(
|
||||
fontSize: Theme.of(context).textTheme.labelMedium!.fontSize,
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
),
|
||||
style: style,
|
||||
),
|
||||
if (bangumiItem.progress != null)
|
||||
Text(
|
||||
bangumiItem.progress,
|
||||
maxLines: 1,
|
||||
style: TextStyle(
|
||||
fontSize: Theme.of(context).textTheme.labelMedium!.fontSize,
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
),
|
||||
style: style,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -27,7 +27,6 @@ class BangumiCardVMemberHome extends StatelessWidget {
|
||||
PageUtils.viewBangumi(seasonId: seasonId);
|
||||
},
|
||||
onLongPress: () => imageSaveDialog(
|
||||
context: context,
|
||||
title: bangumiItem.title,
|
||||
cover: bangumiItem.cover,
|
||||
),
|
||||
|
||||
@@ -21,7 +21,6 @@ class BangumiCardVPgcIndex extends StatelessWidget {
|
||||
margin: EdgeInsets.zero,
|
||||
child: InkWell(
|
||||
onLongPress: () => imageSaveDialog(
|
||||
context: context,
|
||||
title: bangumiItem['title'],
|
||||
cover: bangumiItem['cover'],
|
||||
),
|
||||
@@ -73,6 +72,7 @@ class BangumiCardVPgcIndex extends StatelessWidget {
|
||||
}
|
||||
|
||||
Widget bagumiContent(context) {
|
||||
final theme = Theme.of(context);
|
||||
return Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(4, 5, 0, 3),
|
||||
@@ -94,8 +94,8 @@ class BangumiCardVPgcIndex extends StatelessWidget {
|
||||
bangumiItem['index_show'],
|
||||
maxLines: 1,
|
||||
style: TextStyle(
|
||||
fontSize: Theme.of(context).textTheme.labelMedium!.fontSize,
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
fontSize: theme.textTheme.labelMedium!.fontSize,
|
||||
color: theme.colorScheme.outline,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -22,7 +22,6 @@ class BangumiCardVSearch extends StatelessWidget {
|
||||
margin: EdgeInsets.zero,
|
||||
child: InkWell(
|
||||
onLongPress: () => imageSaveDialog(
|
||||
context: context,
|
||||
title: item.title?.map((e) => e['text']).join(),
|
||||
cover: item.cover,
|
||||
),
|
||||
|
||||
@@ -22,7 +22,6 @@ class BangumiCardVTimeline extends StatelessWidget {
|
||||
margin: EdgeInsets.zero,
|
||||
child: InkWell(
|
||||
onLongPress: () => imageSaveDialog(
|
||||
context: context,
|
||||
title: item.title,
|
||||
cover: item.cover,
|
||||
),
|
||||
@@ -71,6 +70,7 @@ class BangumiCardVTimeline extends StatelessWidget {
|
||||
}
|
||||
|
||||
Widget bagumiContent(context) {
|
||||
final theme = Theme.of(context);
|
||||
return Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(4, 5, 0, 3),
|
||||
@@ -90,8 +90,8 @@ class BangumiCardVTimeline extends StatelessWidget {
|
||||
item.pubIndex ?? '',
|
||||
maxLines: 1,
|
||||
style: TextStyle(
|
||||
fontSize: Theme.of(context).textTheme.labelMedium!.fontSize,
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
fontSize: theme.textTheme.labelMedium!.fontSize,
|
||||
color: theme.colorScheme.outline,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -81,6 +81,7 @@ class _BangumiPanelState extends State<BangumiPanel> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
return Column(
|
||||
children: [
|
||||
Padding(
|
||||
@@ -95,7 +96,7 @@ class _BangumiPanelState extends State<BangumiPanel> {
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
color: theme.colorScheme.outline,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -140,7 +141,7 @@ class _BangumiPanelState extends State<BangumiPanel> {
|
||||
right: index == widget.pages.length - 1 ? 0 : 10,
|
||||
),
|
||||
child: Material(
|
||||
color: Theme.of(context).colorScheme.onInverseSurface,
|
||||
color: theme.colorScheme.onInverseSurface,
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
clipBehavior: Clip.hardEdge,
|
||||
child: InkWell(
|
||||
@@ -169,7 +170,7 @@ class _BangumiPanelState extends State<BangumiPanel> {
|
||||
if (index == currentIndex) ...<Widget>[
|
||||
Image.asset(
|
||||
'assets/images/live.png',
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
color: theme.colorScheme.primary,
|
||||
height: 12,
|
||||
semanticLabel: "正在播放:",
|
||||
),
|
||||
@@ -185,10 +186,8 @@ class _BangumiPanelState extends State<BangumiPanel> {
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: index == currentIndex
|
||||
? Theme.of(context).colorScheme.primary
|
||||
: Theme.of(context)
|
||||
.colorScheme
|
||||
.onSurface),
|
||||
? theme.colorScheme.primary
|
||||
: theme.colorScheme.onSurface),
|
||||
)),
|
||||
const SizedBox(width: 2),
|
||||
if (item.badge != null) ...[
|
||||
@@ -205,8 +204,7 @@ class _BangumiPanelState extends State<BangumiPanel> {
|
||||
item.badge!,
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
color:
|
||||
Theme.of(context).colorScheme.primary,
|
||||
color: theme.colorScheme.primary,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -222,10 +220,8 @@ class _BangumiPanelState extends State<BangumiPanel> {
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: index == currentIndex
|
||||
? Theme.of(context).colorScheme.primary
|
||||
: Theme.of(context)
|
||||
.colorScheme
|
||||
.onSurface),
|
||||
? theme.colorScheme.primary
|
||||
: theme.colorScheme.onSurface),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
)
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user