feat: pure black theme

Closes #254

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-02-14 16:10:10 +08:00
parent 064c8a9dfe
commit 6c3062ba2d
25 changed files with 361 additions and 317 deletions

View File

@@ -275,144 +275,145 @@ class _ListSheetContentState extends State<ListSheetContent>
@override
Widget build(BuildContext context) {
return Container(
height: Utils.getSheetHeight(context),
return Material(
color: Theme.of(context).colorScheme.surface,
child: Column(
children: [
Container(
height: 45,
padding: EdgeInsets.symmetric(
horizontal: widget.showTitle != false ? 14 : 6),
child: Row(
children: [
if (widget.showTitle != false)
Text(
'合集(${_isList ? widget.season.epCount : episodes?.length ?? ''})',
style: Theme.of(context).textTheme.titleMedium,
),
StreamBuilder(
stream: _favStream?.stream,
builder: (context, snapshot) => snapshot.hasData
? mediumButton(
tooltip: _seasonFav == 1 ? '取消订阅' : '订阅',
icon: _seasonFav == 1
? Icons.notifications_off_outlined
: Icons.notifications_active_outlined,
onPressed: () async {
dynamic result = await VideoHttp.seasonFav(
isFav: _seasonFav == 1,
seasonId: widget.season.id,
);
if (result['status']) {
SmartDialog.showToast(
'${_seasonFav == 1 ? '取消' : ''}订阅成功');
_seasonFav = _seasonFav == 1 ? 0 : 1;
_favStream?.add(_seasonFav);
} else {
SmartDialog.showToast(result['msg']);
}
},
)
: const SizedBox.shrink(),
),
mediumButton(
tooltip: '跳至顶部',
icon: Icons.vertical_align_top,
onPressed: () {
try {
itemScrollController[_ctr?.index ?? 0].scrollTo(
index: !reverse[_ctr?.index ?? 0]
? 0
: _isList
? widget.season.sections[_ctr?.index].episodes
.length -
1
: episodes.length - 1,
duration: const Duration(milliseconds: 200),
);
} catch (_) {}
},
),
mediumButton(
tooltip: '跳至底部',
icon: Icons.vertical_align_bottom,
onPressed: () {
try {
itemScrollController[_ctr?.index ?? 0].scrollTo(
index: !reverse[_ctr?.index ?? 0]
? _isList
? widget.season.sections[_ctr?.index].episodes
.length -
1
: episodes.length - 1
: 0,
duration: const Duration(milliseconds: 200),
);
} catch (_) {}
},
),
mediumButton(
tooltip: '跳至当前',
icon: Icons.my_location,
onPressed: () async {
if (_ctr != null && _ctr?.index != (_index)) {
_ctr?.animateTo(_index);
await Future.delayed(const Duration(milliseconds: 225));
}
try {
itemScrollController[_ctr?.index ?? 0].scrollTo(
index: currentIndex,
duration: const Duration(milliseconds: 200),
);
} catch (_) {}
},
),
if (widget.isSupportReverse == true)
if (!_isList)
_reverseButton
else
StreamBuilder(
stream: _indexStream?.stream,
initialData: _index,
builder: (context, snapshot) {
return snapshot.data == _index
? _reverseButton
: const SizedBox.shrink();
},
child: SizedBox(
height: Utils.getSheetHeight(context),
child: Column(
children: [
Container(
height: 45,
padding: EdgeInsets.symmetric(
horizontal: widget.showTitle != false ? 14 : 6),
child: Row(
children: [
if (widget.showTitle != false)
Text(
'合集(${_isList ? widget.season.epCount : episodes?.length ?? ''})',
style: Theme.of(context).textTheme.titleMedium,
),
const Spacer(),
StreamBuilder(
stream: _indexStream?.stream,
initialData: _index,
builder: (context, snapshot) => mediumButton(
tooltip: reverse[snapshot.data] ? '顺序' : '倒序',
icon: !reverse[snapshot.data]
? MdiIcons.sortNumericAscending
: MdiIcons.sortNumericDescending,
StreamBuilder(
stream: _favStream?.stream,
builder: (context, snapshot) => snapshot.hasData
? mediumButton(
tooltip: _seasonFav == 1 ? '取消订阅' : '订阅',
icon: _seasonFav == 1
? Icons.notifications_off_outlined
: Icons.notifications_active_outlined,
onPressed: () async {
dynamic result = await VideoHttp.seasonFav(
isFav: _seasonFav == 1,
seasonId: widget.season.id,
);
if (result['status']) {
SmartDialog.showToast(
'${_seasonFav == 1 ? '取消' : ''}订阅成功');
_seasonFav = _seasonFav == 1 ? 0 : 1;
_favStream?.add(_seasonFav);
} else {
SmartDialog.showToast(result['msg']);
}
},
)
: const SizedBox.shrink(),
),
mediumButton(
tooltip: '跳至顶部',
icon: Icons.vertical_align_top,
onPressed: () {
setState(() {
reverse[_ctr?.index ?? 0] = !reverse[_ctr?.index ?? 0];
});
try {
itemScrollController[_ctr?.index ?? 0].scrollTo(
index: !reverse[_ctr?.index ?? 0]
? 0
: _isList
? widget.season.sections[_ctr?.index].episodes
.length -
1
: episodes.length - 1,
duration: const Duration(milliseconds: 200),
);
} catch (_) {}
},
),
),
if (widget.onClose != null)
mediumButton(
tooltip: '关闭',
icon: Icons.close,
onPressed: widget.onClose,
tooltip: '跳至底部',
icon: Icons.vertical_align_bottom,
onPressed: () {
try {
itemScrollController[_ctr?.index ?? 0].scrollTo(
index: !reverse[_ctr?.index ?? 0]
? _isList
? widget.season.sections[_ctr?.index].episodes
.length -
1
: episodes.length - 1
: 0,
duration: const Duration(milliseconds: 200),
);
} catch (_) {}
},
),
],
mediumButton(
tooltip: '跳至当前',
icon: Icons.my_location,
onPressed: () async {
if (_ctr != null && _ctr?.index != (_index)) {
_ctr?.animateTo(_index);
await Future.delayed(const Duration(milliseconds: 225));
}
try {
itemScrollController[_ctr?.index ?? 0].scrollTo(
index: currentIndex,
duration: const Duration(milliseconds: 200),
);
} catch (_) {}
},
),
if (widget.isSupportReverse == true)
if (!_isList)
_reverseButton
else
StreamBuilder(
stream: _indexStream?.stream,
initialData: _index,
builder: (context, snapshot) {
return snapshot.data == _index
? _reverseButton
: const SizedBox.shrink();
},
),
const Spacer(),
StreamBuilder(
stream: _indexStream?.stream,
initialData: _index,
builder: (context, snapshot) => mediumButton(
tooltip: reverse[snapshot.data] ? '顺序' : '倒序',
icon: !reverse[snapshot.data]
? MdiIcons.sortNumericAscending
: MdiIcons.sortNumericDescending,
onPressed: () {
setState(() {
reverse[_ctr?.index ?? 0] =
!reverse[_ctr?.index ?? 0];
});
},
),
),
if (widget.onClose != null)
mediumButton(
tooltip: '关闭',
icon: Icons.close,
onPressed: widget.onClose,
),
],
),
),
),
Divider(
height: 1,
color: Theme.of(context).dividerColor.withOpacity(0.1),
),
if (_isList)
Material(
child: TabBar(
Divider(
height: 1,
color: Theme.of(context).dividerColor.withOpacity(0.1),
),
if (_isList)
TabBar(
controller: _ctr,
padding: const EdgeInsets.only(right: 60),
isScrollable: true,
@@ -422,20 +423,20 @@ class _ListSheetContentState extends State<ListSheetContent>
dividerHeight: 1,
dividerColor: Theme.of(context).dividerColor.withOpacity(0.1),
),
Expanded(
child: _isList
? TabBarView(
controller: _ctr,
children: List.generate(
widget.season.sections.length,
(index) => _buildBody(
index, widget.season.sections[index].episodes),
),
)
: _buildBody(null, episodes),
),
Expanded(
child: _isList
? TabBarView(
controller: _ctr,
children: List.generate(
widget.season.sections.length,
(index) => _buildBody(
index, widget.season.sections[index].episodes),
),
)
: _buildBody(null, episodes),
),
],
],
),
),
);
}
@@ -464,30 +465,28 @@ class _ListSheetContentState extends State<ListSheetContent>
},
);
Widget _buildBody(i, episodes) => Material(
child: ScrollablePositionedList.separated(
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).padding.bottom + 80,
),
reverse: reverse[i ?? 0],
itemCount: episodes.length,
itemBuilder: (BuildContext context, int index) {
return buildEpisodeListItem(
episodes[index],
index,
episodes.length,
i != null
? i == (_index)
? currentIndex == index
: false
: currentIndex == index,
);
},
itemScrollController: itemScrollController[i ?? 0],
separatorBuilder: (context, index) => Divider(
height: 1,
color: Theme.of(context).dividerColor.withOpacity(0.1),
),
Widget _buildBody(i, episodes) => ScrollablePositionedList.separated(
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).padding.bottom + 80,
),
reverse: reverse[i ?? 0],
itemCount: episodes.length,
itemBuilder: (BuildContext context, int index) {
return buildEpisodeListItem(
episodes[index],
index,
episodes.length,
i != null
? i == (_index)
? currentIndex == index
: false
: currentIndex == index,
);
},
itemScrollController: itemScrollController[i ?? 0],
separatorBuilder: (context, index) => Divider(
height: 1,
color: Theme.of(context).dividerColor.withOpacity(0.1),
),
);
}

View File

@@ -6,13 +6,14 @@ Widget statDanMu({
String? theme,
dynamic danmu,
String? size,
Color? textColor,
}) {
Map<String, Color> colorObject = {
'white': Colors.white,
'gray': Theme.of(context).colorScheme.outline.withOpacity(0.8),
'black': Theme.of(context).colorScheme.onSurface.withOpacity(0.7),
};
Color color = colorObject[theme]!;
Color color = textColor ?? colorObject[theme]!;
return Row(
children: [
Icon(

View File

@@ -7,13 +7,14 @@ Widget statView({
dynamic view,
String? size,
String? goto,
Color? textColor,
}) {
Map<String, Color> colorObject = {
'white': Colors.white,
'gray': Theme.of(context).colorScheme.outline.withOpacity(0.8),
'black': Theme.of(context).colorScheme.onSurface.withOpacity(0.7),
};
Color color = colorObject[theme]!;
Color color = textColor ?? colorObject[theme]!;
return Row(
children: [
Icon(

View File

@@ -2,6 +2,7 @@ import 'dart:io';
import 'package:PiliPlus/build_config.dart';
import 'package:PiliPlus/utils/cache_manage.dart';
import 'package:PiliPlus/utils/utils.dart';
import 'package:flex_seed_scheme/flex_seed_scheme.dart';
import 'package:flutter/services.dart';
import 'package:flutter_displaymode/flutter_displaymode.dart';
@@ -177,6 +178,7 @@ class MyApp extends StatelessWidget {
// tones: FlexTones.soft(Brightness.dark),
);
}
// 图片缓存
// PaintingBinding.instance.imageCache.maximumSizeBytes = 1000 << 20;
return GetMaterialApp(
@@ -229,7 +231,7 @@ class MyApp extends StatelessWidget {
bool isDark = false,
required FlexSchemeVariant variant,
}) {
return ThemeData(
ThemeData themeData = ThemeData(
colorScheme: colorScheme,
useMaterial3: true,
appBarTheme: AppBarTheme(
@@ -282,6 +284,10 @@ class MyApp extends StatelessWidget {
),
),
);
if (isDark && GStorage.isPureBlackTheme) {
themeData = Utils.darkenTheme(themeData);
}
return themeData;
}
}

View File

@@ -450,6 +450,7 @@ class _BangumiInfoState extends State<BangumiInfo>
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(

View File

@@ -136,7 +136,6 @@ class _DynamicsPageState extends State<DynamicsPage>
super.build(context);
return Scaffold(
resizeToAvoidBottomInset: false,
backgroundColor: Colors.transparent,
appBar: AppBar(
leading: upPanelPosition == UpPanelPosition.rightDrawer
? _createDynamicBtn(false)

View File

@@ -39,7 +39,7 @@ class DynamicPanel extends StatelessWidget {
child: Material(
elevation: 0,
clipBehavior: Clip.hardEdge,
color: Theme.of(context).cardColor.withOpacity(0.5),
color: Colors.transparent,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5),
),

View File

@@ -47,6 +47,7 @@ class _HomePageState extends State<HomePage>
if (_homeController.tabs.length > 1) ...[
const SizedBox(height: 4),
Material(
color: Theme.of(context).colorScheme.surface,
child: SizedBox(
height: 42,
child: TabBar(

View File

@@ -134,14 +134,17 @@ class _MemberPageNewState extends State<MemberPageNew>
);
}
Widget get _buildTab => TabBar(
controller: _userController.tabController,
tabs: _userController.tabs,
onTap: (value) {
if (_userController.tabController?.indexIsChanging == false) {
_key.currentState?.outerController.animToTop();
}
},
Widget get _buildTab => Material(
color: Theme.of(context).colorScheme.surface,
child: TabBar(
controller: _userController.tabController,
tabs: _userController.tabs,
onTap: (value) {
if (_userController.tabController?.indexIsChanging == false) {
_key.currentState?.outerController.animToTop();
}
},
),
);
Widget get _buildBody => SafeArea(
@@ -198,9 +201,7 @@ class _MemberPageNewState extends State<MemberPageNew>
bottom: needTab && (_userController.tab2?.length ?? -1) > 1
? PreferredSize(
preferredSize: Size.fromHeight(48),
child: Material(
child: _buildTab,
),
child: _buildTab,
)
: null,
actions: [

View File

@@ -23,6 +23,7 @@ class HotKeyword extends StatelessWidget {
SizedBox(
width: width! / 2 - 4,
child: Material(
color: Colors.transparent,
borderRadius: BorderRadius.circular(3),
clipBehavior: Clip.hardEdge,
child: InkWell(

View File

@@ -31,9 +31,11 @@ class SearchText extends StatelessWidget {
onTap: () {
onTap?.call(text);
},
onLongPress: () {
onLongPress?.call(text);
},
onLongPress: onLongPress != null
? () {
onLongPress!(text);
}
: null,
borderRadius: BorderRadius.circular(6),
child: Padding(
padding: padding ??

View File

@@ -294,7 +294,6 @@ class ArticlePanelController extends GetxController {
await ctr.onRefresh();
SmartDialog.dismiss();
},
onLongPress: (_) {},
bgColor: item['value'] == currentOrderFilterval.value
? Theme.of(context).colorScheme.secondaryContainer
: null,
@@ -328,7 +327,6 @@ class ArticlePanelController extends GetxController {
await ctr.onRefresh();
SmartDialog.dismiss();
},
onLongPress: (_) {},
bgColor: item['value'] == currentZoneFilterval.value
? Theme.of(context).colorScheme.secondaryContainer
: null,

View File

@@ -222,7 +222,6 @@ class UserPanelController extends GetxController {
await ctr.onRefresh();
SmartDialog.dismiss();
},
onLongPress: (_) {},
bgColor: item['value'] == currentOrderFilterval.value
? Theme.of(context).colorScheme.secondaryContainer
: null,
@@ -256,7 +255,6 @@ class UserPanelController extends GetxController {
await ctr.onRefresh();
SmartDialog.dismiss();
},
onLongPress: (_) {},
bgColor: item['value'] == currentUserTypeFilterval.value
? Theme.of(context).colorScheme.secondaryContainer
: null,

View File

@@ -38,12 +38,15 @@ Widget searchVideoPanel(context, ctr, LoadingState loadingState) {
// spacing: ,
children: [
for (var i in controller.filterList) ...[
CustomFilterChip(
label: i['label'],
type: i['type'],
selectedType: controller.selectedType.value,
callFn: (bool selected) async {
debugPrint('selected: $selected');
SearchText(
fontSize: 13,
text: i['label'],
bgColor: Colors.transparent,
textColor:
controller.selectedType.value == i['type']
? Theme.of(context).colorScheme.primary
: Theme.of(context).colorScheme.outline,
onTap: (value) async {
controller.selectedType.value = i['type'];
ctr.order.value =
i['type'].toString().split('.').last;
@@ -122,51 +125,6 @@ Widget searchVideoPanel(context, ctr, LoadingState loadingState) {
);
}
class CustomFilterChip extends StatelessWidget {
const CustomFilterChip({
this.label,
this.type,
this.selectedType,
this.callFn,
super.key,
});
final String? label;
final ArchiveFilterType? type;
final ArchiveFilterType? selectedType;
final Function? callFn;
@override
Widget build(BuildContext context) {
return SizedBox(
height: 34,
child: FilterChip(
padding: const EdgeInsets.only(left: 8, right: 8),
labelPadding: EdgeInsets.zero,
label: Text(
label!,
style: const TextStyle(fontSize: 13),
),
labelStyle: TextStyle(
color: type == selectedType
? Theme.of(context).colorScheme.primary
: Theme.of(context).colorScheme.outline),
selected: type == selectedType,
showCheckmark: false,
shape: ContinuousRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
selectedColor: Colors.transparent,
// backgroundColor:
// Theme.of(context).colorScheme.surfaceVariant.withOpacity(0.5),
backgroundColor: Colors.transparent,
side: BorderSide.none,
onSelected: (bool selected) => callFn?.call(selected),
),
);
}
}
class VideoPanelController extends GetxController {
RxList<Map> filterList = [{}].obs;
Rx<ArchiveFilterType> selectedType = ArchiveFilterType.values.first.obs;
@@ -304,7 +262,6 @@ class VideoPanelController extends GetxController {
}
});
},
onLongPress: (_) {},
bgColor: currentPubTimeFilterval == -1 &&
(isFirst ? customPubBegin : customPubEnd)
? Theme.of(context).colorScheme.secondaryContainer
@@ -380,7 +337,6 @@ class VideoPanelController extends GetxController {
await ctr.onRefresh();
SmartDialog.dismiss();
},
onLongPress: (_) {},
bgColor: item['value'] == currentPubTimeFilterval
? Theme.of(context)
.colorScheme
@@ -431,7 +387,6 @@ class VideoPanelController extends GetxController {
await ctr.onRefresh();
SmartDialog.dismiss();
},
onLongPress: (_) {},
bgColor: item['value'] == currentTimeFilterval
? Theme.of(context)
.colorScheme
@@ -469,7 +424,6 @@ class VideoPanelController extends GetxController {
await ctr.onRefresh();
SmartDialog.dismiss();
},
onLongPress: (_) {},
bgColor: item['value'] == currentZoneFilterval
? Theme.of(context)
.colorScheme

View File

@@ -480,6 +480,18 @@ List<SettingsModel> get styleSettings => [
title: '主题模式',
getSubtitle: () => '当前模式:${GStorage.themeType.description}',
),
SettingsModel(
settingsType: SettingsType.sw1tch,
leading: const Icon(Icons.invert_colors),
title: '纯黑主题',
setKey: SettingBoxKey.isPureBlackTheme,
defaultVal: false,
onChanged: (value) {
if (Theme.of(Get.context!).brightness == Brightness.dark) {
Get.forceAppUpdate();
}
},
),
SettingsModel(
settingsType: SettingsType.normal,
onTap: (setState) => Get.toNamed('/colorSetting'),

View File

@@ -557,6 +557,7 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
? videoDetail.stat?.view ?? '-'
: videoItem['stat']?.view ?? '-',
size: 'medium',
textColor: t.colorScheme.outline,
),
const SizedBox(width: 10),
statDanMu(
@@ -566,6 +567,7 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
? videoDetail.stat?.danmu ?? '-'
: videoItem['stat']?.danmu ?? '-',
size: 'medium',
textColor: t.colorScheme.outline,
),
const SizedBox(width: 10),
Text(

View File

@@ -88,6 +88,7 @@ class _FavPanelState extends State<FavPanel> {
),
Expanded(
child: Material(
color: Theme.of(context).colorScheme.surface,
child: FutureBuilder(
future: _futureBuilderFuture,
builder: (BuildContext context, AsyncSnapshot snapshot) {

View File

@@ -98,6 +98,7 @@ class _GroupPanelState extends State<GroupPanel> {
),
Expanded(
child: Material(
color: Theme.of(context).colorScheme.surface,
child: FutureBuilder(
future: _futureBuilderFuture,
builder: (BuildContext context, AsyncSnapshot snapshot) {

View File

@@ -60,11 +60,9 @@ class _RelatedVideoPanelState extends State<RelatedVideoPanel>
height: MediaQuery.of(context).padding.bottom,
);
} else {
return Material(
child: VideoCardH(
videoItem: loadingState.response[index],
showPubdate: true,
),
return VideoCardH(
videoItem: loadingState.response[index],
showPubdate: true,
);
}
}, childCount: loadingState.response.length + 1),

View File

@@ -134,10 +134,7 @@ class ReplyItem extends StatelessWidget {
indent: 55,
endIndent: 15,
height: 0.3,
color: Theme.of(context)
.colorScheme
.onInverseSurface
.withOpacity(0.5),
color: Theme.of(context).colorScheme.outline.withOpacity(0.08),
)
],
),

View File

@@ -160,8 +160,7 @@ class ReplyItemGrpc extends StatelessWidget {
indent: 55,
endIndent: 15,
height: 0.3,
color:
Theme.of(context).colorScheme.onInverseSurface.withOpacity(0.5),
color: Theme.of(context).colorScheme.outline.withOpacity(0.08),
)
],
);

View File

@@ -1280,75 +1280,72 @@ class _VideoDetailPageState extends State<VideoDetailPage>
),
),
),
child: Material(
child: Row(
children: [
if (tabs.isEmpty)
const Spacer()
else
Flexible(
flex: tabs.length == 3 ? 2 : 1,
child: showReply ? Obx(() => tabbar()) : tabbar(),
),
child: Row(
children: [
if (tabs.isEmpty)
const Spacer()
else
Flexible(
flex: 1,
child: Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
SizedBox(
height: 32,
child: TextButton(
style: ButtonStyle(
padding: WidgetStateProperty.all(EdgeInsets.zero),
),
onPressed: videoDetailController.showShootDanmakuSheet,
child: Text(
'发弹幕',
style: TextStyle(
fontSize: 12,
color:
Theme.of(context).colorScheme.onSurfaceVariant,
),
flex: tabs.length == 3 ? 2 : 1,
child: showReply ? Obx(() => tabbar()) : tabbar(),
),
Flexible(
flex: 1,
child: Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
SizedBox(
height: 32,
child: TextButton(
style: ButtonStyle(
padding: WidgetStateProperty.all(EdgeInsets.zero),
),
onPressed: videoDetailController.showShootDanmakuSheet,
child: Text(
'发弹幕',
style: TextStyle(
fontSize: 12,
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
),
),
SizedBox(
width: 38,
height: 38,
child: Obx(
() => IconButton(
onPressed: () {
videoDetailController
.plPlayerController.isOpenDanmu.value =
!videoDetailController
.plPlayerController.isOpenDanmu.value;
setting.put(
SettingBoxKey.enableShowDanmaku,
videoDetailController
.plPlayerController.isOpenDanmu.value);
},
icon: SvgPicture.asset(
videoDetailController
.plPlayerController.isOpenDanmu.value
? 'assets/images/video/danmu_open.svg'
: 'assets/images/video/danmu_close.svg',
// ignore: deprecated_member_use
color: videoDetailController
.plPlayerController.isOpenDanmu.value
? Theme.of(context).colorScheme.secondary
: Theme.of(context).colorScheme.outline,
),
),
SizedBox(
width: 38,
height: 38,
child: Obx(
() => IconButton(
onPressed: () {
videoDetailController
.plPlayerController.isOpenDanmu.value =
!videoDetailController
.plPlayerController.isOpenDanmu.value;
setting.put(
SettingBoxKey.enableShowDanmaku,
videoDetailController
.plPlayerController.isOpenDanmu.value);
},
icon: SvgPicture.asset(
videoDetailController
.plPlayerController.isOpenDanmu.value
? 'assets/images/video/danmu_open.svg'
: 'assets/images/video/danmu_close.svg',
// ignore: deprecated_member_use
color: videoDetailController
.plPlayerController.isOpenDanmu.value
? Theme.of(context).colorScheme.secondary
: Theme.of(context).colorScheme.outline,
),
),
),
const SizedBox(width: 14),
],
),
),
const SizedBox(width: 14),
],
),
),
],
),
),
],
),
);
}
@@ -1521,7 +1518,10 @@ class _VideoDetailPageState extends State<VideoDetailPage>
height: 1,
indent: 12,
endIndent: 12,
color: Theme.of(context).dividerColor.withOpacity(0.06),
color: Theme.of(context)
.colorScheme
.outline
.withOpacity(0.08),
),
),
),

View File

@@ -97,3 +97,21 @@ extension Unique<E, Id> on List<E> {
return list;
}
}
extension ColorExtension on Color {
Color darken([double amount = .5]) {
assert(amount >= 0 && amount <= 1, 'Amount must be between 0 and 1');
return Color.lerp(this, Colors.black, amount)!;
}
Color blend(Color color, [double fraction = 0.5]) {
assert(fraction >= 0 && fraction <= 1, 'Fraction must be between 0 and 1');
final blendedRed = (red * (1 - fraction) + color.red * fraction).toInt();
final blendedGreen =
(green * (1 - fraction) + color.green * fraction).toInt();
final blendedBlue = (blue * (1 - fraction) + color.blue * fraction).toInt();
final blendedAlpha =
(alpha * (1 - fraction) + color.alpha * fraction).toInt();
return Color.fromARGB(blendedAlpha, blendedRed, blendedGreen, blendedBlue);
}
}

View File

@@ -367,6 +367,9 @@ class GStorage {
static bool get coinWithLike =>
GStorage.setting.get(SettingBoxKey.coinWithLike, defaultValue: false);
static bool get isPureBlackTheme =>
GStorage.setting.get(SettingBoxKey.isPureBlackTheme, defaultValue: false);
static List<double> get dynamicDetailRatio => List<double>.from(setting
.get(SettingBoxKey.dynamicDetailRatio, defaultValue: [60.0, 40.0]));
@@ -599,6 +602,7 @@ class SettingBoxKey {
showDmChart = 'showDmChart',
enableCommAntifraud = 'enableCommAntifraud',
coinWithLike = 'coinWithLike',
isPureBlackTheme = 'isPureBlackTheme',
// Sponsor Block
enableSponsorBlock = 'enableSponsorBlock',

View File

@@ -44,6 +44,56 @@ class Utils {
static const channel = MethodChannel("PiliPlus");
static darkenTheme(ThemeData themeData) {
// return themeData;
Color color = themeData.colorScheme.surfaceContainerHighest.darken(0.7);
return themeData.copyWith(
scaffoldBackgroundColor: Colors.black,
appBarTheme: themeData.appBarTheme.copyWith(
backgroundColor: Colors.black,
),
cardTheme: themeData.cardTheme.copyWith(
color: Colors.black,
),
dialogTheme: themeData.dialogTheme.copyWith(
backgroundColor: color,
),
bottomSheetTheme:
themeData.bottomSheetTheme.copyWith(backgroundColor: color),
bottomNavigationBarTheme:
themeData.bottomNavigationBarTheme.copyWith(backgroundColor: color),
navigationBarTheme:
themeData.navigationBarTheme.copyWith(backgroundColor: color),
navigationRailTheme:
themeData.navigationRailTheme.copyWith(backgroundColor: Colors.black),
colorScheme: themeData.colorScheme.copyWith(
primary: themeData.colorScheme.primary.darken(0.1),
onPrimary: themeData.colorScheme.onPrimary.darken(0.1),
primaryContainer: themeData.colorScheme.primaryContainer.darken(0.1),
onPrimaryContainer:
themeData.colorScheme.onPrimaryContainer.darken(0.1),
inversePrimary: themeData.colorScheme.inversePrimary.darken(0.1),
secondary: themeData.colorScheme.secondary.darken(0.1),
onSecondary: themeData.colorScheme.onSecondary.darken(0.1),
secondaryContainer:
themeData.colorScheme.secondaryContainer.darken(0.1),
onSecondaryContainer:
themeData.colorScheme.onSecondaryContainer.darken(0.1),
error: themeData.colorScheme.error.darken(0.1),
surface: Colors.black,
onSurface: themeData.colorScheme.onSurface.darken(0.15),
surfaceTint: themeData.colorScheme.surfaceTint.darken(),
inverseSurface: themeData.colorScheme.inverseSurface.darken(),
onInverseSurface: themeData.colorScheme.onInverseSurface.darken(),
surfaceContainer: themeData.colorScheme.surfaceContainer.darken(),
surfaceContainerHigh:
themeData.colorScheme.surfaceContainerHigh.darken(),
surfaceContainerHighest:
themeData.colorScheme.surfaceContainerHighest.darken(0.4),
),
);
}
static void onCopyOrMove({
required BuildContext context,
required bool isCopy,