mirror of
https://github.com/git-touch/git-touch
synced 2024-12-17 02:38:39 +01:00
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) {
|
||||
String title;
|
||||
List items;
|
||||
|
||||
if ((payload['pinnedItems']['nodes'] as List).isNotEmpty) {
|
||||
title = 'pinned repositories';
|
||||
items = payload['pinnedItems']['nodes'] as List;
|
||||
} else if ((payload['repositories']['nodes'] as List).isNotEmpty) {
|
||||
title = 'popular repositories';
|
||||
items = payload['repositories']['nodes'] as List;
|
||||
} else {
|
||||
items = [];
|
||||
@ -86,7 +89,7 @@ class UserScreen extends StatelessWidget {
|
||||
|
||||
return [
|
||||
borderView1,
|
||||
// Text('Pinned repositories'),
|
||||
if (title != null) TableViewHeader(title),
|
||||
...join(
|
||||
borderView,
|
||||
items.map((item) {
|
||||
|
@ -4,6 +4,24 @@ import 'package:git_touch/utils/utils.dart';
|
||||
import 'package:primer/primer.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 {
|
||||
final Widget text;
|
||||
final IconData leftIconData;
|
||||
@ -95,15 +113,7 @@ class TableView extends StatelessWidget {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: <Widget>[
|
||||
if (headerText != null)
|
||||
Container(
|
||||
color: PrimerColors.gray100,
|
||||
padding: EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
||||
child: Text(
|
||||
headerText,
|
||||
style: TextStyle(color: PrimerColors.gray600, fontSize: 13),
|
||||
),
|
||||
),
|
||||
if (headerText != null) TableViewHeader(headerText),
|
||||
borderView,
|
||||
...join(BorderView(leftPadding: _leftPadding),
|
||||
items.map(_buildItem).toList()),
|
||||
|
Loading…
Reference in New Issue
Block a user