mirror of
https://github.com/git-touch/git-touch
synced 2025-01-31 08:04:51 +01:00
fix: refresh scaffold, dash graphql syntax error
This commit is contained in:
parent
e16d6c2468
commit
5c4d29c522
@ -8,7 +8,7 @@ import '../widgets/link.dart';
|
||||
import '../utils/utils.dart';
|
||||
|
||||
String getRepoKey(NotificationGroup group) {
|
||||
return '_' + group.owner + '_' + group.name;
|
||||
return ('_' + group.owner + '_' + group.name).replaceAll('-', '__');
|
||||
}
|
||||
|
||||
String getItemKey(NotificationPayload item) {
|
||||
@ -98,7 +98,7 @@ class NotificationScreen extends StatefulWidget {
|
||||
|
||||
class NotificationScreenState extends State<NotificationScreen> {
|
||||
int active = 0;
|
||||
bool loading = false;
|
||||
bool loading;
|
||||
Map<String, NotificationGroup> groupMap = {};
|
||||
|
||||
@override
|
||||
|
@ -63,21 +63,35 @@ class RepoScreen extends StatefulWidget {
|
||||
class _RepoScreenState extends State<RepoScreen> {
|
||||
Map<String, dynamic> payload;
|
||||
String readme;
|
||||
bool loading;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return RefreshScaffold(
|
||||
title: Text(widget.owner + '/' + widget.name),
|
||||
onRefresh: () async {
|
||||
void initState() {
|
||||
super.initState();
|
||||
_refresh();
|
||||
}
|
||||
|
||||
Future<void> _refresh() async {
|
||||
setState(() {
|
||||
loading = true;
|
||||
});
|
||||
List items = await Future.wait([
|
||||
queryRepo(widget.owner, widget.name),
|
||||
fetchReadme(widget.owner, widget.name),
|
||||
]);
|
||||
setState(() {
|
||||
loading = false;
|
||||
payload = items[0];
|
||||
readme = items[1];
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return RefreshScaffold(
|
||||
loading: loading,
|
||||
title: Text(widget.owner + '/' + widget.name),
|
||||
onRefresh: _refresh,
|
||||
bodyBuilder: () {
|
||||
return Column(
|
||||
children: <Widget>[
|
||||
|
@ -75,7 +75,14 @@ class UserScreen extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _UserScreenState extends State<UserScreen> {
|
||||
Map<String, dynamic> payload;
|
||||
bool loading;
|
||||
Map<String, dynamic> payload = {};
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_refresh();
|
||||
}
|
||||
|
||||
Widget _buildRepos() {
|
||||
String title;
|
||||
@ -95,16 +102,25 @@ class _UserScreenState extends State<UserScreen> {
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _refresh() async {
|
||||
setState(() {
|
||||
loading = true;
|
||||
});
|
||||
var _payload = await queryUser(widget.login);
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
loading = false;
|
||||
payload = _payload;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return RefreshScaffold(
|
||||
onRefresh: () async {
|
||||
var _payload = await queryUser(widget.login);
|
||||
setState(() {
|
||||
payload = _payload;
|
||||
});
|
||||
},
|
||||
onRefresh: _refresh,
|
||||
title: Text(widget.login),
|
||||
loading: loading,
|
||||
bodyBuilder: () {
|
||||
return Column(
|
||||
children: <Widget>[
|
||||
|
Loading…
x
Reference in New Issue
Block a user