mirror of
https://github.com/git-touch/git-touch
synced 2024-12-16 18:28:51 +01:00
fix: table view style
This commit is contained in:
parent
cce67cccda
commit
9bc5c2b96a
@ -85,6 +85,7 @@ class ObjectScreen extends StatelessWidget {
|
||||
Widget _buildTree(payload) {
|
||||
var entries = payload['entries'] as List;
|
||||
return TableView(
|
||||
hasIcon: true,
|
||||
items: entries.map((item) {
|
||||
return TableViewItem(
|
||||
leftWidget: _buildIcon(item),
|
||||
@ -104,7 +105,8 @@ class ObjectScreen extends StatelessWidget {
|
||||
paths: [...paths, item['name']],
|
||||
type: item['type'],
|
||||
);
|
||||
});
|
||||
},
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
@ -225,7 +225,9 @@ class RepoScreen extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
TableView(items: [
|
||||
TableView(
|
||||
hasIcon: true,
|
||||
items: [
|
||||
TableViewItem(
|
||||
leftIconData: Octicons.code,
|
||||
text: Text('Code'),
|
||||
@ -240,21 +242,24 @@ class RepoScreen extends StatelessWidget {
|
||||
TableViewItem(
|
||||
leftIconData: Octicons.issue_opened,
|
||||
text: Text('Issues'),
|
||||
rightWidget:
|
||||
Text(numberFormat.format(payload['issues']['totalCount'])),
|
||||
rightWidget: Text(
|
||||
numberFormat.format(payload['issues']['totalCount'])),
|
||||
screenBuilder: (_) => IssuesScreen(owner: owner, name: name),
|
||||
),
|
||||
TableViewItem(
|
||||
leftIconData: Octicons.git_pull_request,
|
||||
text: Text('Pull requests'),
|
||||
rightWidget: Text(
|
||||
numberFormat.format(payload['pullRequests']['totalCount'])),
|
||||
screenBuilder: (_) =>
|
||||
IssuesScreen(owner: owner, name: name, isPullRequest: true),
|
||||
rightWidget: Text(numberFormat
|
||||
.format(payload['pullRequests']['totalCount'])),
|
||||
screenBuilder: (_) => IssuesScreen(
|
||||
owner: owner, name: name, isPullRequest: true),
|
||||
),
|
||||
],
|
||||
),
|
||||
]),
|
||||
borderView1,
|
||||
TableView(items: [
|
||||
TableView(
|
||||
hasIcon: true,
|
||||
items: [
|
||||
TableViewItem(
|
||||
leftIconData: Octicons.history,
|
||||
text: Text('Commits'),
|
||||
@ -271,7 +276,8 @@ class RepoScreen extends StatelessWidget {
|
||||
: (payload['licenseInfo']['spdxId'] ??
|
||||
payload['licenseInfo']['name'])),
|
||||
),
|
||||
]),
|
||||
],
|
||||
),
|
||||
borderView1,
|
||||
if (payload['object'] != null)
|
||||
Container(
|
||||
|
@ -14,10 +14,7 @@ import '../screens/login.dart';
|
||||
class SettingsScreen extends StatelessWidget {
|
||||
Widget _buildRightWidget(bool checked) {
|
||||
if (!checked) return null;
|
||||
return Row(children: [
|
||||
Icon(Octicons.check, color: CupertinoColors.activeBlue, size: 24),
|
||||
SizedBox(width: 12)
|
||||
]);
|
||||
return Icon(Octicons.check, color: CupertinoColors.activeBlue, size: 24);
|
||||
}
|
||||
|
||||
@override
|
||||
@ -32,7 +29,6 @@ class SettingsScreen extends StatelessWidget {
|
||||
borderView1,
|
||||
TableView(headerText: 'ACCOUNTS', items: [
|
||||
TableViewItem(
|
||||
leftIconData: Icons.account_circle,
|
||||
text: Text('Switch to another account'),
|
||||
screenBuilder: (_) => LoginScreen(),
|
||||
),
|
||||
@ -40,7 +36,6 @@ class SettingsScreen extends StatelessWidget {
|
||||
borderView1,
|
||||
TableView(headerText: 'THEME', items: [
|
||||
TableViewItem(
|
||||
leftIconData: MaterialCommunityIcons.material_design,
|
||||
text: Text('Material'),
|
||||
rightWidget:
|
||||
_buildRightWidget(themeProvider.theme == ThemeMap.material),
|
||||
@ -52,7 +47,6 @@ class SettingsScreen extends StatelessWidget {
|
||||
hideRightChevron: true,
|
||||
),
|
||||
TableViewItem(
|
||||
leftIconData: MaterialCommunityIcons.apple,
|
||||
text: Text('Cupertino'),
|
||||
rightWidget: _buildRightWidget(
|
||||
themeProvider.theme == ThemeMap.cupertino),
|
||||
@ -67,12 +61,10 @@ class SettingsScreen extends StatelessWidget {
|
||||
borderView1,
|
||||
TableView(headerText: 'ABOUT', items: [
|
||||
TableViewItem(
|
||||
leftIconData: Octicons.code,
|
||||
text: Text('Source code'),
|
||||
text: Text('Source Code'),
|
||||
screenBuilder: (_) => RepoScreen('pd4d10', 'git-touch'),
|
||||
),
|
||||
TableViewItem(
|
||||
leftIconData: Octicons.law,
|
||||
text: Text('License'),
|
||||
rightWidget: Text('MIT'),
|
||||
screenBuilder: (_) => ObjectScreen(
|
||||
@ -84,8 +76,7 @@ class SettingsScreen extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
TableViewItem(
|
||||
leftIconData: Icons.star,
|
||||
text: Text('Rate this App'),
|
||||
text: Text('Rate This App'),
|
||||
onTap: () {
|
||||
LaunchReview.launch(
|
||||
androidAppId: 'io.github.pd4d10.gittouch',
|
||||
|
@ -233,7 +233,9 @@ class UserScreen extends StatelessWidget {
|
||||
borderView1,
|
||||
_buildContributions(contributions),
|
||||
borderView1,
|
||||
TableView(items: [
|
||||
TableView(
|
||||
hasIcon: true,
|
||||
items: [
|
||||
if (isNotNullOrEmpty(payload['company']))
|
||||
TableViewItem(
|
||||
leftIconData: Octicons.organization,
|
||||
@ -269,7 +271,8 @@ class UserScreen extends StatelessWidget {
|
||||
launch(url);
|
||||
},
|
||||
),
|
||||
]),
|
||||
],
|
||||
),
|
||||
..._buildRepos(payload),
|
||||
],
|
||||
);
|
||||
|
@ -155,7 +155,13 @@ class BorderView extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
children: <Widget>[
|
||||
SizedBox(width: leftPadding),
|
||||
SizedBox(
|
||||
width: leftPadding,
|
||||
height: 1,
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(color: PrimerColors.white),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: SizedBox(
|
||||
height: height,
|
||||
|
@ -27,18 +27,23 @@ class TableViewItem {
|
||||
class TableView extends StatelessWidget {
|
||||
final String headerText;
|
||||
final Iterable<TableViewItem> items;
|
||||
final bool hasIcon;
|
||||
|
||||
TableView({this.headerText, @required this.items});
|
||||
double get _leftPadding => hasIcon ? 44 : 12;
|
||||
|
||||
TableView({this.headerText, @required this.items, this.hasIcon = false});
|
||||
|
||||
Widget _buildItem(TableViewItem item) {
|
||||
if (item == null) return null;
|
||||
|
||||
var leftWidget = item.leftWidget ??
|
||||
Icon(
|
||||
var leftWidget = item.leftWidget;
|
||||
if (leftWidget == null && hasIcon) {
|
||||
leftWidget = Icon(
|
||||
item.leftIconData,
|
||||
color: PrimerColors.blue500,
|
||||
size: 18,
|
||||
);
|
||||
}
|
||||
// Container(
|
||||
// width: 24,
|
||||
// height: 24,
|
||||
@ -55,7 +60,7 @@ class TableView extends StatelessWidget {
|
||||
color: PrimerColors.white,
|
||||
child: Row(
|
||||
children: [
|
||||
SizedBox(width: 44, child: leftWidget),
|
||||
SizedBox(width: _leftPadding, child: leftWidget),
|
||||
Expanded(child: item.text),
|
||||
if (item.rightWidget != null) ...[
|
||||
DefaultTextStyle(
|
||||
@ -101,7 +106,8 @@ class TableView extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
borderView,
|
||||
...join(BorderView(leftPadding: 44), items.map(_buildItem).toList()),
|
||||
...join(BorderView(leftPadding: _leftPadding),
|
||||
items.map(_buildItem).toList()),
|
||||
borderView,
|
||||
],
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user