mirror of
https://github.com/git-touch/git-touch
synced 2025-01-31 08:04:51 +01:00
feat: border left padding
This commit is contained in:
parent
eadef899d5
commit
3506609024
@ -24,14 +24,16 @@ class ListStatefulScaffold<T, K> extends StatefulWidget {
|
||||
final Widget Function(T payload) itemBuilder;
|
||||
final Future<ListPayload<T, K>> Function() onRefresh;
|
||||
final Future<ListPayload<T, K>> Function(K cursor) onLoadMore;
|
||||
final Widget borderView;
|
||||
|
||||
ListStatefulScaffold({
|
||||
@required this.title,
|
||||
@required double leftPadding,
|
||||
@required this.itemBuilder,
|
||||
@required this.onRefresh,
|
||||
@required this.onLoadMore,
|
||||
this.trailingBuiler,
|
||||
});
|
||||
}) : borderView = BorderView(leftPadding: leftPadding);
|
||||
|
||||
@override
|
||||
_ListStatefulScaffoldState<T, K> createState() =>
|
||||
@ -142,7 +144,7 @@ class _ListStatefulScaffoldState<T, K>
|
||||
}
|
||||
|
||||
if (index % 2 == 1) {
|
||||
return borderView;
|
||||
return widget.borderView;
|
||||
}
|
||||
|
||||
return widget.itemBuilder(items[index ~/ 2]);
|
||||
|
@ -84,6 +84,7 @@ class CommitsScreen extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return ListStatefulScaffold(
|
||||
title: AppBarTitle('Commits'),
|
||||
leftPadding: 52,
|
||||
onRefresh: () => _query(context),
|
||||
onLoadMore: (cursor) => _query(context, cursor),
|
||||
itemBuilder: (payload) {
|
||||
|
@ -49,6 +49,7 @@ class IssuesScreen extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListStatefulScaffold(
|
||||
leftPadding: 34,
|
||||
title: AppBarTitle(
|
||||
(isPullRequest ? 'Pull requests' : 'Issues') + ' of $owner/$name'),
|
||||
onRefresh: () => _query(context),
|
||||
|
@ -69,6 +69,7 @@ class NewsScreenState extends State<NewsScreen> {
|
||||
Widget build(context) {
|
||||
return ListStatefulScaffold<EventPayload, int>(
|
||||
title: AppBarTitle('News'),
|
||||
leftPadding: 62,
|
||||
itemBuilder: (payload) => EventItem(payload),
|
||||
onRefresh: fetchEvents,
|
||||
onLoadMore: (page) => fetchEvents(page),
|
||||
|
@ -69,6 +69,7 @@ class RepositoriesScreen extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return ListStatefulScaffold(
|
||||
title: AppBarTitle(title),
|
||||
leftPadding: 42,
|
||||
onRefresh: () => _queryRepos(context),
|
||||
onLoadMore: (cursor) => _queryRepos(context, cursor),
|
||||
itemBuilder: (payload) => RepositoryItem(payload),
|
||||
|
@ -68,6 +68,7 @@ class UsersScreen extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return ListStatefulScaffold(
|
||||
title: AppBarTitle(title),
|
||||
leftPadding: 68,
|
||||
onRefresh: () => _queryUsers(context),
|
||||
onLoadMore: (cursor) => _queryUsers(context, cursor),
|
||||
itemBuilder: (payload) => UserItem.fromData(payload),
|
||||
|
@ -130,7 +130,7 @@ class BorderView extends StatelessWidget {
|
||||
|
||||
const BorderView({
|
||||
this.height = 0, // One physical pixel.
|
||||
this.color = PrimerColors.gray500,
|
||||
this.color = PrimerColors.gray400,
|
||||
this.leftPadding = 0,
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user