chore: style tweaks
This commit is contained in:
parent
55f3f6a713
commit
2d28eb7b41
|
@ -47,12 +47,7 @@ class _LoginScreenState extends State<LoginScreen> {
|
||||||
),
|
),
|
||||||
]);
|
]);
|
||||||
},
|
},
|
||||||
child: Container(
|
child: AntListItem(
|
||||||
padding: CommonStyle.padding,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
border: Border(
|
|
||||||
bottom: BorderSide(color: AntTheme.of(context).colorBorder)),
|
|
||||||
),
|
|
||||||
child: Row(
|
child: Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Avatar(url: account.avatarUrl, size: AvatarSize.large),
|
Avatar(url: account.avatarUrl, size: AvatarSize.large),
|
||||||
|
@ -88,12 +83,7 @@ class _LoginScreenState extends State<LoginScreen> {
|
||||||
{IconData? brand, required String text, Function? onTap}) {
|
{IconData? brand, required String text, Function? onTap}) {
|
||||||
return LinkWidget(
|
return LinkWidget(
|
||||||
onTap: onTap,
|
onTap: onTap,
|
||||||
child: Container(
|
child: AntListItem(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 20),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
border: Border(
|
|
||||||
bottom: BorderSide(color: AntTheme.of(context).colorBorder)),
|
|
||||||
),
|
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
@ -138,256 +128,260 @@ class _LoginScreenState extends State<LoginScreen> {
|
||||||
title: AppBarTitle(AppLocalizations.of(context)!.selectAccount),
|
title: AppBarTitle(AppLocalizations.of(context)!.selectAccount),
|
||||||
body: auth.loading
|
body: auth.loading
|
||||||
? const Center(child: Loading())
|
? const Center(child: Loading())
|
||||||
: Container(
|
: Column(
|
||||||
child: Column(
|
children: [
|
||||||
children: [
|
AntList(
|
||||||
...List.generate(auth.accounts!.length, _buildAccountItem),
|
children: [
|
||||||
_buildAddItem(
|
...List.generate(auth.accounts!.length, _buildAccountItem),
|
||||||
text: AppLocalizations.of(context)!.githubAccount,
|
_buildAddItem(
|
||||||
brand: Ionicons.logo_github,
|
text: AppLocalizations.of(context)!.githubAccount,
|
||||||
onTap: () async {
|
brand: Ionicons.logo_github,
|
||||||
theme.showActions(context, [
|
onTap: () async {
|
||||||
ActionItem(
|
theme.showActions(context, [
|
||||||
text: 'via OAuth',
|
ActionItem(
|
||||||
onTap: (_) {
|
text: 'via OAuth',
|
||||||
auth.redirectToGithubOauth();
|
onTap: (_) {
|
||||||
},
|
auth.redirectToGithubOauth();
|
||||||
),
|
},
|
||||||
ActionItem(
|
),
|
||||||
text: 'via OAuth (Public repos only)',
|
ActionItem(
|
||||||
onTap: (_) {
|
text: 'via OAuth (Public repos only)',
|
||||||
auth.redirectToGithubOauth(true);
|
onTap: (_) {
|
||||||
},
|
auth.redirectToGithubOauth(true);
|
||||||
),
|
},
|
||||||
ActionItem(
|
),
|
||||||
text: 'via Personal token',
|
ActionItem(
|
||||||
onTap: (_) async {
|
text: 'via Personal token',
|
||||||
final result = await theme.showConfirm(
|
onTap: (_) async {
|
||||||
context,
|
final result = await theme.showConfirm(
|
||||||
_buildPopup(context, notes: [
|
context,
|
||||||
Text(
|
_buildPopup(context, notes: [
|
||||||
AppLocalizations.of(context)!
|
Text(
|
||||||
.permissionRequiredMessage,
|
AppLocalizations.of(context)!
|
||||||
style: const TextStyle(
|
.permissionRequiredMessage,
|
||||||
fontSize: 14,
|
style: const TextStyle(
|
||||||
fontWeight: FontWeight.w400),
|
fontSize: 14,
|
||||||
),
|
fontWeight: FontWeight.w400),
|
||||||
const SizedBox(height: 8),
|
),
|
||||||
Text(
|
const SizedBox(height: 8),
|
||||||
'user, repo, read:org, notifications',
|
Text(
|
||||||
style: TextStyle(
|
'user, repo, read:org, notifications',
|
||||||
fontSize: 16,
|
style: TextStyle(
|
||||||
color: AntTheme.of(context).colorPrimary),
|
fontSize: 16,
|
||||||
)
|
color:
|
||||||
]),
|
AntTheme.of(context).colorPrimary),
|
||||||
);
|
)
|
||||||
if (result == true) {
|
]),
|
||||||
try {
|
);
|
||||||
await auth
|
if (result == true) {
|
||||||
.loginWithToken(_tokenController.text);
|
try {
|
||||||
_tokenController.clear();
|
await auth
|
||||||
} catch (err) {
|
.loginWithToken(_tokenController.text);
|
||||||
showError(err);
|
_tokenController.clear();
|
||||||
|
} catch (err) {
|
||||||
|
showError(err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
),
|
||||||
),
|
]);
|
||||||
]);
|
},
|
||||||
},
|
),
|
||||||
),
|
_buildAddItem(
|
||||||
_buildAddItem(
|
text: AppLocalizations.of(context)!.gitlabAccount,
|
||||||
text: AppLocalizations.of(context)!.gitlabAccount,
|
brand: Ionicons.git_branch_outline,
|
||||||
brand: Ionicons.git_branch_outline,
|
onTap: () async {
|
||||||
onTap: () async {
|
_domainController.text = 'https://gitlab.com';
|
||||||
_domainController.text = 'https://gitlab.com';
|
final result = await theme.showConfirm(
|
||||||
final result = await theme.showConfirm(
|
|
||||||
context,
|
|
||||||
_buildPopup(
|
|
||||||
context,
|
context,
|
||||||
showDomain: true,
|
_buildPopup(
|
||||||
notes: [
|
context,
|
||||||
Text(
|
showDomain: true,
|
||||||
AppLocalizations.of(context)!
|
notes: [
|
||||||
.permissionRequiredMessage,
|
Text(
|
||||||
style: const TextStyle(
|
AppLocalizations.of(context)!
|
||||||
fontSize: 14, fontWeight: FontWeight.w400),
|
.permissionRequiredMessage,
|
||||||
),
|
style: const TextStyle(
|
||||||
const SizedBox(height: 8),
|
fontSize: 14, fontWeight: FontWeight.w400),
|
||||||
Text(
|
),
|
||||||
'api, read_user, read_repository',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 16,
|
|
||||||
color: AntTheme.of(context).colorPrimary),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
if (result == true) {
|
|
||||||
try {
|
|
||||||
await auth.loginToGitlab(
|
|
||||||
_domainController.text, _tokenController.text);
|
|
||||||
_tokenController.clear();
|
|
||||||
} catch (err) {
|
|
||||||
showError(err);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
|
||||||
_buildAddItem(
|
|
||||||
text: AppLocalizations.of(context)!.bitbucketAccount,
|
|
||||||
brand: Ionicons.logo_bitbucket,
|
|
||||||
onTap: () async {
|
|
||||||
_domainController.text = 'https://bitbucket.org';
|
|
||||||
final result = await theme.showConfirm(
|
|
||||||
context,
|
|
||||||
Column(
|
|
||||||
children: <Widget>[
|
|
||||||
MyTextField(
|
|
||||||
controller: _domainController,
|
|
||||||
placeholder: 'Domain'),
|
|
||||||
const SizedBox(height: 8),
|
|
||||||
MyTextField(
|
|
||||||
placeholder: 'Username',
|
|
||||||
controller: _usernameController),
|
|
||||||
const SizedBox(height: 8),
|
|
||||||
MyTextField(
|
|
||||||
placeholder: 'App password',
|
|
||||||
controller: _passwordController),
|
|
||||||
const SizedBox(height: 8),
|
|
||||||
Text.rich(
|
|
||||||
TextSpan(children: [
|
|
||||||
const TextSpan(
|
|
||||||
text:
|
|
||||||
'Note: App password is different with the password. Follow ',
|
|
||||||
),
|
|
||||||
TextSpan(
|
|
||||||
text: 'this guide',
|
|
||||||
style: TextStyle(
|
|
||||||
color: AntTheme.of(context).colorPrimary),
|
|
||||||
recognizer: TapGestureRecognizer()
|
|
||||||
..onTap = () {
|
|
||||||
context.pushUrl(
|
|
||||||
'https://support.atlassian.com/bitbucket-cloud/docs/app-passwords/');
|
|
||||||
},
|
|
||||||
),
|
|
||||||
const TextSpan(text: ' to create one.')
|
|
||||||
]),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 8),
|
|
||||||
Text(
|
|
||||||
AppLocalizations.of(context)!
|
|
||||||
.permissionRequiredMessage,
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 14, fontWeight: FontWeight.w400),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 8),
|
|
||||||
Text(
|
|
||||||
'Account: read\nTeam membership: read\nProjects: read\nRepositories: read\nPull requests: read\nIssues: read\nSnippets: read',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 16,
|
|
||||||
color: AntTheme.of(context).colorPrimary),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
if (result == true) {
|
|
||||||
try {
|
|
||||||
await auth.loginToBb(
|
|
||||||
_domainController.text,
|
|
||||||
_usernameController.text,
|
|
||||||
_passwordController.text);
|
|
||||||
} catch (err) {
|
|
||||||
showError(err);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
|
||||||
_buildAddItem(
|
|
||||||
text: AppLocalizations.of(context)!.giteaAccount,
|
|
||||||
brand: Ionicons.git_branch_outline, // TODO: brand icon
|
|
||||||
onTap: () async {
|
|
||||||
_domainController.text = 'https://gitea.com';
|
|
||||||
final result = await theme.showConfirm(
|
|
||||||
context,
|
|
||||||
Column(
|
|
||||||
children: [
|
|
||||||
_buildPopup(context, showDomain: true),
|
|
||||||
const Text.rich(TextSpan(children: [
|
|
||||||
TextSpan(
|
|
||||||
text:
|
|
||||||
'Note: To login with Codeberg change the domain name to: ',
|
|
||||||
),
|
|
||||||
])),
|
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
Text(
|
Text(
|
||||||
'https://codeberg.org',
|
'api, read_user, read_repository',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
color: AntTheme.of(context).colorPrimary),
|
color: AntTheme.of(context).colorPrimary),
|
||||||
),
|
)
|
||||||
],
|
],
|
||||||
));
|
),
|
||||||
if (result == true) {
|
);
|
||||||
try {
|
if (result == true) {
|
||||||
await auth.loginToGitea(
|
try {
|
||||||
_domainController.text, _tokenController.text);
|
await auth.loginToGitlab(
|
||||||
_tokenController.clear();
|
_domainController.text, _tokenController.text);
|
||||||
} catch (err) {
|
_tokenController.clear();
|
||||||
showError(err);
|
} catch (err) {
|
||||||
|
showError(err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
|
||||||
),
|
|
||||||
_buildAddItem(
|
|
||||||
text: '${AppLocalizations.of(context)!.giteeAccount}(码云)',
|
|
||||||
brand: Ionicons.git_branch_outline, // TODO: brand icon
|
|
||||||
onTap: () async {
|
|
||||||
final result = await theme.showConfirm(
|
|
||||||
context,
|
|
||||||
_buildPopup(context),
|
|
||||||
);
|
|
||||||
if (result == true) {
|
|
||||||
try {
|
|
||||||
await auth.loginToGitee(_tokenController.text);
|
|
||||||
_tokenController.clear();
|
|
||||||
} catch (err) {
|
|
||||||
showError(err);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
|
||||||
_buildAddItem(
|
|
||||||
text: 'Gogs Account',
|
|
||||||
brand: Ionicons.git_branch_outline, // TODO: brand icon
|
|
||||||
onTap: () async {
|
|
||||||
_domainController.text = 'https://gogs.com';
|
|
||||||
final result = await theme.showConfirm(
|
|
||||||
context,
|
|
||||||
_buildPopup(context, showDomain: true),
|
|
||||||
);
|
|
||||||
if (result == true) {
|
|
||||||
try {
|
|
||||||
await auth.loginToGogs(
|
|
||||||
_domainController.text, _tokenController.text);
|
|
||||||
_tokenController.clear();
|
|
||||||
} catch (err) {
|
|
||||||
showError(err);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
padding: CommonStyle.padding,
|
|
||||||
child: Text(
|
|
||||||
AppLocalizations.of(context)!.longPressToRemoveAccount,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 16,
|
|
||||||
color: AntTheme.of(context).colorTextSecondary,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
)
|
_buildAddItem(
|
||||||
],
|
text: AppLocalizations.of(context)!.bitbucketAccount,
|
||||||
),
|
brand: Ionicons.logo_bitbucket,
|
||||||
|
onTap: () async {
|
||||||
|
_domainController.text = 'https://bitbucket.org';
|
||||||
|
final result = await theme.showConfirm(
|
||||||
|
context,
|
||||||
|
Column(
|
||||||
|
children: <Widget>[
|
||||||
|
MyTextField(
|
||||||
|
controller: _domainController,
|
||||||
|
placeholder: 'Domain'),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
MyTextField(
|
||||||
|
placeholder: 'Username',
|
||||||
|
controller: _usernameController),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
MyTextField(
|
||||||
|
placeholder: 'App password',
|
||||||
|
controller: _passwordController),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
Text.rich(
|
||||||
|
TextSpan(children: [
|
||||||
|
const TextSpan(
|
||||||
|
text:
|
||||||
|
'Note: App password is different with the password. Follow ',
|
||||||
|
),
|
||||||
|
TextSpan(
|
||||||
|
text: 'this guide',
|
||||||
|
style: TextStyle(
|
||||||
|
color:
|
||||||
|
AntTheme.of(context).colorPrimary),
|
||||||
|
recognizer: TapGestureRecognizer()
|
||||||
|
..onTap = () {
|
||||||
|
context.pushUrl(
|
||||||
|
'https://support.atlassian.com/bitbucket-cloud/docs/app-passwords/');
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const TextSpan(text: ' to create one.')
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
Text(
|
||||||
|
AppLocalizations.of(context)!
|
||||||
|
.permissionRequiredMessage,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 14, fontWeight: FontWeight.w400),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
Text(
|
||||||
|
'Account: read\nTeam membership: read\nProjects: read\nRepositories: read\nPull requests: read\nIssues: read\nSnippets: read',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
color: AntTheme.of(context).colorPrimary),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
if (result == true) {
|
||||||
|
try {
|
||||||
|
await auth.loginToBb(
|
||||||
|
_domainController.text,
|
||||||
|
_usernameController.text,
|
||||||
|
_passwordController.text);
|
||||||
|
} catch (err) {
|
||||||
|
showError(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
_buildAddItem(
|
||||||
|
text: AppLocalizations.of(context)!.giteaAccount,
|
||||||
|
brand: Ionicons.git_branch_outline, // TODO: brand icon
|
||||||
|
onTap: () async {
|
||||||
|
_domainController.text = 'https://gitea.com';
|
||||||
|
final result = await theme.showConfirm(
|
||||||
|
context,
|
||||||
|
Column(
|
||||||
|
children: [
|
||||||
|
_buildPopup(context, showDomain: true),
|
||||||
|
const Text.rich(TextSpan(children: [
|
||||||
|
TextSpan(
|
||||||
|
text:
|
||||||
|
'Note: To login with Codeberg change the domain name to: ',
|
||||||
|
),
|
||||||
|
])),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
Text(
|
||||||
|
'https://codeberg.org',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
color: AntTheme.of(context).colorPrimary),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
));
|
||||||
|
if (result == true) {
|
||||||
|
try {
|
||||||
|
await auth.loginToGitea(
|
||||||
|
_domainController.text, _tokenController.text);
|
||||||
|
_tokenController.clear();
|
||||||
|
} catch (err) {
|
||||||
|
showError(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
_buildAddItem(
|
||||||
|
text: '${AppLocalizations.of(context)!.giteeAccount}(码云)',
|
||||||
|
brand: Ionicons.git_branch_outline, // TODO: brand icon
|
||||||
|
onTap: () async {
|
||||||
|
final result = await theme.showConfirm(
|
||||||
|
context,
|
||||||
|
_buildPopup(context),
|
||||||
|
);
|
||||||
|
if (result == true) {
|
||||||
|
try {
|
||||||
|
await auth.loginToGitee(_tokenController.text);
|
||||||
|
_tokenController.clear();
|
||||||
|
} catch (err) {
|
||||||
|
showError(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
_buildAddItem(
|
||||||
|
text: 'Gogs Account',
|
||||||
|
brand: Ionicons.git_branch_outline, // TODO: brand icon
|
||||||
|
onTap: () async {
|
||||||
|
_domainController.text = 'https://gogs.com';
|
||||||
|
final result = await theme.showConfirm(
|
||||||
|
context,
|
||||||
|
_buildPopup(context, showDomain: true),
|
||||||
|
);
|
||||||
|
if (result == true) {
|
||||||
|
try {
|
||||||
|
await auth.loginToGogs(
|
||||||
|
_domainController.text, _tokenController.text);
|
||||||
|
_tokenController.clear();
|
||||||
|
} catch (err) {
|
||||||
|
showError(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
padding: CommonStyle.padding,
|
||||||
|
child: Text(
|
||||||
|
AppLocalizations.of(context)!.longPressToRemoveAccount,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
color: AntTheme.of(context).colorTextSecondary,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ class StorageKeys {
|
||||||
}
|
}
|
||||||
|
|
||||||
class CommonStyle {
|
class CommonStyle {
|
||||||
static const padding = EdgeInsets.symmetric(horizontal: 16, vertical: 12);
|
static const padding = EdgeInsets.all(12);
|
||||||
static const border = BorderView();
|
static const border = BorderView();
|
||||||
static const verticalGap = SizedBox(height: 18);
|
static const verticalGap = SizedBox(height: 18);
|
||||||
static final monospace = Platform.isIOS ? 'Menlo' : 'monospace'; // FIXME:
|
static final monospace = Platform.isIOS ? 'Menlo' : 'monospace'; // FIXME:
|
||||||
|
|
|
@ -42,8 +42,7 @@ class EventItem extends StatelessWidget {
|
||||||
required List<InlineSpan> spans,
|
required List<InlineSpan> spans,
|
||||||
Widget? card,
|
Widget? card,
|
||||||
}) {
|
}) {
|
||||||
return Container(
|
return AntListItem(
|
||||||
padding: CommonStyle.padding,
|
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
|
Loading…
Reference in New Issue