Skip to content
代码片段 群组 项目
提交 b5759b13 编辑于 作者: miao's avatar miao 提交者: ling zhang
浏览文件

feat: #23 Replace some real data

上级 522bdf40
No related branches found
No related tags found
无相关合并请求
import 'dart:io';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:jihu_gitlab_app/cn/gitlab/app/modules/users/domain/issue.dart';
class Backlog extends StatefulWidget {
const Backlog({Key? key}) : super(key: key);
......@@ -8,6 +11,13 @@ class Backlog extends StatefulWidget {
}
class _BacklogState extends State<Backlog> {
List<Issue> issues = [];
@override
void initState() {
super.initState();
getIssueData();
}
@override
Widget build(BuildContext context) {
return Scaffold(
......@@ -39,42 +49,42 @@ class _BacklogState extends State<Backlog> {
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Row(
children: const [
Text(
children: [
const Text(
"你 ",
style: TextStyle(
fontSize: 14,
color: Color(0xFF1A1B36),
fontWeight: FontWeight.bold),
),
Text(
const Text(
"已分配 ",
style:
TextStyle(fontSize: 14, color: Color(0xFF5C5963)),
),
Text(
"议题#2",
"议题#${issues[index].iid}",
style:
TextStyle(fontSize: 14, color: Color(0xFF005BE9)),
const TextStyle(fontSize: 14, color: Color(0xFF005BE9)),
),
],
),
Column(
children: const [
children: [
Text.rich(TextSpan(children: [
TextSpan(
text:
"'Feature:Users log in to the system with the JiHu GitLab SaaS account用户使用极狐 GitLab SaaS账户登录系统'at ",
style: TextStyle(
"${issues[index].title}",
style: const TextStyle(
fontSize: 14, color: Color(0xFF5C5963))),
TextSpan(
const TextSpan(
text: "旗舰版演示/极狐 GitLab App产品线/极狐 GitLab",
style: TextStyle(
fontSize: 14, color: Color(0xFF1A1B36))),
TextSpan(
text: "到您自己 ·1个月前",
text: "到您自己 ·${issues[index].createdAt}",
style:
TextStyle(fontSize: 14, color: Color(0xFF5C5963)),
const TextStyle(fontSize: 14, color: Color(0xFF5C5963)),
)
])),
],
......@@ -85,7 +95,17 @@ class _BacklogState extends State<Backlog> {
],
);
},
itemCount: 4,
itemCount: issues.length,
);
}
void getIssueData() async {
var dio = Dio();
Response response = await dio.get('https://jihulab.com/api/v4/issues?scope=assigned_to_me', options: Options(headers: {HttpHeaders.authorizationHeader: 'Bearer 8d7e367bb4abbabd82cd022ac6a153a52a83e37494581d0eee32ff608b524433'}),);
List<dynamic> data = response.data;
List<Issue> issues = data.map((e) => Issue.fromJson(e)).toList();
setState(() {
this.issues = issues;
});
}
}
class Issue {
int? id;
int? iid;
String? title;
String? state;
String? createdAt;
Issue(this.id, this.iid, this.title, this.state, this.createdAt);
factory Issue.fromJson(Map<String, dynamic> json) {
return Issue(json['id'], json['iid'], json['title'], json['state'], json['created_at']);
}
}
\ No newline at end of file
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册