mod: 动态样式修改

This commit is contained in:
guozhigq
2023-07-14 23:48:10 +08:00
parent b7083fdc15
commit ff5ba9dafa
4 changed files with 89 additions and 123 deletions

View File

@ -221,7 +221,7 @@ class _DynamicsPageState extends State<DynamicsPage>
} else { } else {
return const SliverToBoxAdapter( return const SliverToBoxAdapter(
child: SizedBox( child: SizedBox(
height: 115, height: 90,
child: UpPanelSkeleton(), child: UpPanelSkeleton(),
)); ));
} }

View File

@ -51,72 +51,56 @@ class _UpPanelState extends State<UpPanel> {
floating: true, floating: true,
pinned: false, pinned: false,
delegate: _SliverHeaderDelegate( delegate: _SliverHeaderDelegate(
height: 115, height: 90,
child: Container( child: Container(
height: 115, height: 90,
decoration: BoxDecoration( color: Theme.of(context).colorScheme.background,
boxShadow: [ child: Row(
BoxShadow( children: [
color: Theme.of(context).dividerColor.withOpacity(0.1), Expanded(
blurRadius: 10, child: ListView(
spreadRadius: 2, scrollDirection: Axis.horizontal,
), controller: scrollController,
], children: [
color: Theme.of(context).colorScheme.surface, const SizedBox(width: 10),
), for (int i = 0; i < liveList.length; i++) ...[
child: Column( upItemBuild(liveList[i], i)
mainAxisSize: MainAxisSize.min, ],
mainAxisAlignment: MainAxisAlignment.start, VerticalDivider(
children: [ indent: 20,
Padding( endIndent: 40,
padding: const EdgeInsets.only( width: 26,
top: 5, left: 12, right: 12, bottom: 5), color: Theme.of(context).primaryColor.withOpacity(0.5),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Text(
'最常访问',
style: TextStyle(fontWeight: FontWeight.bold),
),
SizedBox(
height: 26,
child: TextButton(
style: ButtonStyle(
padding: MaterialStateProperty.all(EdgeInsets.zero),
),
onPressed: () => Get.toNamed('/follow'),
child:
const Text('查看全部', style: TextStyle(fontSize: 12)),
), ),
) for (int i = 0; i < upList.length; i++) ...[
], upItemBuild(upList[i], i)
), ],
), const SizedBox(width: 10),
Expanded(
child: ListView(
scrollDirection: Axis.horizontal,
controller: scrollController,
children: [
const SizedBox(width: 10),
for (int i = 0; i < liveList.length; i++) ...[
upItemBuild(liveList[i], i)
], ],
VerticalDivider( ),
indent: 15, ),
endIndent: 35, Material(
width: 26, child: InkWell(
color: Theme.of(context).primaryColor.withOpacity(0.5), onTap: () => Get.toNamed('/follow'),
child: Container(
height: 100,
padding: const EdgeInsets.only(left: 10, right: 10),
color: Theme.of(context)
.colorScheme
.secondaryContainer
.withOpacity(0.3),
child: Center(
child: Text(
'全部',
style:
TextStyle(color: Theme.of(context).primaryColor),
),
),
), ),
for (int i = 0; i < upList.length; i++) ...[ ),
upItemBuild(upList[i], i)
],
const SizedBox(width: 10),
],
), ),
) ],
], )),
),
),
), ),
); );
} }
@ -141,6 +125,7 @@ class _UpPanelState extends State<UpPanel> {
} else { } else {
moveDistance = (upLen + liveLen) * itemWidth + 46 - screenWidth; moveDistance = (upLen + liveLen) * itemWidth + 46 - screenWidth;
} }
data.hasUpdate = false;
scrollController.animateTo( scrollController.animateTo(
moveDistance, moveDistance,
duration: const Duration(milliseconds: 500), duration: const Duration(milliseconds: 500),
@ -194,7 +179,7 @@ class _UpPanelState extends State<UpPanel> {
width: contentWidth, width: contentWidth,
child: Text( child: Text(
data.uname, data.uname,
overflow: TextOverflow.fade, overflow: TextOverflow.ellipsis,
softWrap: false, softWrap: false,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
@ -242,57 +227,37 @@ class UpPanelSkeleton extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Column( return ListView.builder(
mainAxisSize: MainAxisSize.min, scrollDirection: Axis.horizontal,
mainAxisAlignment: MainAxisAlignment.start, physics: const NeverScrollableScrollPhysics(),
children: [ itemCount: 10,
Padding( itemBuilder: ((context, index) {
padding: return Padding(
const EdgeInsets.only(top: 5, left: 12, right: 12, bottom: 5), padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 0),
child: Row( child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisSize: MainAxisSize.min,
children: const [ mainAxisAlignment: MainAxisAlignment.center,
Text( children: [
'最常访问', Container(
style: TextStyle(fontWeight: FontWeight.bold), width: 49,
height: 49,
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.onInverseSurface,
borderRadius: const BorderRadius.all(
Radius.circular(24),
),
),
),
Container(
margin: const EdgeInsets.only(top: 6),
width: 45,
height: 12,
color: Theme.of(context).colorScheme.onInverseSurface,
), ),
], ],
), ),
), );
Expanded( }),
child: ListView.builder(
scrollDirection: Axis.horizontal,
physics: const NeverScrollableScrollPhysics(),
itemCount: 10,
itemBuilder: ((context, index) => Padding(
padding:
const EdgeInsets.symmetric(horizontal: 10, vertical: 0),
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
width: 49,
height: 49,
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.onInverseSurface,
borderRadius: const BorderRadius.all(
Radius.circular(24),
),
),
),
Container(
margin: const EdgeInsets.only(top: 6),
width: 45,
height: 12,
color: Theme.of(context).colorScheme.onInverseSurface,
),
],
),
)),
),
)
],
); );
} }
} }

View File

@ -170,6 +170,10 @@ class _MemberPageState extends State<MemberPage>
1 1
? '个人认证:' ? '个人认证:'
: '企业认证:', : '企业认证:',
style: TextStyle(
color: Theme.of(context)
.primaryColor,
),
), ),
Text( Text(
_memberController.memberInfo _memberController.memberInfo

View File

@ -375,18 +375,15 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
}, },
child: Row( child: Row(
children: [ children: [
Hero( NetworkImgLayer(
tag: videoItem['owner'].mid + 99, type: 'avatar',
child: NetworkImgLayer( src: !widget.loadingStatus
type: 'avatar', ? widget.videoDetail!.owner!.face
src: !widget.loadingStatus : videoItem['owner'].face,
? widget.videoDetail!.owner!.face width: 38,
: videoItem['owner'].face, height: 38,
width: 38, fadeInDuration: Duration.zero,
height: 38, fadeOutDuration: Duration.zero,
fadeInDuration: Duration.zero,
fadeOutDuration: Duration.zero,
),
), ),
const SizedBox(width: 14), const SizedBox(width: 14),
Column( Column(