feat: 自定义列数
This commit is contained in:
@ -287,23 +287,18 @@ class VideoStat extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
children: [
|
||||
Text(
|
||||
'${videoItem.stat.view}观看',
|
||||
style: TextStyle(
|
||||
fontSize: Theme.of(context).textTheme.labelSmall!.fontSize,
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
),
|
||||
return RichText(
|
||||
maxLines: 1,
|
||||
text: TextSpan(
|
||||
style: TextStyle(
|
||||
fontSize: Theme.of(context).textTheme.labelSmall!.fontSize,
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
),
|
||||
Text(
|
||||
' • ${videoItem.stat.danmu}弹幕',
|
||||
style: TextStyle(
|
||||
fontSize: Theme.of(context).textTheme.labelSmall!.fontSize,
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
),
|
||||
),
|
||||
],
|
||||
children: [
|
||||
TextSpan(text: '${videoItem.stat.view}观看'),
|
||||
TextSpan(text: ' • ${videoItem.stat.danmu}弹幕'),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ class LiveController extends GetxController {
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
crossAxisCount.value =
|
||||
setting.get(SettingBoxKey.enableSingleRow, defaultValue: false) ? 1 : 2;
|
||||
setting.get(SettingBoxKey.customRows, defaultValue: 2);
|
||||
}
|
||||
|
||||
// 获取推荐
|
||||
|
@ -120,15 +120,18 @@ class LiveContent extends StatelessWidget {
|
||||
if (crossAxisCount == 1) const SizedBox(height: 4),
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
liveItem.uname,
|
||||
textAlign: TextAlign.start,
|
||||
style: TextStyle(
|
||||
fontSize: Theme.of(context).textTheme.labelMedium!.fontSize,
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
Expanded(
|
||||
child: Text(
|
||||
liveItem.uname,
|
||||
textAlign: TextAlign.start,
|
||||
style: TextStyle(
|
||||
fontSize:
|
||||
Theme.of(context).textTheme.labelMedium!.fontSize,
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
if (crossAxisCount == 1) ...[
|
||||
Text(
|
||||
@ -169,7 +172,7 @@ class VideoStat extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
height: 50,
|
||||
padding: const EdgeInsets.only(top: 22, left: 10, right: 10),
|
||||
padding: const EdgeInsets.only(top: 26, left: 10, right: 10),
|
||||
decoration: const BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
@ -181,18 +184,17 @@ class VideoStat extends StatelessWidget {
|
||||
tileMode: TileMode.mirror,
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
liveItem!.areaName!,
|
||||
style: const TextStyle(fontSize: 11, color: Colors.white),
|
||||
),
|
||||
Text(
|
||||
liveItem!.watchedShow!['text_small'],
|
||||
style: const TextStyle(fontSize: 11, color: Colors.white),
|
||||
),
|
||||
],
|
||||
child: RichText(
|
||||
maxLines: 1,
|
||||
textAlign: TextAlign.justify,
|
||||
softWrap: false,
|
||||
text: TextSpan(
|
||||
style: const TextStyle(fontSize: 11, color: Colors.white),
|
||||
children: [
|
||||
TextSpan(text: liveItem!.areaName!),
|
||||
TextSpan(text: liveItem!.watchedShow!['text_small']),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ class RcmdController extends GetxController {
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
crossAxisCount.value =
|
||||
setting.get(SettingBoxKey.enableSingleRow, defaultValue: false) ? 1 : 2;
|
||||
setting.get(SettingBoxKey.customRows, defaultValue: 2);
|
||||
if (recVideo.get('cacheList') != null &&
|
||||
recVideo.get('cacheList').isNotEmpty) {
|
||||
List<RecVideoItemAppModel> list = [];
|
||||
|
@ -22,12 +22,14 @@ class _StyleSettingState extends State<StyleSetting> {
|
||||
Box setting = GStrorage.setting;
|
||||
late int picQuality;
|
||||
late ThemeType _tempThemeValue;
|
||||
late dynamic defaultCustomRows;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
picQuality = setting.get(SettingBoxKey.defaultPicQa, defaultValue: 10);
|
||||
_tempThemeValue = settingController.themeType.value;
|
||||
defaultCustomRows = setting.get(SettingBoxKey.customRows, defaultValue: 2);
|
||||
}
|
||||
|
||||
@override
|
||||
@ -76,12 +78,37 @@ class _StyleSettingState extends State<StyleSetting> {
|
||||
setKey: SettingBoxKey.iosTransition,
|
||||
defaultVal: false,
|
||||
),
|
||||
SetSwitchItem(
|
||||
title: '首页单列',
|
||||
subTitle: '每行展示一个内容卡片',
|
||||
setKey: SettingBoxKey.enableSingleRow,
|
||||
defaultVal: false,
|
||||
callFn: (val) => {SmartDialog.showToast('下次启动时生效')},
|
||||
// SetSwitchItem(
|
||||
// title: '首页单列',
|
||||
// subTitle: '每行展示一个内容卡片',
|
||||
// setKey: SettingBoxKey.enableSingleRow,
|
||||
// defaultVal: false,
|
||||
// callFn: (val) => {SmartDialog.showToast('下次启动时生效')},
|
||||
// ),
|
||||
ListTile(
|
||||
dense: false,
|
||||
title: Text('自定义列数', style: titleStyle),
|
||||
subtitle: Text(
|
||||
'当前列数',
|
||||
style: subTitleStyle,
|
||||
),
|
||||
trailing: PopupMenuButton(
|
||||
initialValue: defaultCustomRows,
|
||||
icon: const Icon(Icons.more_vert_outlined, size: 22),
|
||||
onSelected: (item) {
|
||||
defaultCustomRows = item;
|
||||
setting.put(SettingBoxKey.customRows, item);
|
||||
setState(() {});
|
||||
},
|
||||
itemBuilder: (BuildContext context) => <PopupMenuEntry>[
|
||||
for (var i in [1, 2, 3, 4, 5]) ...[
|
||||
PopupMenuItem(
|
||||
value: i,
|
||||
child: Text(i.toString()),
|
||||
),
|
||||
]
|
||||
],
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
dense: false,
|
||||
|
@ -132,6 +132,7 @@ class SettingBoxKey {
|
||||
static const String customColor = 'customColor'; // 自定义主题色
|
||||
static const String iosTransition = 'iosTransition'; // ios路由
|
||||
static const String enableSingleRow = 'enableSingleRow'; // 首页单列
|
||||
static const String customRows = 'customRows'; // 自定义列
|
||||
}
|
||||
|
||||
class LocalCacheKey {
|
||||
|
Reference in New Issue
Block a user