opt: dynamic up panel

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2024-12-28 21:09:03 +08:00
parent 93560a6fb2
commit d6ed1edc6f
4 changed files with 166 additions and 157 deletions

View File

@@ -317,7 +317,6 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
Expanded(
flex: _ratio[0].toInt(),
child: CustomScrollView(
controller: ScrollController(),
physics: const AlwaysScrollableScrollPhysics(),
slivers: [
SliverPadding(

View File

@@ -123,14 +123,12 @@ class _DynamicsPageState extends State<DynamicsPage>
}
Widget upPanelPart() {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 4),
child: Container(
return Container(
//抽屉模式增加底色
color: upPanelPosition.index > 1
? Theme.of(context).colorScheme.surface
: Colors.transparent,
width: 56,
width: 64,
child: FutureBuilder(
future: _futureBuilderFutureUp,
builder: (context, snapshot) {
@@ -143,8 +141,7 @@ class _DynamicsPageState extends State<DynamicsPage>
return HttpError(
isSliver: false,
callback: () => setState(() {
_futureBuilderFutureUp =
_dynamicsController.queryFollowUp();
_futureBuilderFutureUp = _dynamicsController.queryFollowUp();
}),
);
}
@@ -170,7 +167,7 @@ class _DynamicsPageState extends State<DynamicsPage>
}
},
),
));
);
}
@override

View File

@@ -45,12 +45,11 @@ class _UpPanelState extends State<UpPanel> {
child: SizedBox(
height: 45,
child: TextButton(
style: ButtonStyle(
padding: WidgetStateProperty.all(const EdgeInsets.only()),
style: TextButton.styleFrom(
padding: EdgeInsets.zero,
),
child: Column(
children: [
const Spacer(),
const SizedBox(height: 12),
Text(
'Live(${liveList.length})',
@@ -60,9 +59,10 @@ class _UpPanelState extends State<UpPanel> {
semanticsLabel:
'${_showLiveItems ? '展开' : '收起'}直播中的${liveList.length}个Up',
),
Icon(_showLiveItems ? Icons.expand_less : Icons.expand_more,
size: 12),
const Spacer(),
Icon(
_showLiveItems ? Icons.expand_less : Icons.expand_more,
size: 12,
),
],
),
onPressed: () {
@@ -74,9 +74,7 @@ class _UpPanelState extends State<UpPanel> {
),
),
const SliverToBoxAdapter(
child: SizedBox(
height: 10,
),
child: SizedBox(height: 10),
),
SliverGrid(
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
@@ -99,18 +97,19 @@ class _UpPanelState extends State<UpPanel> {
uname: '',
mid: userInfo?.mid,
),
1),
1,
),
for (int i = 0; i < upList.length; i++) ...[
upItemBuild(upList[i], i + 2)
],
],
)),
),
),
const SliverToBoxAdapter(
child: SizedBox(
height: 200,
child: SizedBox(height: 200),
),
),
]);
],
);
}
Widget upItemBuild(data, i) {
@@ -172,22 +171,11 @@ class _UpPanelState extends State<UpPanel> {
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Badge(
smallSize: 8,
label: data.type == 'live' ? const Text('Live') : null,
textColor: Theme.of(context).colorScheme.onSecondaryContainer,
alignment: data.type == 'live'
? AlignmentDirectional.topCenter
: AlignmentDirectional.topEnd,
padding: const EdgeInsets.only(left: 6, right: 6),
isLabelVisible: data.type == 'live' ||
(data.type == 'up' && (data.hasUpdate ?? false)),
backgroundColor: data.type == 'live'
? Theme.of(context)
.colorScheme
.secondaryContainer
.withOpacity(0.7)
: Theme.of(context).colorScheme.primary,
Stack(
clipBehavior: Clip.none,
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 4),
child: data.face != ''
? NetworkImgLayer(
width: 38,
@@ -202,8 +190,31 @@ class _UpPanelState extends State<UpPanel> {
),
),
),
Positioned(
top: 0,
right: data.type == 'live' ? -6 : 4,
child: Badge(
smallSize: 8,
label: data.type == 'live' ? const Text(' Live ') : null,
textColor:
Theme.of(context).colorScheme.onSecondaryContainer,
alignment: AlignmentDirectional.topStart,
isLabelVisible: data.type == 'live' ||
(data.type == 'up' && (data.hasUpdate ?? false)),
backgroundColor: data.type == 'live'
? Theme.of(context)
.colorScheme
.secondaryContainer
.withOpacity(0.7)
: Theme.of(context).colorScheme.primary,
),
),
],
),
const SizedBox(height: 3),
Text(
Padding(
padding: const EdgeInsets.symmetric(horizontal: 4),
child: Text(
data.uname,
overflow: TextOverflow.clip,
maxLines: 2,
@@ -214,7 +225,9 @@ class _UpPanelState extends State<UpPanel> {
? Theme.of(context).colorScheme.primary
: Theme.of(context).colorScheme.outline,
height: 1.1,
fontSize: 12.5),
fontSize: 12.5,
),
),
),
],
),

View File

@@ -281,7 +281,7 @@ class _HtmlRenderPageState extends State<HtmlRenderPage>
child: CustomScrollView(
controller: orientation == Orientation.portrait
? _htmlRenderCtr.scrollController
: ScrollController(),
: null,
slivers: [
SliverPadding(
padding: orientation == Orientation.portrait
@@ -331,8 +331,8 @@ class _HtmlRenderPageState extends State<HtmlRenderPage>
if (orientation == Orientation.landscape) ...[
VerticalDivider(
thickness: 8,
color:
Theme.of(context).dividerColor.withOpacity(0.05)),
color: Theme.of(context).dividerColor.withOpacity(0.05),
),
Expanded(
flex: _ratio[1].toInt(),
child: Scaffold(