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,47 +51,12 @@ 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: [
BoxShadow(
color: Theme.of(context).dividerColor.withOpacity(0.1),
blurRadius: 10,
spreadRadius: 2,
),
],
color: Theme.of(context).colorScheme.surface,
),
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.only(
top: 5, left: 12, right: 12, bottom: 5),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ 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)),
),
)
],
),
),
Expanded( Expanded(
child: ListView( child: ListView(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
@ -102,8 +67,8 @@ class _UpPanelState extends State<UpPanel> {
upItemBuild(liveList[i], i) upItemBuild(liveList[i], i)
], ],
VerticalDivider( VerticalDivider(
indent: 15, indent: 20,
endIndent: 35, endIndent: 40,
width: 26, width: 26,
color: Theme.of(context).primaryColor.withOpacity(0.5), color: Theme.of(context).primaryColor.withOpacity(0.5),
), ),
@ -113,10 +78,29 @@ class _UpPanelState extends State<UpPanel> {
const SizedBox(width: 10), const SizedBox(width: 10),
], ],
), ),
) ),
Material(
child: InkWell(
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),
),
),
),
),
),
], ],
), )),
),
), ),
); );
} }
@ -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,31 +227,13 @@ class UpPanelSkeleton extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Column( return ListView.builder(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Padding(
padding:
const EdgeInsets.only(top: 5, left: 12, right: 12, bottom: 5),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: const [
Text(
'最常访问',
style: TextStyle(fontWeight: FontWeight.bold),
),
],
),
),
Expanded(
child: ListView.builder(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
physics: const NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),
itemCount: 10, itemCount: 10,
itemBuilder: ((context, index) => Padding( itemBuilder: ((context, index) {
padding: return Padding(
const EdgeInsets.symmetric(horizontal: 10, vertical: 0), padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 0),
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
@ -289,10 +256,8 @@ class UpPanelSkeleton extends StatelessWidget {
), ),
], ],
), ),
)), );
), }),
)
],
); );
} }
} }

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,9 +375,7 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
}, },
child: Row( child: Row(
children: [ children: [
Hero( NetworkImgLayer(
tag: videoItem['owner'].mid + 99,
child: NetworkImgLayer(
type: 'avatar', type: 'avatar',
src: !widget.loadingStatus src: !widget.loadingStatus
? widget.videoDetail!.owner!.face ? widget.videoDetail!.owner!.face
@ -387,7 +385,6 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
fadeInDuration: Duration.zero, fadeInDuration: Duration.zero,
fadeOutDuration: Duration.zero, fadeOutDuration: Duration.zero,
), ),
),
const SizedBox(width: 14), const SizedBox(width: 14),
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,