opt pgc review score

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-06-07 23:00:27 +08:00
parent 19e4ae6c04
commit c7dabba3b2
2 changed files with 38 additions and 31 deletions

View File

@@ -42,6 +42,12 @@ class _PgcReviewPostPanelState
super.dispose(); super.dispose();
} }
void _onScore(double dx) {
int index = (dx / 50).toInt().clamp(0, 4);
_enablePost.value = true;
_score.value = index + 1;
}
@override @override
Widget buildPage(ThemeData theme) { Widget buildPage(ThemeData theme) {
final theme = Theme.of(context); final theme = Theme.of(context);
@@ -76,21 +82,21 @@ class _PgcReviewPostPanelState
), ),
), ),
), ),
Padding( Center(
child: Padding(
padding: const EdgeInsets.only(top: 20, bottom: 10), padding: const EdgeInsets.only(top: 20, bottom: 10),
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onHorizontalDragUpdate: (details) =>
_onScore(details.localPosition.dx),
onTapDown: (details) => _onScore(details.localPosition.dx),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisSize: MainAxisSize.min,
children: List.generate( children: List.generate(
5, 5,
(index) { (index) {
return Obx( return Obx(
() => GestureDetector( () => index <= _score.value - 1
onTap: () {
_enablePost.value = true;
_score.value = index + 1;
},
behavior: HitTestBehavior.opaque,
child: index <= _score.value - 1
? const Icon( ? const Icon(
CustomIcon.star_favorite_solid, CustomIcon.star_favorite_solid,
size: 50, size: 50,
@@ -101,12 +107,13 @@ class _PgcReviewPostPanelState
size: 50, size: 50,
color: Colors.grey, color: Colors.grey,
), ),
),
); );
}, },
), ),
), ),
), ),
),
),
SizedBox( SizedBox(
width: double.infinity, width: double.infinity,
child: Obx( child: Obx(

View File

@@ -32,9 +32,9 @@ class SpaceSettingController
if (data != null) { if (data != null) {
var res = await UserHttp.spaceSettingMod( var res = await UserHttp.spaceSettingMod(
{ {
for (var e in data.list1) ...{e.key: e.value}, for (var e in data.list1) e.key: e.value,
for (var e in data.list2) ...{e.key: e.value}, for (var e in data.list2) e.key: e.value,
for (var e in data.list3) ...{e.key: e.value}, for (var e in data.list3) e.key: e.value,
}, },
); );
if (!res['status']) { if (!res['status']) {