🐛 Optimize and fix profile page loading issue

This commit is contained in:
LittleSheep 2025-02-27 22:11:53 +08:00
parent 8e76ff3f84
commit b1af6c2c97
3 changed files with 33 additions and 13 deletions

View File

@ -0,0 +1,18 @@
meta {
name: Deal Abuse Report
type: http
seq: 3
}
put {
url: {{endpoint}}/cgi/id/reports/abuse/3/status
body: json
auth: inherit
}
body:json {
{
"status": "processed",
"message": "相关附件已经进行评级处理,未来会将该项权限下放到帖主以及社区成员。"
}
}

View File

@ -65,14 +65,18 @@ class _UserScreenState extends State<UserScreen>
}
}
Future<List<SnCheckInRecord>> _getCheckInRecords() async {
List<SnCheckInRecord>? _records;
Future<void> _getCheckInRecords() async {
try {
final sn = context.read<SnNetworkProvider>();
final resp =
await sn.client.get('/cgi/id/users/${widget.name}/check-in?take=14');
return List.from(
resp.data['data']?.map((x) => SnCheckInRecord.fromJson(x)) ?? [],
);
setState(() {
_records = List.from(
resp.data['data']?.map((x) => SnCheckInRecord.fromJson(x)) ?? [],
);
});
} catch (err) {
if (mounted) context.showErrorDialog(err);
rethrow;
@ -213,6 +217,7 @@ class _UserScreenState extends State<UserScreen>
_fetchStatus();
_fetchPublishers();
_getCheckInRecords();
try {
final rel = context.read<SnRelationshipProvider>();
@ -542,12 +547,10 @@ class _UserScreenState extends State<UserScreen>
SliverToBoxAdapter(child: const Divider()),
const SliverGap(12),
SliverToBoxAdapter(
child: FutureBuilder<List<SnCheckInRecord>>(
key: GlobalKey(),
future: _getCheckInRecords(),
builder: (context, snapshot) {
if (!snapshot.hasData) return const SizedBox.shrink();
if (snapshot.data!.length <= 1) {
child: Builder(
builder: (context) {
if (_records == null) return const SizedBox.shrink();
if (_records!.length <= 1) {
return Text(
'accountCheckInNoRecords',
textAlign: TextAlign.center,
@ -557,11 +560,10 @@ class _UserScreenState extends State<UserScreen>
.center()
.padding(horizontal: 20, vertical: 8);
}
final records = snapshot.data!;
return SizedBox(
width: double.infinity,
height: 240,
child: CheckInRecordChart(records: records),
child: CheckInRecordChart(records: _records!),
).padding(
right: 24,
left: 16,

View File

@ -45,7 +45,7 @@ Future<ThemeData> createAppTheme(
useMaterial3: useM3,
colorScheme: colorScheme,
brightness: brightness,
textTheme: GoogleFonts.rubikTextTheme(),
// textTheme: GoogleFonts.rubikTextTheme(),
iconTheme: IconThemeData(
fill: 0,
weight: 400,