Skip to content

Commit 65c21d7

Browse files
committed
先修复
1 parent c802fc9 commit 65c21d7

File tree

3 files changed

+89
-90
lines changed

3 files changed

+89
-90
lines changed

lib/pages/home_stack/me_page.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class _MePageState extends State<MePage> with AutomaticKeepAliveClientMixin {
107107
width: 25,
108108
),
109109
title: const Text('投稿大队'),
110-
onTap: () => launch('https://jq.qq.com/?_wv=1027&k=5lfSD1B'),
110+
onTap: () => launch('https://qm.qq.com/cgi-bin/qm/qr?k=z-UI5jwoxEEL3JvEV4ISZbujBXMaskqk&jump_from=webapi'),
111111
),
112112
ListTile(
113113
leading: SvgPicture.asset(

lib/pages/home_stack/time_line_page.dart

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class _TimeLineState extends State<TimeLinePage> {
1717
static const List week = ['周一', '周二', '周三', '周四', '周五', '周六', '周日'];
1818
List<List> data = [[], [], [], [], [], [], []];
1919

20-
Future<Object> getUGC() async {
20+
getUGC() async {
2121
data = [[], [], [], [], [], [], []];
2222
final res = (await getPost('新番', '', 1, 100)).data;
2323
final List _res = jsonDecode(res)['posts'];
@@ -29,7 +29,13 @@ class _TimeLineState extends State<TimeLinePage> {
2929
data[day].add(f);
3030
}
3131

32-
return data;
32+
setState(() {});
33+
}
34+
35+
@override
36+
void initState() {
37+
super.initState();
38+
getUGC();
3339
}
3440

3541
@override

lib/pages/rank_page.dart

Lines changed: 80 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import 'dart:convert';
2-
32
import 'package:clicli_grey/api/post.dart';
43
import 'package:clicli_grey/pages/player_page.dart';
54
import 'package:clicli_grey/utils/reg_utils.dart';
@@ -16,102 +15,96 @@ class RankPage extends StatefulWidget {
1615
class _RankPageState extends State<RankPage> {
1716
List rankList = [];
1817

19-
Future<Object> getRankInfo() async {
18+
getRankInfo() async {
2019
rankList = jsonDecode((await getRank()).data)['posts'];
21-
return rankList;
20+
setState(() {});
2221
}
2322

2423
toPlay(dynamic data) => Navigator.push(
2524
context, MaterialPageRoute(builder: (_) => PlayerPage(data: data)));
2625

2726
@override
28-
Widget build(BuildContext context) => Scaffold(
29-
body: NestedScrollView(
30-
headerSliverBuilder: (_, __) => [
31-
SliverAppBar(
32-
pinned: true,
33-
floating: true,
34-
expandedHeight: 120,
35-
flexibleSpace: FlexibleSpaceBar(
36-
background: Image.network(
37-
getSuo(rankList.isNotEmpty ? rankList[0]['content'] : ''),
38-
fit: BoxFit.cover,
39-
),
40-
),
41-
title: Text(
42-
'THE HOT TOP 10',
43-
style: Theme.of(context)
44-
.textTheme
45-
.headline6
46-
?.copyWith(color: Colors.white),
47-
),
48-
),
49-
],
50-
body: ListView.builder(
51-
padding: const EdgeInsets.all(10),
52-
itemCount: rankList.length,
53-
itemBuilder: (ctx, i) {
54-
return GestureDetector(
55-
onTap: () => toPlay(rankList[i]),
56-
child: Card(
57-
clipBehavior: Clip.antiAliasWithSaveLayer,
58-
margin: const EdgeInsets.symmetric(vertical: 4),
59-
child: IntrinsicHeight(
60-
child: Row(
61-
children: <Widget>[
62-
Padding(
63-
padding: const EdgeInsets.only(right: 15),
64-
child: ConstrainedBox(
65-
constraints: const BoxConstraints(minHeight: 120),
66-
child: Image(
67-
image:
68-
NetworkImage(getSuo(rankList[i]['content'])),
69-
width: MediaQuery.of(context).size.width / 4,
70-
fit: BoxFit.cover,
71-
),
72-
),
27+
void initState() {
28+
super.initState();
29+
getRankInfo();
30+
}
31+
32+
@override
33+
Widget build(BuildContext context) {
34+
return Scaffold(
35+
backgroundColor: const Color.fromRGBO(240, 240, 245, 1),
36+
appBar: AppBar(
37+
backgroundColor: const Color.fromRGBO(240, 240, 245, 1),
38+
automaticallyImplyLeading: false,
39+
title: const Text('排行榜',
40+
style: TextStyle(
41+
fontSize: 24, color: Color.fromRGBO(148, 107, 230, 1))),
42+
centerTitle: false,
43+
),
44+
body: ListView.builder(
45+
padding: const EdgeInsets.all(10),
46+
itemCount: rankList.length,
47+
itemBuilder: (ctx, i) {
48+
return GestureDetector(
49+
onTap: () => toPlay(rankList[i]),
50+
child: Card(
51+
clipBehavior: Clip.antiAliasWithSaveLayer,
52+
margin: const EdgeInsets.symmetric(vertical: 4),
53+
child: IntrinsicHeight(
54+
child: Row(
55+
children: <Widget>[
56+
Padding(
57+
padding: const EdgeInsets.only(right: 15),
58+
child: ConstrainedBox(
59+
constraints: const BoxConstraints(minHeight: 120),
60+
child: Image(
61+
image: NetworkImage(getSuo(rankList[i]['content'])),
62+
width: MediaQuery.of(context).size.width / 4,
63+
fit: BoxFit.cover,
7364
),
74-
Expanded(
75-
child: Column(
76-
crossAxisAlignment: CrossAxisAlignment.start,
77-
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
78-
children: <Widget>[
79-
Text(
80-
rankList[i]['title'].trimLeft(),
81-
style: Theme.of(context).textTheme.subtitle1!,
82-
maxLines: 1,
83-
overflow: TextOverflow.ellipsis,
84-
),
85-
Text(
86-
rankList[i]['sort'],
87-
style: TextStyle(
88-
color: Theme.of(context).primaryColor),
89-
),
90-
Text(
91-
rankList[i]['tag'].trim(),
92-
maxLines: 1,
93-
overflow: TextOverflow.ellipsis,
94-
style: Theme.of(context).textTheme.caption,
95-
),
96-
],
65+
),
66+
),
67+
Expanded(
68+
child: Column(
69+
crossAxisAlignment: CrossAxisAlignment.start,
70+
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
71+
children: <Widget>[
72+
Text(
73+
rankList[i]['title'].trimLeft(),
74+
style: Theme.of(context).textTheme.subtitle1!,
75+
maxLines: 1,
76+
overflow: TextOverflow.ellipsis,
9777
),
98-
),
99-
MaterialButton(
100-
onPressed: () => toPlay(rankList[i]),
101-
minWidth: 30,
102-
child: SvgPicture.asset(
103-
'assets/play_outline.svg',
104-
color: Theme.of(context).primaryColor,
105-
width: 25,
78+
Text(
79+
rankList[i]['sort'],
80+
style: TextStyle(
81+
color: Theme.of(context).primaryColor),
82+
),
83+
Text(
84+
rankList[i]['tag'].trim(),
85+
maxLines: 1,
86+
overflow: TextOverflow.ellipsis,
87+
style: Theme.of(context).textTheme.caption,
10688
),
107-
)
108-
],
89+
],
90+
),
10991
),
110-
),
92+
MaterialButton(
93+
onPressed: () => toPlay(rankList[i]),
94+
minWidth: 30,
95+
child: SvgPicture.asset(
96+
'assets/play_outline.svg',
97+
color: Theme.of(context).primaryColor,
98+
width: 25,
99+
),
100+
)
101+
],
111102
),
112-
);
113-
},
114-
),
115-
),
116-
);
103+
),
104+
),
105+
);
106+
},
107+
),
108+
);
109+
}
117110
}

0 commit comments

Comments
 (0)