mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
opt: mine page
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -35,17 +35,8 @@ class _MinePageState extends State<MinePage> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
Widget get _header => FittedBox(
|
||||||
Widget build(BuildContext context) {
|
child: Row(
|
||||||
// 宽度以最长的行为准,便于两端对齐
|
|
||||||
return IntrinsicWidth(
|
|
||||||
child: Column(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
// mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
const SizedBox(height: 8),
|
|
||||||
Row(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
@@ -63,7 +54,6 @@ class _MinePageState extends State<MinePage> {
|
|||||||
IconButton(
|
IconButton(
|
||||||
iconSize: 40.0,
|
iconSize: 40.0,
|
||||||
padding: const EdgeInsets.all(8),
|
padding: const EdgeInsets.all(8),
|
||||||
// constraints: const BoxConstraints(),
|
|
||||||
style: const ButtonStyle(
|
style: const ButtonStyle(
|
||||||
tapTargetSize:
|
tapTargetSize:
|
||||||
MaterialTapTargetSize.shrinkWrap, // the '2023' part
|
MaterialTapTargetSize.shrinkWrap, // the '2023' part
|
||||||
@@ -122,7 +112,18 @@ class _MinePageState extends State<MinePage> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
]),
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return IntrinsicWidth(
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
_header,
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
FutureBuilder(
|
FutureBuilder(
|
||||||
future: _futureBuilderFuture,
|
future: _futureBuilderFuture,
|
||||||
@@ -138,7 +139,8 @@ class _MinePageState extends State<MinePage> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
));
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget userInfoBuild(_mineController, context) {
|
Widget userInfoBuild(_mineController, context) {
|
||||||
@@ -146,14 +148,17 @@ class _MinePageState extends State<MinePage> {
|
|||||||
TextStyle style = TextStyle(
|
TextStyle style = TextStyle(
|
||||||
fontSize: Theme.of(context).textTheme.titleMedium!.fontSize,
|
fontSize: Theme.of(context).textTheme.titleMedium!.fontSize,
|
||||||
color: Theme.of(context).colorScheme.primary,
|
color: Theme.of(context).colorScheme.primary,
|
||||||
fontWeight: FontWeight.bold);
|
fontWeight: FontWeight.bold,
|
||||||
return Column(mainAxisSize: MainAxisSize.min, children: [
|
);
|
||||||
|
return Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
Row(
|
Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
const SizedBox(width: 20),
|
const SizedBox(width: 20),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () => _mineController.onLogin(),
|
onTap: _mineController.onLogin,
|
||||||
child: ClipOval(
|
child: ClipOval(
|
||||||
child: Container(
|
child: Container(
|
||||||
width: 70,
|
width: 70,
|
||||||
@@ -165,7 +170,8 @@ class _MinePageState extends State<MinePage> {
|
|||||||
src: _mineController.userInfo.value.face,
|
src: _mineController.userInfo.value.face,
|
||||||
semanticsLabel: '头像',
|
semanticsLabel: '头像',
|
||||||
width: 70,
|
width: 70,
|
||||||
height: 70)
|
height: 70,
|
||||||
|
)
|
||||||
: Image.asset(
|
: Image.asset(
|
||||||
'assets/images/noface.jpeg',
|
'assets/images/noface.jpeg',
|
||||||
semanticLabel: "默认头像",
|
semanticLabel: "默认头像",
|
||||||
@@ -175,13 +181,14 @@ class _MinePageState extends State<MinePage> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 16),
|
const SizedBox(width: 16),
|
||||||
IntrinsicWidth(
|
Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Row(
|
FittedBox(
|
||||||
|
child: Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
@@ -197,69 +204,90 @@ class _MinePageState extends State<MinePage> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
Text.rich(TextSpan(children: [
|
FittedBox(
|
||||||
|
child: Text.rich(
|
||||||
|
TextSpan(
|
||||||
|
children: [
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: '硬币 ',
|
text: '硬币 ',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize:
|
fontSize: Theme.of(context)
|
||||||
Theme.of(context).textTheme.labelSmall!.fontSize,
|
.textTheme
|
||||||
color: Theme.of(context).colorScheme.outline)),
|
.labelSmall!
|
||||||
|
.fontSize,
|
||||||
|
color: Theme.of(context).colorScheme.outline,
|
||||||
|
),
|
||||||
|
),
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: (_mineController.userInfo.value.money ?? '-')
|
text: (_mineController.userInfo.value.money ?? '-')
|
||||||
.toString(),
|
.toString(),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize:
|
fontSize: Theme.of(context)
|
||||||
Theme.of(context).textTheme.labelSmall!.fontSize,
|
.textTheme
|
||||||
|
.labelSmall!
|
||||||
|
.fontSize,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
color: Theme.of(context).colorScheme.primary)),
|
color: Theme.of(context).colorScheme.primary,
|
||||||
|
),
|
||||||
|
),
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: " 经验 ",
|
text: " 经验 ",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize:
|
fontSize: Theme.of(context)
|
||||||
Theme.of(context).textTheme.labelSmall!.fontSize,
|
.textTheme
|
||||||
color: Theme.of(context).colorScheme.outline)),
|
.labelSmall!
|
||||||
|
.fontSize,
|
||||||
|
color: Theme.of(context).colorScheme.outline,
|
||||||
|
),
|
||||||
|
),
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: "${levelInfo?.currentExp ?? '-'}",
|
text: "${levelInfo?.currentExp ?? '-'}",
|
||||||
semanticsLabel: "当前${levelInfo?.currentExp ?? '-'}",
|
semanticsLabel: "当前${levelInfo?.currentExp ?? '-'}",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize:
|
fontSize: Theme.of(context)
|
||||||
Theme.of(context).textTheme.labelSmall!.fontSize,
|
.textTheme
|
||||||
|
.labelSmall!
|
||||||
|
.fontSize,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
color: Theme.of(context).colorScheme.primary)),
|
color: Theme.of(context).colorScheme.primary,
|
||||||
|
),
|
||||||
|
),
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: "/${levelInfo?.nextExp ?? '-'}",
|
text: "/${levelInfo?.nextExp ?? '-'}",
|
||||||
semanticsLabel: "升级需${levelInfo?.nextExp ?? '-'}",
|
semanticsLabel: "升级需${levelInfo?.nextExp ?? '-'}",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize:
|
fontSize: Theme.of(context)
|
||||||
Theme.of(context).textTheme.labelSmall!.fontSize,
|
.textTheme
|
||||||
color: Theme.of(context).colorScheme.outline)),
|
.labelSmall!
|
||||||
])),
|
.fontSize,
|
||||||
// const SizedBox(height: 4),
|
color: Theme.of(context).colorScheme.outline,
|
||||||
// Text.rich(TextSpan(children: [
|
),
|
||||||
// ])),
|
),
|
||||||
// Text.rich(
|
],
|
||||||
// textAlign: TextAlign.right,
|
),
|
||||||
// TextSpan(children: [
|
),
|
||||||
//
|
),
|
||||||
// ])),
|
|
||||||
const SizedBox(height: 4),
|
const SizedBox(height: 4),
|
||||||
LinearProgressIndicator(
|
LinearProgressIndicator(
|
||||||
minHeight: 2,
|
minHeight: 2,
|
||||||
value: levelInfo != null
|
value: levelInfo != null
|
||||||
? (levelInfo.currentExp! / levelInfo.nextExp!)
|
? (levelInfo.currentExp! / levelInfo.nextExp!)
|
||||||
: 0,
|
: 0,
|
||||||
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
|
backgroundColor:
|
||||||
|
Theme.of(context).colorScheme.inversePrimary,
|
||||||
valueColor: AlwaysStoppedAnimation<Color>(
|
valueColor: AlwaysStoppedAnimation<Color>(
|
||||||
Theme.of(context).colorScheme.primary),
|
Theme.of(context).colorScheme.primary),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
)),
|
),
|
||||||
|
),
|
||||||
const SizedBox(width: 20),
|
const SizedBox(width: 20),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
Container(
|
SizedBox(
|
||||||
width: 240,
|
width: 240,
|
||||||
height: 100,
|
height: 100,
|
||||||
child: GridView.count(
|
child: GridView.count(
|
||||||
@@ -268,7 +296,7 @@ class _MinePageState extends State<MinePage> {
|
|||||||
crossAxisCount: 3,
|
crossAxisCount: 3,
|
||||||
children: [
|
children: [
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () => _mineController.pushDynamic(),
|
onTap: _mineController.pushDynamic,
|
||||||
borderRadius: StyleString.mdRadius,
|
borderRadius: StyleString.mdRadius,
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
@@ -285,7 +313,8 @@ class _MinePageState extends State<MinePage> {
|
|||||||
key: ValueKey<String>(_mineController
|
key: ValueKey<String>(_mineController
|
||||||
.userStat.value.dynamicCount
|
.userStat.value.dynamicCount
|
||||||
.toString()),
|
.toString()),
|
||||||
style: style),
|
style: style,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
Text(
|
Text(
|
||||||
@@ -296,7 +325,7 @@ class _MinePageState extends State<MinePage> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () => _mineController.pushFollow(),
|
onTap: _mineController.pushFollow,
|
||||||
borderRadius: StyleString.mdRadius,
|
borderRadius: StyleString.mdRadius,
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
@@ -313,7 +342,8 @@ class _MinePageState extends State<MinePage> {
|
|||||||
key: ValueKey<String>(_mineController
|
key: ValueKey<String>(_mineController
|
||||||
.userStat.value.following
|
.userStat.value.following
|
||||||
.toString()),
|
.toString()),
|
||||||
style: style),
|
style: style,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
Text(
|
Text(
|
||||||
@@ -324,7 +354,7 @@ class _MinePageState extends State<MinePage> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () => _mineController.pushFans(),
|
onTap: _mineController.pushFans,
|
||||||
borderRadius: StyleString.mdRadius,
|
borderRadius: StyleString.mdRadius,
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
@@ -339,10 +369,10 @@ class _MinePageState extends State<MinePage> {
|
|||||||
child: Text(
|
child: Text(
|
||||||
(_mineController.userStat.value.follower ?? '-')
|
(_mineController.userStat.value.follower ?? '-')
|
||||||
.toString(),
|
.toString(),
|
||||||
key: ValueKey<String>(_mineController
|
key: ValueKey<String>(
|
||||||
.userStat.value.follower
|
_mineController.userStat.value.follower.toString()),
|
||||||
.toString()),
|
style: style,
|
||||||
style: style),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
Text(
|
Text(
|
||||||
@@ -353,39 +383,9 @@ class _MinePageState extends State<MinePage> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
)),
|
),
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class ActionItem extends StatelessWidget {
|
|
||||||
final Icon? icon;
|
|
||||||
final Function? onTap;
|
|
||||||
final String? text;
|
|
||||||
|
|
||||||
const ActionItem({
|
|
||||||
super.key,
|
|
||||||
this.icon,
|
|
||||||
this.onTap,
|
|
||||||
this.text,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return InkWell(
|
|
||||||
onTap: () {},
|
|
||||||
borderRadius: StyleString.mdRadius,
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Icon(icon!.icon!),
|
|
||||||
const SizedBox(height: 8),
|
|
||||||
Text(
|
|
||||||
text!,
|
|
||||||
style: Theme.of(context).textTheme.labelMedium,
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user