Skip to content

Commit

Permalink
feat: add status for github and gitlab
Browse files Browse the repository at this point in the history
  • Loading branch information
pd4d10 committed Oct 6, 2020
1 parent e3a4b2c commit 2b68d95
Showing 1 changed file with 27 additions and 15 deletions.
42 changes: 27 additions & 15 deletions lib/screens/settings.dart
Expand Up @@ -13,12 +13,7 @@ import 'package:package_info/package_info.dart';
import 'package:provider/provider.dart';
import 'package:tuple/tuple.dart';

class SettingsScreen extends StatefulWidget {
@override
_SettingsScreenState createState() => _SettingsScreenState();
}

class _SettingsScreenState extends State<SettingsScreen> {
class SettingsScreen extends StatelessWidget {
Widget _buildRightWidget(BuildContext context, bool checked) {
final theme = Provider.of<ThemeModel>(context);
if (!checked) return null;
Expand All @@ -35,31 +30,48 @@ class _SettingsScreenState extends State<SettingsScreen> {
body: Column(
children: <Widget>[
CommonStyle.verticalGap,
TableView(headerText: 'accounts', items: [
TableViewItem(
text: Text('Switch Accounts'),
url: '/login',
rightWidget: Text(auth.activeAccount.login),
),
if (auth.activeAccount.platform == PlatformType.github)
TableView(headerText: 'system', items: [
if (auth.activeAccount.platform == PlatformType.github) ...[
TableViewItem(
text: Text('GitHub status'),
url: 'https://www.githubstatus.com/',
),
TableViewItem(
text: Text('Review Permissions'),
url:
'https://github.com/settings/connections/applications/$clientId',
rightWidget: Text(auth.activeAccount.login),
),
],
if (auth.activeAccount.platform == PlatformType.gitlab)
TableViewItem(
text: Text('GitLab status'),
url: '${auth.activeAccount.domain}/help',
rightWidget: FutureBuilder<String>(
future:
auth.fetchGitlab('/version').then((v) => v['version']),
builder: (context, snapshot) {
return Text(snapshot.data ?? '');
},
),
),
if (auth.activeAccount.platform == PlatformType.gitea)
TableViewItem(
leftIconData: Octicons.info,
text: Text('Gitea'),
text: Text('Gitea status'),
url: '/gitea/status',
rightWidget: FutureBuilder<String>(
future: auth.fetchGitea('/version').then((v) => v['version']),
builder: (context, snapshot) {
return Text(snapshot.data ?? '');
},
),
)
),
TableViewItem(
text: Text('Switch accounts'),
url: '/login',
rightWidget: Text(auth.activeAccount.login),
),
]),
CommonStyle.verticalGap,
TableView(headerText: 'theme', items: [
Expand Down

0 comments on commit 2b68d95

Please sign in to comment.