feat: user screen repos title
This commit is contained in:
parent
70b83e3bcf
commit
3354ac4e6b
|
@ -69,11 +69,14 @@ class UserScreen extends StatelessWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
Iterable<Widget> _buildRepos(payload) {
|
Iterable<Widget> _buildRepos(payload) {
|
||||||
|
String title;
|
||||||
List items;
|
List items;
|
||||||
|
|
||||||
if ((payload['pinnedItems']['nodes'] as List).isNotEmpty) {
|
if ((payload['pinnedItems']['nodes'] as List).isNotEmpty) {
|
||||||
|
title = 'pinned repositories';
|
||||||
items = payload['pinnedItems']['nodes'] as List;
|
items = payload['pinnedItems']['nodes'] as List;
|
||||||
} else if ((payload['repositories']['nodes'] as List).isNotEmpty) {
|
} else if ((payload['repositories']['nodes'] as List).isNotEmpty) {
|
||||||
|
title = 'popular repositories';
|
||||||
items = payload['repositories']['nodes'] as List;
|
items = payload['repositories']['nodes'] as List;
|
||||||
} else {
|
} else {
|
||||||
items = [];
|
items = [];
|
||||||
|
@ -86,7 +89,7 @@ class UserScreen extends StatelessWidget {
|
||||||
|
|
||||||
return [
|
return [
|
||||||
borderView1,
|
borderView1,
|
||||||
// Text('Pinned repositories'),
|
if (title != null) TableViewHeader(title),
|
||||||
...join(
|
...join(
|
||||||
borderView,
|
borderView,
|
||||||
items.map((item) {
|
items.map((item) {
|
||||||
|
|
|
@ -4,6 +4,24 @@ import 'package:git_touch/utils/utils.dart';
|
||||||
import 'package:primer/primer.dart';
|
import 'package:primer/primer.dart';
|
||||||
import 'link.dart';
|
import 'link.dart';
|
||||||
|
|
||||||
|
class TableViewHeader extends StatelessWidget {
|
||||||
|
final String title;
|
||||||
|
|
||||||
|
TableViewHeader(this.title);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
color: PrimerColors.gray100,
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
||||||
|
child: Text(
|
||||||
|
title.toUpperCase(),
|
||||||
|
style: TextStyle(color: PrimerColors.gray600, fontSize: 13),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class TableViewItem {
|
class TableViewItem {
|
||||||
final Widget text;
|
final Widget text;
|
||||||
final IconData leftIconData;
|
final IconData leftIconData;
|
||||||
|
@ -95,15 +113,7 @@ class TableView extends StatelessWidget {
|
||||||
return Column(
|
return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
if (headerText != null)
|
if (headerText != null) TableViewHeader(headerText),
|
||||||
Container(
|
|
||||||
color: PrimerColors.gray100,
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
|
||||||
child: Text(
|
|
||||||
headerText,
|
|
||||||
style: TextStyle(color: PrimerColors.gray600, fontSize: 13),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
borderView,
|
borderView,
|
||||||
...join(BorderView(leftPadding: _leftPadding),
|
...join(BorderView(leftPadding: _leftPadding),
|
||||||
items.map(_buildItem).toList()),
|
items.map(_buildItem).toList()),
|
||||||
|
|
Loading…
Reference in New Issue