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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Material(
height: Utils.getSheetHeight(context),
color: Theme.of(context).colorScheme.surface, color: Theme.of(context).colorScheme.surface,
child: Column( child: SizedBox(
children: [ height: Utils.getSheetHeight(context),
Container( child: Column(
height: 45, children: [
padding: EdgeInsets.symmetric( Container(
horizontal: widget.showTitle != false ? 14 : 6), height: 45,
child: Row( padding: EdgeInsets.symmetric(
children: [ horizontal: widget.showTitle != false ? 14 : 6),
if (widget.showTitle != false) child: Row(
Text( children: [
'合集(${_isList ? widget.season.epCount : episodes?.length ?? ''})', if (widget.showTitle != false)
style: Theme.of(context).textTheme.titleMedium, Text(
), '合集(${_isList ? widget.season.epCount : episodes?.length ?? ''})',
StreamBuilder( style: Theme.of(context).textTheme.titleMedium,
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();
},
), ),
const Spacer(), StreamBuilder(
StreamBuilder( stream: _favStream?.stream,
stream: _indexStream?.stream, builder: (context, snapshot) => snapshot.hasData
initialData: _index, ? mediumButton(
builder: (context, snapshot) => mediumButton( tooltip: _seasonFav == 1 ? '取消订阅' : '订阅',
tooltip: reverse[snapshot.data] ? '顺序' : '倒序', icon: _seasonFav == 1
icon: !reverse[snapshot.data] ? Icons.notifications_off_outlined
? MdiIcons.sortNumericAscending : Icons.notifications_active_outlined,
: MdiIcons.sortNumericDescending, 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: () { onPressed: () {
setState(() { try {
reverse[_ctr?.index ?? 0] = !reverse[_ctr?.index ?? 0]; 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( mediumButton(
tooltip: '关闭', tooltip: '跳至底部',
icon: Icons.close, icon: Icons.vertical_align_bottom,
onPressed: widget.onClose, 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(
Divider( height: 1,
height: 1, color: Theme.of(context).dividerColor.withOpacity(0.1),
color: Theme.of(context).dividerColor.withOpacity(0.1), ),
), if (_isList)
if (_isList) TabBar(
Material(
child: TabBar(
controller: _ctr, controller: _ctr,
padding: const EdgeInsets.only(right: 60), padding: const EdgeInsets.only(right: 60),
isScrollable: true, isScrollable: true,
@@ -422,20 +423,20 @@ class _ListSheetContentState extends State<ListSheetContent>
dividerHeight: 1, dividerHeight: 1,
dividerColor: Theme.of(context).dividerColor.withOpacity(0.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( Widget _buildBody(i, episodes) => ScrollablePositionedList.separated(
child: ScrollablePositionedList.separated( padding: EdgeInsets.only(
padding: EdgeInsets.only( bottom: MediaQuery.of(context).padding.bottom + 80,
bottom: MediaQuery.of(context).padding.bottom + 80, ),
), reverse: reverse[i ?? 0],
reverse: reverse[i ?? 0], itemCount: episodes.length,
itemCount: episodes.length, itemBuilder: (BuildContext context, int index) {
itemBuilder: (BuildContext context, int index) { return buildEpisodeListItem(
return buildEpisodeListItem( episodes[index],
episodes[index], index,
index, episodes.length,
episodes.length, i != null
i != null ? i == (_index)
? i == (_index) ? currentIndex == index
? currentIndex == index : false
: false : currentIndex == index,
: currentIndex == index, );
); },
}, itemScrollController: itemScrollController[i ?? 0],
itemScrollController: itemScrollController[i ?? 0], separatorBuilder: (context, index) => Divider(
separatorBuilder: (context, index) => Divider( height: 1,
height: 1, color: Theme.of(context).dividerColor.withOpacity(0.1),
color: Theme.of(context).dividerColor.withOpacity(0.1),
),
), ),
); );
} }

View File

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

View File

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

View File

@@ -2,6 +2,7 @@ import 'dart:io';
import 'package:PiliPlus/build_config.dart'; import 'package:PiliPlus/build_config.dart';
import 'package:PiliPlus/utils/cache_manage.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:flex_seed_scheme/flex_seed_scheme.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_displaymode/flutter_displaymode.dart'; import 'package:flutter_displaymode/flutter_displaymode.dart';
@@ -177,6 +178,7 @@ class MyApp extends StatelessWidget {
// tones: FlexTones.soft(Brightness.dark), // tones: FlexTones.soft(Brightness.dark),
); );
} }
// 图片缓存 // 图片缓存
// PaintingBinding.instance.imageCache.maximumSizeBytes = 1000 << 20; // PaintingBinding.instance.imageCache.maximumSizeBytes = 1000 << 20;
return GetMaterialApp( return GetMaterialApp(
@@ -229,7 +231,7 @@ class MyApp extends StatelessWidget {
bool isDark = false, bool isDark = false,
required FlexSchemeVariant variant, required FlexSchemeVariant variant,
}) { }) {
return ThemeData( ThemeData themeData = ThemeData(
colorScheme: colorScheme, colorScheme: colorScheme,
useMaterial3: true, useMaterial3: true,
appBarTheme: AppBarTheme( 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( return LayoutBuilder(
builder: (BuildContext context, BoxConstraints constraints) { builder: (BuildContext context, BoxConstraints constraints) {
return Material( return Material(
color: Theme.of(context).colorScheme.surface,
child: Padding( child: Padding(
padding: const EdgeInsets.only(top: 1), padding: const EdgeInsets.only(top: 1),
child: SizedBox( child: SizedBox(

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -38,12 +38,15 @@ Widget searchVideoPanel(context, ctr, LoadingState loadingState) {
// spacing: , // spacing: ,
children: [ children: [
for (var i in controller.filterList) ...[ for (var i in controller.filterList) ...[
CustomFilterChip( SearchText(
label: i['label'], fontSize: 13,
type: i['type'], text: i['label'],
selectedType: controller.selectedType.value, bgColor: Colors.transparent,
callFn: (bool selected) async { textColor:
debugPrint('selected: $selected'); controller.selectedType.value == i['type']
? Theme.of(context).colorScheme.primary
: Theme.of(context).colorScheme.outline,
onTap: (value) async {
controller.selectedType.value = i['type']; controller.selectedType.value = i['type'];
ctr.order.value = ctr.order.value =
i['type'].toString().split('.').last; 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 { class VideoPanelController extends GetxController {
RxList<Map> filterList = [{}].obs; RxList<Map> filterList = [{}].obs;
Rx<ArchiveFilterType> selectedType = ArchiveFilterType.values.first.obs; Rx<ArchiveFilterType> selectedType = ArchiveFilterType.values.first.obs;
@@ -304,7 +262,6 @@ class VideoPanelController extends GetxController {
} }
}); });
}, },
onLongPress: (_) {},
bgColor: currentPubTimeFilterval == -1 && bgColor: currentPubTimeFilterval == -1 &&
(isFirst ? customPubBegin : customPubEnd) (isFirst ? customPubBegin : customPubEnd)
? Theme.of(context).colorScheme.secondaryContainer ? Theme.of(context).colorScheme.secondaryContainer
@@ -380,7 +337,6 @@ class VideoPanelController extends GetxController {
await ctr.onRefresh(); await ctr.onRefresh();
SmartDialog.dismiss(); SmartDialog.dismiss();
}, },
onLongPress: (_) {},
bgColor: item['value'] == currentPubTimeFilterval bgColor: item['value'] == currentPubTimeFilterval
? Theme.of(context) ? Theme.of(context)
.colorScheme .colorScheme
@@ -431,7 +387,6 @@ class VideoPanelController extends GetxController {
await ctr.onRefresh(); await ctr.onRefresh();
SmartDialog.dismiss(); SmartDialog.dismiss();
}, },
onLongPress: (_) {},
bgColor: item['value'] == currentTimeFilterval bgColor: item['value'] == currentTimeFilterval
? Theme.of(context) ? Theme.of(context)
.colorScheme .colorScheme
@@ -469,7 +424,6 @@ class VideoPanelController extends GetxController {
await ctr.onRefresh(); await ctr.onRefresh();
SmartDialog.dismiss(); SmartDialog.dismiss();
}, },
onLongPress: (_) {},
bgColor: item['value'] == currentZoneFilterval bgColor: item['value'] == currentZoneFilterval
? Theme.of(context) ? Theme.of(context)
.colorScheme .colorScheme

View File

@@ -480,6 +480,18 @@ List<SettingsModel> get styleSettings => [
title: '主题模式', title: '主题模式',
getSubtitle: () => '当前模式:${GStorage.themeType.description}', 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( SettingsModel(
settingsType: SettingsType.normal, settingsType: SettingsType.normal,
onTap: (setState) => Get.toNamed('/colorSetting'), onTap: (setState) => Get.toNamed('/colorSetting'),

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1280,75 +1280,72 @@ class _VideoDetailPageState extends State<VideoDetailPage>
), ),
), ),
), ),
child: Material( child: Row(
child: Row( children: [
children: [ if (tabs.isEmpty)
if (tabs.isEmpty) const Spacer()
const Spacer() else
else
Flexible(
flex: tabs.length == 3 ? 2 : 1,
child: showReply ? Obx(() => tabbar()) : tabbar(),
),
Flexible( Flexible(
flex: 1, flex: tabs.length == 3 ? 2 : 1,
child: Center( child: showReply ? Obx(() => tabbar()) : tabbar(),
child: Row( ),
mainAxisAlignment: MainAxisAlignment.end, Flexible(
children: [ flex: 1,
SizedBox( child: Center(
height: 32, child: Row(
child: TextButton( mainAxisAlignment: MainAxisAlignment.end,
style: ButtonStyle( children: [
padding: WidgetStateProperty.all(EdgeInsets.zero), SizedBox(
), height: 32,
onPressed: videoDetailController.showShootDanmakuSheet, child: TextButton(
child: Text( style: ButtonStyle(
'发弹幕', padding: WidgetStateProperty.all(EdgeInsets.zero),
style: TextStyle( ),
fontSize: 12, onPressed: videoDetailController.showShootDanmakuSheet,
color: child: Text(
Theme.of(context).colorScheme.onSurfaceVariant, '发弹幕',
), style: TextStyle(
fontSize: 12,
color: Theme.of(context).colorScheme.onSurfaceVariant,
), ),
), ),
), ),
SizedBox( ),
width: 38, SizedBox(
height: 38, width: 38,
child: Obx( height: 38,
() => IconButton( child: Obx(
onPressed: () { () => IconButton(
videoDetailController onPressed: () {
.plPlayerController.isOpenDanmu.value = videoDetailController
!videoDetailController .plPlayerController.isOpenDanmu.value =
.plPlayerController.isOpenDanmu.value; !videoDetailController
setting.put( .plPlayerController.isOpenDanmu.value;
SettingBoxKey.enableShowDanmaku, setting.put(
videoDetailController SettingBoxKey.enableShowDanmaku,
.plPlayerController.isOpenDanmu.value); videoDetailController
}, .plPlayerController.isOpenDanmu.value);
icon: SvgPicture.asset( },
videoDetailController icon: SvgPicture.asset(
.plPlayerController.isOpenDanmu.value videoDetailController
? 'assets/images/video/danmu_open.svg' .plPlayerController.isOpenDanmu.value
: 'assets/images/video/danmu_close.svg', ? 'assets/images/video/danmu_open.svg'
// ignore: deprecated_member_use : 'assets/images/video/danmu_close.svg',
color: videoDetailController // ignore: deprecated_member_use
.plPlayerController.isOpenDanmu.value color: videoDetailController
? Theme.of(context).colorScheme.secondary .plPlayerController.isOpenDanmu.value
: Theme.of(context).colorScheme.outline, ? 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, height: 1,
indent: 12, indent: 12,
endIndent: 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; 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 => static bool get coinWithLike =>
GStorage.setting.get(SettingBoxKey.coinWithLike, defaultValue: false); 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 static List<double> get dynamicDetailRatio => List<double>.from(setting
.get(SettingBoxKey.dynamicDetailRatio, defaultValue: [60.0, 40.0])); .get(SettingBoxKey.dynamicDetailRatio, defaultValue: [60.0, 40.0]));
@@ -599,6 +602,7 @@ class SettingBoxKey {
showDmChart = 'showDmChart', showDmChart = 'showDmChart',
enableCommAntifraud = 'enableCommAntifraud', enableCommAntifraud = 'enableCommAntifraud',
coinWithLike = 'coinWithLike', coinWithLike = 'coinWithLike',
isPureBlackTheme = 'isPureBlackTheme',
// Sponsor Block // Sponsor Block
enableSponsorBlock = 'enableSponsorBlock', enableSponsorBlock = 'enableSponsorBlock',

View File

@@ -44,6 +44,56 @@ class Utils {
static const channel = MethodChannel("PiliPlus"); 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({ static void onCopyOrMove({
required BuildContext context, required BuildContext context,
required bool isCopy, required bool isCopy,