mirror of
https://github.com/git-touch/git-touch
synced 2024-12-14 01:15:12 +01:00
refactor: use spread operator
This commit is contained in:
parent
cac2c664cc
commit
fdc0872789
@ -101,30 +101,30 @@ class _LoginScreenState extends State<LoginScreen> {
|
||||
|
||||
return Container(
|
||||
child: Column(
|
||||
children: settings.githubAccountMap.entries
|
||||
.map<Widget>((entry) => _buildAccountItem(AccountModel(
|
||||
avatarUrl: entry.value.avatarUrl,
|
||||
token: entry.value.token,
|
||||
platform: PlatformType.github,
|
||||
domain: 'https://github.com',
|
||||
login: entry.key)))
|
||||
.toList()
|
||||
..addAll(accounts.map(_buildAccountItem))
|
||||
..addAll([
|
||||
_buildAddItem(
|
||||
text: 'GitHub Account',
|
||||
onTap: () {
|
||||
var state = settings.generateRandomString();
|
||||
launch(
|
||||
'https://github.com/login/oauth/authorize?client_id=$clientId&redirect_uri=gittouch://login&scope=user%20repo&state=$state',
|
||||
);
|
||||
},
|
||||
),
|
||||
// _buildAddItem(
|
||||
// text: 'GitLab Account',
|
||||
// screenBuilder: (_) => LoginGitlabScreen(),
|
||||
// )
|
||||
]),
|
||||
children: [
|
||||
...settings.githubAccountMap.entries
|
||||
.map<Widget>((entry) => _buildAccountItem(AccountModel(
|
||||
avatarUrl: entry.value.avatarUrl,
|
||||
token: entry.value.token,
|
||||
platform: PlatformType.github,
|
||||
domain: 'https://github.com',
|
||||
login: entry.key)))
|
||||
.toList(),
|
||||
...accounts.map(_buildAccountItem),
|
||||
_buildAddItem(
|
||||
text: 'GitHub Account',
|
||||
onTap: () {
|
||||
var state = settings.generateRandomString();
|
||||
launch(
|
||||
'https://github.com/login/oauth/authorize?client_id=$clientId&redirect_uri=gittouch://login&scope=user%20repo&state=$state',
|
||||
);
|
||||
},
|
||||
),
|
||||
// _buildAddItem(
|
||||
// text: 'GitLab Account',
|
||||
// screenBuilder: (_) => LoginGitlabScreen(),
|
||||
// )
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
|
@ -274,11 +274,12 @@ $key: pullRequest(number: ${item.number}) {
|
||||
bodyBuilder: () {
|
||||
return groupMap.isEmpty
|
||||
? EmptyWidget()
|
||||
: Column(
|
||||
children: [Padding(padding: EdgeInsets.only(top: 10))]..addAll(
|
||||
groupMap.entries
|
||||
.map((entry) => _buildGroupItem(context, entry))
|
||||
.toList()));
|
||||
: Column(children: [
|
||||
Padding(padding: EdgeInsets.only(top: 10)),
|
||||
...groupMap.entries
|
||||
.map((entry) => _buildGroupItem(context, entry))
|
||||
.toList()
|
||||
]);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
@ -134,9 +134,7 @@ class _OrganizationScreenState extends State<OrganizationScreen> {
|
||||
onRefresh: query,
|
||||
title: Text(widget.login),
|
||||
trailingBuilder: (payload) {
|
||||
List<Action> actions = [];
|
||||
|
||||
actions.addAll([
|
||||
return ActionButton(title: 'User Actions', actions: [
|
||||
Action(
|
||||
text: 'Share',
|
||||
onPress: () {
|
||||
@ -150,8 +148,6 @@ class _OrganizationScreenState extends State<OrganizationScreen> {
|
||||
},
|
||||
),
|
||||
]);
|
||||
|
||||
return ActionButton(title: 'User Actions', actions: actions);
|
||||
},
|
||||
bodyBuilder: (payload) {
|
||||
return Column(
|
||||
|
@ -56,12 +56,6 @@ class EventItem extends StatelessWidget {
|
||||
IconData iconData = Octicons.octoface,
|
||||
WidgetBuilder screenBuilder,
|
||||
}) {
|
||||
var _spans = [
|
||||
createLinkSpan(
|
||||
context, event.actorLogin, () => UserScreen(event.actorLogin))
|
||||
];
|
||||
_spans.addAll(spans);
|
||||
|
||||
return Container(
|
||||
padding: EdgeInsets.all(8),
|
||||
child: Column(
|
||||
@ -76,7 +70,14 @@ class EventItem extends StatelessWidget {
|
||||
text: TextSpan(
|
||||
style: TextStyle(
|
||||
color: Colors.black, height: 1.3, fontSize: 15),
|
||||
children: _spans,
|
||||
children: [
|
||||
createLinkSpan(
|
||||
context,
|
||||
event.actorLogin,
|
||||
() => UserScreen(event.actorLogin),
|
||||
),
|
||||
...spans,
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -46,7 +46,7 @@ class TableView extends StatelessWidget {
|
||||
),
|
||||
padding: EdgeInsets.only(top: 4),
|
||||
),
|
||||
]..addAll(items.map((item) {
|
||||
...items.map((item) {
|
||||
List<Widget> children = [
|
||||
Expanded(
|
||||
child: Text(
|
||||
@ -71,7 +71,8 @@ class TableView extends StatelessWidget {
|
||||
child: Row(children: children),
|
||||
),
|
||||
);
|
||||
}).toList()),
|
||||
}).toList()
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ description: A new Flutter project.
|
||||
version: 1.0.0+1
|
||||
|
||||
environment:
|
||||
sdk: ">=2.1.0 <3.0.0"
|
||||
sdk: ">=2.3.0-dev <3.0.0"
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
|
Loading…
Reference in New Issue
Block a user