This commit is contained in:
guozhigq
2024-10-06 21:11:00 +08:00
parent c08c3f4c7c
commit 676b2f18eb

View File

@ -44,6 +44,8 @@ class _MinePageState extends State<MinePage>
super.build(context); super.build(context);
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
scrolledUnderElevation: 0,
elevation: 0,
actions: [ actions: [
IconButton( IconButton(
icon: const Icon(Icons.search_outlined), icon: const Icon(Icons.search_outlined),
@ -64,59 +66,71 @@ class _MinePageState extends State<MinePage>
const SizedBox(width: 22), const SizedBox(width: 22),
], ],
), ),
body: SingleChildScrollView( body: RefreshIndicator(
child: Column( onRefresh: () async {
children: [ await ctr.queryUserInfo();
Obx(() => _buildProfileSection(context, ctr.userInfo.value)), },
const SizedBox(height: 10), child: SingleChildScrollView(
FutureBuilder( physics: const AlwaysScrollableScrollPhysics(
future: _futureBuilderFuture, parent: BouncingScrollPhysics()),
builder: (context, snapshot) { child: Padding(
if (snapshot.connectionState == ConnectionState.done) { padding: const EdgeInsets.only(bottom: 110),
if (snapshot.data == null) { child: Expanded(
return const SizedBox(); child: Column(
} children: [
if (snapshot.data['status']) { Obx(() => _buildProfileSection(context, ctr.userInfo.value)),
return Obx( const SizedBox(height: 10),
() => _buildStatsSection( FutureBuilder(
context, future: _futureBuilderFuture,
ctr.userStat.value, builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
if (snapshot.data == null) {
return const SizedBox();
}
if (snapshot.data['status']) {
return Obx(
() => _buildStatsSection(
context,
ctr.userStat.value,
),
);
} else {
return _buildStatsSection(
context,
ctr.userStat.value,
);
}
} else {
return _buildStatsSection(
context,
ctr.userStat.value,
);
}
},
),
_buildMenuSection(context),
Obx(
() => Visibility(
visible: ctr.userLogin.value,
child: Divider(
height: 25,
color: Theme.of(context).dividerColor.withOpacity(0.1),
), ),
); ),
} else { ),
return _buildStatsSection( Obx(
context, () => ctr.userLogin.value
ctr.userStat.value, ? _buildFavoritesSection(context)
); : const SizedBox(),
} ),
} else { SizedBox(
return _buildStatsSection( height: MediaQuery.of(context).padding.bottom +
context, kBottomNavigationBarHeight,
ctr.userStat.value, )
); ],
}
},
),
_buildMenuSection(context),
Obx(
() => Visibility(
visible: ctr.userLogin.value,
child: Divider(
height: 25,
color: Theme.of(context).dividerColor.withOpacity(0.1),
),
), ),
), ),
Obx( ),
() => ctr.userLogin.value
? _buildFavoritesSection(context)
: const SizedBox(),
),
SizedBox(
height: MediaQuery.of(context).padding.bottom +
kBottomNavigationBarHeight,
)
],
), ),
), ),
); );
@ -326,7 +340,7 @@ class _MinePageState extends State<MinePage>
const SizedBox(height: 4), const SizedBox(height: 4),
SizedBox( SizedBox(
width: double.infinity, width: double.infinity,
height: MediaQuery.textScalerOf(context).scale(110), height: MediaQuery.textScalerOf(context).scale(180),
child: FutureBuilder( child: FutureBuilder(
future: ctr.queryFavFolder(), future: ctr.queryFavFolder(),
builder: (context, snapshot) { builder: (context, snapshot) {
@ -459,71 +473,41 @@ class FavFolderItem extends StatelessWidget {
String heroTag = Utils.makeHeroTag(item!.fid); String heroTag = Utils.makeHeroTag(item!.fid);
return Container( return Container(
margin: EdgeInsets.only(left: index == 0 ? 20 : 0, right: 14), margin: EdgeInsets.only(left: index == 0 ? 20 : 0, right: 14),
child: InkWell( child: Column(
onTap: () => Get.toNamed('/favDetail', arguments: item, parameters: { mainAxisAlignment: MainAxisAlignment.start,
'mediaId': item!.id.toString(), crossAxisAlignment: CrossAxisAlignment.start,
'heroTag': heroTag, children: [
'isOwner': '1', InkWell(
}), onTap: () =>
borderRadius: StyleString.mdRadius, Get.toNamed('/favDetail', arguments: item, parameters: {
child: Stack( 'mediaId': item!.id.toString(),
children: [ 'heroTag': heroTag,
NetworkImgLayer( 'isOwner': '1',
src: item!.cover, }),
width: 175, borderRadius: StyleString.mdRadius,
height: 110, child: Hero(
), tag: heroTag,
// 渐变 child: NetworkImgLayer(
Positioned( src: item!.cover,
left: 0, width: 180,
right: 0, height: 110,
top: 60,
bottom: 0,
child: Container(
padding: const EdgeInsets.only(bottom: 8, left: 10, right: 2),
decoration: BoxDecoration(
borderRadius: StyleString.mdRadius,
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
Colors.black.withOpacity(0),
Colors.black.withOpacity(0.6),
],
),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.end,
children: [
RichText(
maxLines: 1,
overflow: TextOverflow.ellipsis,
text: TextSpan(
style: Theme.of(context)
.textTheme
.titleSmall!
.copyWith(color: Colors.white),
children: [
TextSpan(text: item!.title!),
const TextSpan(text: ' '),
if (item!.mediaCount! > 0)
TextSpan(
text: item!.mediaCount!.toString(),
style: const TextStyle(
fontSize: 11,
fontWeight: FontWeight.bold,
),
),
],
),
),
],
),
), ),
), ),
], ),
), const SizedBox(height: 8),
Text(
' ${item!.title}',
overflow: TextOverflow.fade,
maxLines: 1,
),
Text(
'${item!.mediaCount}条视频',
style: Theme.of(context)
.textTheme
.labelSmall!
.copyWith(color: Theme.of(context).colorScheme.outline),
)
],
), ),
); );
} }