fix: long list at material theme
This commit is contained in:
parent
d9bec759e3
commit
ce11da379a
|
@ -146,7 +146,7 @@ class _SettingsProviderState extends State<SettingsProvider> {
|
|||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
var githubData = json.encode(githubAccountMap
|
||||
.map((login, account) => MapEntry(login, account.toJson())));
|
||||
print('write github: $githubData');
|
||||
// print('write github: $githubData');
|
||||
await prefs.setString('github', githubData);
|
||||
|
||||
setState(() {
|
||||
|
@ -160,7 +160,7 @@ class _SettingsProviderState extends State<SettingsProvider> {
|
|||
// read GitHub accounts
|
||||
try {
|
||||
var str = prefs.getString('github');
|
||||
print('read github: $str');
|
||||
// print('read github: $str');
|
||||
Map<String, dynamic> github = json.decode(str);
|
||||
githubAccountMap = github.map<String, Account>((login, _accountMap) =>
|
||||
MapEntry(login, Account.fromJson(_accountMap)));
|
||||
|
@ -221,12 +221,12 @@ class _SettingsProviderState extends State<SettingsProvider> {
|
|||
.timeout(_timeoutDuration);
|
||||
|
||||
final data = json.decode(res.body);
|
||||
print(data);
|
||||
// print(data);
|
||||
|
||||
if (data['errors'] != null) {
|
||||
throw new Exception(data['errors'].toString());
|
||||
}
|
||||
// print(data);
|
||||
|
||||
return data['data'];
|
||||
}
|
||||
|
||||
|
@ -258,9 +258,7 @@ class _SettingsProviderState extends State<SettingsProvider> {
|
|||
.put(prefix + url, headers: headers, body: body ?? {})
|
||||
.timeout(_timeoutDuration);
|
||||
|
||||
print(res.body);
|
||||
// final data = json.decode(res.body);
|
||||
// return data;
|
||||
// print(res.body);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -269,7 +267,7 @@ class _SettingsProviderState extends State<SettingsProvider> {
|
|||
final res = await http
|
||||
.delete(prefix + url, headers: headers)
|
||||
.timeout(_timeoutDuration);
|
||||
print(res.body);
|
||||
// print(res.body);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ class _ListScaffoldState<T, K> extends State<ListScaffold<T, K>> {
|
|||
}
|
||||
|
||||
Future<void> _loadMore() async {
|
||||
print('list scaffold load more');
|
||||
// print('list scaffold load more');
|
||||
setState(() {
|
||||
loadingMore = true;
|
||||
});
|
||||
|
|
|
@ -181,16 +181,6 @@ class _LongListScaffoldState<T, K> extends State<LongListScaffold<T, K>> {
|
|||
}
|
||||
}
|
||||
|
||||
Widget _buildBody() {
|
||||
if (error.isNotEmpty) {
|
||||
return ErrorReload(text: error, reload: _refresh);
|
||||
} else if (loading) {
|
||||
return Loading(more: false);
|
||||
} else {
|
||||
return ListView.builder(itemCount: _itemCount, itemBuilder: _buildItem);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
switch (SettingsProvider.of(context).theme) {
|
||||
|
@ -216,11 +206,14 @@ class _LongListScaffoldState<T, K> extends State<LongListScaffold<T, K>> {
|
|||
),
|
||||
);
|
||||
default:
|
||||
List<Widget> children = [];
|
||||
List<Widget> slivers = [];
|
||||
if (payload != null) {
|
||||
children.add(widget.headerBuilder(payload.header));
|
||||
slivers.add(
|
||||
SliverToBoxAdapter(child: widget.headerBuilder(payload.header)),
|
||||
);
|
||||
}
|
||||
children.add(_buildBody());
|
||||
slivers.add(_buildSliver());
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: widget.title,
|
||||
|
@ -229,7 +222,7 @@ class _LongListScaffoldState<T, K> extends State<LongListScaffold<T, K>> {
|
|||
),
|
||||
body: RefreshIndicator(
|
||||
onRefresh: widget.onRefresh,
|
||||
child: Column(children: children),
|
||||
child: CustomScrollView(slivers: slivers),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ class NotificationScreen extends StatefulWidget {
|
|||
class NotificationScreenState extends State<NotificationScreen> {
|
||||
String error = '';
|
||||
int active = 0;
|
||||
bool loading = true;
|
||||
bool loading = false;
|
||||
Map<String, NotificationGroup> groupMap = {};
|
||||
|
||||
@override
|
||||
|
@ -244,7 +244,7 @@ $key: pullRequest(number: ${item.number}) {
|
|||
// ),
|
||||
actions: <Widget>[
|
||||
IconButton(
|
||||
icon: Icon(Octicons.check),
|
||||
icon: Icon(Icons.done_all),
|
||||
onPressed: _confirm,
|
||||
)
|
||||
],
|
||||
|
|
|
@ -44,13 +44,13 @@ class _UserScreenState extends State<UserScreen> {
|
|||
following {
|
||||
totalCount
|
||||
}
|
||||
repositories(first: 6, ownerAffiliations: OWNER, orderBy: {field: STARGAZERS, direction: DESC}) {
|
||||
repositories(first: $pageSize, ownerAffiliations: OWNER, orderBy: {field: STARGAZERS, direction: DESC}) {
|
||||
totalCount
|
||||
nodes {
|
||||
$repoChunk
|
||||
}
|
||||
}
|
||||
pinnedRepositories(first: 6) {
|
||||
pinnedRepositories(first: $pageSize) {
|
||||
nodes {
|
||||
$repoChunk
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ class Loading extends StatelessWidget {
|
|||
);
|
||||
} else {
|
||||
return Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 100),
|
||||
padding: EdgeInsets.symmetric(vertical: 50),
|
||||
child: _buildIndicator(context),
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue