🐛 Optimize and fix profile page loading issue
This commit is contained in:
		
							
								
								
									
										18
									
								
								api/Passport/Deal Abuse Report.bru
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								api/Passport/Deal Abuse Report.bru
									
									
									
									
									
										Normal 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": "相关附件已经进行评级处理,未来会将该项权限下放到帖主以及社区成员。" | ||||||
|  |   } | ||||||
|  | } | ||||||
| @@ -65,14 +65,18 @@ class _UserScreenState extends State<UserScreen> | |||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   Future<List<SnCheckInRecord>> _getCheckInRecords() async { |   List<SnCheckInRecord>? _records; | ||||||
|  |  | ||||||
|  |   Future<void> _getCheckInRecords() async { | ||||||
|     try { |     try { | ||||||
|       final sn = context.read<SnNetworkProvider>(); |       final sn = context.read<SnNetworkProvider>(); | ||||||
|       final resp = |       final resp = | ||||||
|           await sn.client.get('/cgi/id/users/${widget.name}/check-in?take=14'); |           await sn.client.get('/cgi/id/users/${widget.name}/check-in?take=14'); | ||||||
|       return List.from( |       setState(() { | ||||||
|         resp.data['data']?.map((x) => SnCheckInRecord.fromJson(x)) ?? [], |         _records = List.from( | ||||||
|       ); |           resp.data['data']?.map((x) => SnCheckInRecord.fromJson(x)) ?? [], | ||||||
|  |         ); | ||||||
|  |       }); | ||||||
|     } catch (err) { |     } catch (err) { | ||||||
|       if (mounted) context.showErrorDialog(err); |       if (mounted) context.showErrorDialog(err); | ||||||
|       rethrow; |       rethrow; | ||||||
| @@ -213,6 +217,7 @@ class _UserScreenState extends State<UserScreen> | |||||||
|  |  | ||||||
|       _fetchStatus(); |       _fetchStatus(); | ||||||
|       _fetchPublishers(); |       _fetchPublishers(); | ||||||
|  |       _getCheckInRecords(); | ||||||
|  |  | ||||||
|       try { |       try { | ||||||
|         final rel = context.read<SnRelationshipProvider>(); |         final rel = context.read<SnRelationshipProvider>(); | ||||||
| @@ -542,12 +547,10 @@ class _UserScreenState extends State<UserScreen> | |||||||
|           SliverToBoxAdapter(child: const Divider()), |           SliverToBoxAdapter(child: const Divider()), | ||||||
|           const SliverGap(12), |           const SliverGap(12), | ||||||
|           SliverToBoxAdapter( |           SliverToBoxAdapter( | ||||||
|             child: FutureBuilder<List<SnCheckInRecord>>( |             child: Builder( | ||||||
|               key: GlobalKey(), |               builder: (context) { | ||||||
|               future: _getCheckInRecords(), |                 if (_records == null) return const SizedBox.shrink(); | ||||||
|               builder: (context, snapshot) { |                 if (_records!.length <= 1) { | ||||||
|                 if (!snapshot.hasData) return const SizedBox.shrink(); |  | ||||||
|                 if (snapshot.data!.length <= 1) { |  | ||||||
|                   return Text( |                   return Text( | ||||||
|                     'accountCheckInNoRecords', |                     'accountCheckInNoRecords', | ||||||
|                     textAlign: TextAlign.center, |                     textAlign: TextAlign.center, | ||||||
| @@ -557,11 +560,10 @@ class _UserScreenState extends State<UserScreen> | |||||||
|                       .center() |                       .center() | ||||||
|                       .padding(horizontal: 20, vertical: 8); |                       .padding(horizontal: 20, vertical: 8); | ||||||
|                 } |                 } | ||||||
|                 final records = snapshot.data!; |  | ||||||
|                 return SizedBox( |                 return SizedBox( | ||||||
|                   width: double.infinity, |                   width: double.infinity, | ||||||
|                   height: 240, |                   height: 240, | ||||||
|                   child: CheckInRecordChart(records: records), |                   child: CheckInRecordChart(records: _records!), | ||||||
|                 ).padding( |                 ).padding( | ||||||
|                   right: 24, |                   right: 24, | ||||||
|                   left: 16, |                   left: 16, | ||||||
|   | |||||||
| @@ -45,7 +45,7 @@ Future<ThemeData> createAppTheme( | |||||||
|     useMaterial3: useM3, |     useMaterial3: useM3, | ||||||
|     colorScheme: colorScheme, |     colorScheme: colorScheme, | ||||||
|     brightness: brightness, |     brightness: brightness, | ||||||
|     textTheme: GoogleFonts.rubikTextTheme(), |     // textTheme: GoogleFonts.rubikTextTheme(), | ||||||
|     iconTheme: IconThemeData( |     iconTheme: IconThemeData( | ||||||
|       fill: 0, |       fill: 0, | ||||||
|       weight: 400, |       weight: 400, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user