mirror of
https://github.com/git-touch/git-touch
synced 2025-03-04 11:17:47 +01:00
style: dart fix apply
This commit is contained in:
parent
b688dc155a
commit
081acbeda8
@ -25,5 +25,9 @@ linter:
|
||||
# avoid_print: false # Uncomment to disable the `avoid_print` rule
|
||||
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
|
||||
|
||||
analyzer:
|
||||
exclude:
|
||||
- "**/*.gql.dart"
|
||||
- "**/*.g.dart"
|
||||
# Additional information about this file can be found at
|
||||
# https://dart.dev/guides/language/analysis-options
|
||||
|
@ -1,5 +1,4 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:git_touch/app.dart';
|
||||
import 'package:git_touch/models/code.dart';
|
||||
import 'package:git_touch/models/auth.dart';
|
||||
@ -32,36 +31,36 @@ void main() async {
|
||||
codeModel.init(),
|
||||
]);
|
||||
|
||||
CommonRouter.routes.forEach((screen) {
|
||||
for (var screen in CommonRouter.routes) {
|
||||
themeModel.router.define(CommonRouter.prefix + screen.path,
|
||||
handler: Handler(handlerFunc: screen.handler));
|
||||
});
|
||||
GitlabRouter.routes.forEach((screen) {
|
||||
}
|
||||
for (var screen in GitlabRouter.routes) {
|
||||
themeModel.router.define(GitlabRouter.prefix + screen.path,
|
||||
handler: Handler(handlerFunc: screen.handler));
|
||||
});
|
||||
GiteaRouter.routes.forEach((screen) {
|
||||
}
|
||||
for (var screen in GiteaRouter.routes) {
|
||||
themeModel.router.define(GiteaRouter.prefix + screen.path,
|
||||
handler: Handler(handlerFunc: screen.handler));
|
||||
});
|
||||
BitbucketRouter.routes.forEach((screen) {
|
||||
}
|
||||
for (var screen in BitbucketRouter.routes) {
|
||||
themeModel.router.define(BitbucketRouter.prefix + screen.path,
|
||||
handler: Handler(handlerFunc: screen.handler));
|
||||
});
|
||||
GithubRouter.routes.forEach((screen) {
|
||||
}
|
||||
for (var screen in GithubRouter.routes) {
|
||||
themeModel.router.define(GithubRouter.prefix + screen.path,
|
||||
handler: Handler(handlerFunc: screen.handler));
|
||||
});
|
||||
GiteeRouter.routes.forEach((screen) {
|
||||
}
|
||||
for (var screen in GiteeRouter.routes) {
|
||||
themeModel.router.define(GiteeRouter.prefix + screen.path,
|
||||
handler: Handler(handlerFunc: screen.handler));
|
||||
});
|
||||
GogsRouter.routes.forEach((screen) {
|
||||
}
|
||||
for (var screen in GogsRouter.routes) {
|
||||
themeModel.router.define(GogsRouter.prefix + screen.path,
|
||||
handler: Handler(handlerFunc: screen.handler));
|
||||
});
|
||||
}
|
||||
// To match status bar color to app bar color
|
||||
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
|
||||
SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
|
||||
statusBarColor: Colors.transparent,
|
||||
));
|
||||
|
||||
|
@ -145,9 +145,7 @@ class AuthModel with ChangeNotifier {
|
||||
if (info['error'] != null) {
|
||||
throw info['error'] +
|
||||
'. ' +
|
||||
(info['error_description'] != null
|
||||
? info['error_description']
|
||||
: '');
|
||||
(info['error_description'] ?? '');
|
||||
}
|
||||
final user = GitlabUser.fromJson(info);
|
||||
await _addAccount(Account(
|
||||
@ -304,7 +302,7 @@ class AuthModel with ChangeNotifier {
|
||||
return DataWithPage(
|
||||
data: info,
|
||||
cursor: page + 1,
|
||||
hasMore: info is List && info.length > 0,
|
||||
hasMore: info is List && info.isNotEmpty,
|
||||
total: int.tryParse(res.headers['x-total-count'] ?? '') ??
|
||||
TOTAL_COUNT_FALLBACK,
|
||||
);
|
||||
@ -408,7 +406,7 @@ class AuthModel with ChangeNotifier {
|
||||
return DataWithPage(
|
||||
data: info,
|
||||
cursor: page + 1,
|
||||
hasMore: info is List && info.length > 0,
|
||||
hasMore: info is List && info.isNotEmpty,
|
||||
total: int.tryParse(res.headers['x-total-count'] ?? '') ??
|
||||
TOTAL_COUNT_FALLBACK,
|
||||
);
|
||||
@ -683,23 +681,20 @@ class AuthModel with ChangeNotifier {
|
||||
}
|
||||
|
||||
// http timeout
|
||||
var _timeoutDuration = Duration(seconds: 10);
|
||||
final _timeoutDuration = const Duration(seconds: 10);
|
||||
// var _timeoutDuration = Duration(seconds: 1);
|
||||
|
||||
GitHub? _ghClient;
|
||||
GitHub get ghClient {
|
||||
if (_ghClient == null) {
|
||||
_ghClient = GitHub(auth: Authentication.withToken(token));
|
||||
}
|
||||
_ghClient ??= GitHub(auth: Authentication.withToken(token));
|
||||
return _ghClient!;
|
||||
}
|
||||
|
||||
Client? _gqlClient;
|
||||
Client get gqlClient {
|
||||
if (_gqlClient == null) {
|
||||
_gqlClient = Client(
|
||||
_gqlClient ??= Client(
|
||||
link: HttpLink(
|
||||
_apiPrefix + '/graphql',
|
||||
'$_apiPrefix/graphql',
|
||||
defaultHeaders: {HttpHeaders.authorizationHeader: 'token $token'},
|
||||
),
|
||||
// https://ferrygraphql.com/docs/fetch-policies#default-fetchpolicies
|
||||
@ -707,20 +702,17 @@ class AuthModel with ChangeNotifier {
|
||||
OperationType.query: FetchPolicy.NetworkOnly,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
return _gqlClient!;
|
||||
}
|
||||
|
||||
Future<dynamic> query(String query, [String? _token]) async {
|
||||
if (_token == null) {
|
||||
_token = token;
|
||||
}
|
||||
Future<dynamic> query(String query, [String? token]) async {
|
||||
token ??= token;
|
||||
|
||||
final res = await http
|
||||
.post(Uri.parse(_apiPrefix + '/graphql'),
|
||||
.post(Uri.parse('$_apiPrefix/graphql'),
|
||||
headers: {
|
||||
HttpHeaders.authorizationHeader: 'token $_token',
|
||||
HttpHeaders.authorizationHeader: 'token $token',
|
||||
HttpHeaders.contentTypeHeader: 'application/json'
|
||||
},
|
||||
body: json.encode({'query': query}))
|
||||
|
@ -1,5 +1,4 @@
|
||||
import 'package:fimber/fimber.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_highlight/theme_map.dart';
|
||||
import 'package:git_touch/utils/utils.dart';
|
||||
|
@ -14,16 +14,12 @@ class GithubEvent {
|
||||
|
||||
Tuple2<String, String>? _repo;
|
||||
String get repoOwner {
|
||||
if (_repo == null) {
|
||||
_repo = parseRepositoryFullName(repo!.name!);
|
||||
}
|
||||
_repo ??= parseRepositoryFullName(repo!.name!);
|
||||
return _repo!.item1;
|
||||
}
|
||||
|
||||
String get repoName {
|
||||
if (_repo == null) {
|
||||
_repo = parseRepositoryFullName(repo!.name!);
|
||||
}
|
||||
_repo ??= parseRepositoryFullName(repo!.name!);
|
||||
return _repo!.item2;
|
||||
}
|
||||
|
||||
@ -165,9 +161,7 @@ class GithubNotificationItemSubject {
|
||||
|
||||
int? _number;
|
||||
int? get number {
|
||||
if (_number == null) {
|
||||
_number = int.parse(url?.split('/').last ?? '0');
|
||||
}
|
||||
_number ??= int.parse(url?.split('/').last ?? '0');
|
||||
return _number;
|
||||
}
|
||||
|
||||
@ -183,16 +177,12 @@ class GithubNotificationItemRepo {
|
||||
|
||||
Tuple2<String, String>? _repo;
|
||||
String get owner {
|
||||
if (_repo == null) {
|
||||
_repo = parseRepositoryFullName(fullName!);
|
||||
}
|
||||
_repo ??= parseRepositoryFullName(fullName!);
|
||||
return _repo!.item1;
|
||||
}
|
||||
|
||||
String get name {
|
||||
if (_repo == null) {
|
||||
_repo = parseRepositoryFullName(fullName!);
|
||||
}
|
||||
_repo ??= parseRepositoryFullName(fullName!);
|
||||
return _repo!.item2;
|
||||
}
|
||||
|
||||
|
@ -10,16 +10,12 @@ class NotificationGroup {
|
||||
|
||||
Tuple2<String, String>? _repo;
|
||||
String get owner {
|
||||
if (_repo == null) {
|
||||
_repo = parseRepositoryFullName(fullName!);
|
||||
}
|
||||
_repo ??= parseRepositoryFullName(fullName!);
|
||||
return _repo!.item1;
|
||||
}
|
||||
|
||||
String get name {
|
||||
if (_repo == null) {
|
||||
_repo = parseRepositoryFullName(fullName!);
|
||||
}
|
||||
_repo ??= parseRepositoryFullName(fullName!);
|
||||
return _repo!.item2;
|
||||
}
|
||||
|
||||
|
@ -290,11 +290,11 @@ class ThemeModel with ChangeNotifier {
|
||||
title: content,
|
||||
actions: <Widget>[
|
||||
CupertinoDialogAction(
|
||||
child: const Text('cancel'),
|
||||
isDefaultAction: true,
|
||||
onPressed: () {
|
||||
Navigator.pop(context, false);
|
||||
},
|
||||
child: const Text('cancel'),
|
||||
),
|
||||
CupertinoDialogAction(
|
||||
child: const Text('OK'),
|
||||
@ -356,7 +356,6 @@ class ThemeModel with ChangeNotifier {
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
CupertinoButton(
|
||||
child: Text('Cancel'),
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
_selectedItem = groupItem.value;
|
||||
@ -365,9 +364,9 @@ class ThemeModel with ChangeNotifier {
|
||||
horizontal: 16.0,
|
||||
vertical: 5.0,
|
||||
),
|
||||
child: const Text('Cancel'),
|
||||
),
|
||||
CupertinoButton(
|
||||
child: Text('Confirm'),
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
groupItem.onClose!(_selectedItem);
|
||||
@ -376,18 +375,15 @@ class ThemeModel with ChangeNotifier {
|
||||
horizontal: 16.0,
|
||||
vertical: 5.0,
|
||||
),
|
||||
child: const Text('Confirm'),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
SizedBox(
|
||||
height: 216,
|
||||
child: CupertinoPicker(
|
||||
backgroundColor: palette.background,
|
||||
children: <Widget>[
|
||||
for (var v in groupItem.items)
|
||||
Text(v.text!, style: TextStyle(color: palette.text)),
|
||||
],
|
||||
itemExtent: 40,
|
||||
scrollController: FixedExtentScrollController(
|
||||
initialItem: groupItem.items
|
||||
@ -406,6 +402,10 @@ class ThemeModel with ChangeNotifier {
|
||||
});
|
||||
}
|
||||
},
|
||||
children: <Widget>[
|
||||
for (var v in groupItem.items)
|
||||
Text(v.text!, style: TextStyle(color: palette.text)),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
@ -419,22 +419,22 @@ class ThemeModel with ChangeNotifier {
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return CupertinoActionSheet(
|
||||
title: Text('Actions'),
|
||||
title: const Text('Actions'),
|
||||
actions: actionItems.asMap().entries.map((entry) {
|
||||
return CupertinoActionSheetAction(
|
||||
child: Text(entry.value.text!),
|
||||
isDestructiveAction: entry.value.isDestructiveAction,
|
||||
onPressed: () {
|
||||
Navigator.pop(context, entry.key);
|
||||
},
|
||||
child: Text(entry.value.text!),
|
||||
);
|
||||
}).toList(),
|
||||
cancelButton: CupertinoActionSheetAction(
|
||||
child: const Text('Cancel'),
|
||||
isDefaultAction: true,
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: const Text('Cancel'),
|
||||
),
|
||||
);
|
||||
},
|
||||
|
@ -9,7 +9,7 @@ class CommonScaffold extends StatelessWidget {
|
||||
final Widget? action;
|
||||
final PreferredSizeWidget? bottom;
|
||||
|
||||
CommonScaffold({
|
||||
const CommonScaffold({
|
||||
required this.title,
|
||||
required this.body,
|
||||
this.action,
|
||||
|
@ -1,6 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:git_touch/models/theme.dart';
|
||||
import 'package:git_touch/scaffolds/common.dart';
|
||||
import 'package:git_touch/utils/utils.dart';
|
||||
@ -17,7 +16,7 @@ class ListStatefulScaffold<T, K> extends StatefulWidget {
|
||||
final Widget Function(T payload) itemBuilder;
|
||||
final Future<ListPayload<T, K>> Function(K? cursor) fetch;
|
||||
|
||||
ListStatefulScaffold({
|
||||
const ListStatefulScaffold({
|
||||
required this.title,
|
||||
required this.fetch,
|
||||
required this.itemBuilder,
|
||||
@ -39,7 +38,7 @@ class _ListStatefulScaffoldState<T, K>
|
||||
K? cursor;
|
||||
bool? hasMore;
|
||||
|
||||
ScrollController _controller = ScrollController();
|
||||
final ScrollController _controller = ScrollController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@ -75,7 +74,7 @@ class _ListStatefulScaffoldState<T, K>
|
||||
hasMore = p.hasMore;
|
||||
} catch (err) {
|
||||
error = err.toString();
|
||||
throw err;
|
||||
rethrow;
|
||||
} finally {
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
@ -97,7 +96,7 @@ class _ListStatefulScaffoldState<T, K>
|
||||
hasMore = p.hasMore;
|
||||
} catch (err) {
|
||||
error = err.toString();
|
||||
throw err;
|
||||
rethrow;
|
||||
} finally {
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
@ -110,7 +109,7 @@ class _ListStatefulScaffoldState<T, K>
|
||||
Widget _buildItem(BuildContext context, int index) {
|
||||
if (index == 2 * items.length) {
|
||||
if (hasMore != false) {
|
||||
return Loading(more: true);
|
||||
return const Loading(more: true);
|
||||
} else {
|
||||
return Container();
|
||||
}
|
||||
@ -127,7 +126,7 @@ class _ListStatefulScaffoldState<T, K>
|
||||
child: ErrorReload(text: error, onTap: _refresh),
|
||||
);
|
||||
} else if (loading && items.isEmpty) {
|
||||
return SliverToBoxAdapter(child: Loading(more: false));
|
||||
return const SliverToBoxAdapter(child: Loading(more: false));
|
||||
} else if (items.isEmpty) {
|
||||
return SliverToBoxAdapter(child: EmptyWidget());
|
||||
} else {
|
||||
@ -144,7 +143,7 @@ class _ListStatefulScaffoldState<T, K>
|
||||
if (error.isNotEmpty) {
|
||||
return ErrorReload(text: error, onTap: _refresh);
|
||||
} else if (loading && items.isEmpty) {
|
||||
return Loading(more: false);
|
||||
return const Loading(more: false);
|
||||
} else if (items.isEmpty) {
|
||||
return EmptyWidget();
|
||||
} else {
|
||||
|
@ -12,7 +12,7 @@ class RefreshStatefulScaffold<T> extends StatefulWidget {
|
||||
final Widget? action;
|
||||
final canRefresh;
|
||||
|
||||
RefreshStatefulScaffold({
|
||||
const RefreshStatefulScaffold({
|
||||
required this.title,
|
||||
required this.bodyBuilder,
|
||||
required this.fetch,
|
||||
@ -48,7 +48,7 @@ class _RefreshStatefulScaffoldState<T>
|
||||
_data = await widget.fetch();
|
||||
} catch (err) {
|
||||
_error = err.toString();
|
||||
throw err;
|
||||
rethrow;
|
||||
} finally {
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
@ -61,7 +61,7 @@ class _RefreshStatefulScaffoldState<T>
|
||||
Widget? get _action {
|
||||
if (widget.action != null) return widget.action;
|
||||
if (widget.actionBuilder == null || _data == null) return null;
|
||||
return widget.actionBuilder!(_data!, (v) {
|
||||
return widget.actionBuilder!(_data as T, (v) {
|
||||
setState(() {
|
||||
_data = v;
|
||||
});
|
||||
@ -71,7 +71,7 @@ class _RefreshStatefulScaffoldState<T>
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Widget child = ErrorLoadingWrapper(
|
||||
bodyBuilder: () => widget.bodyBuilder(_data!, (v) {
|
||||
bodyBuilder: () => widget.bodyBuilder(_data as T, (v) {
|
||||
setState(() {
|
||||
_data = v;
|
||||
});
|
||||
|
@ -6,7 +6,7 @@ class SingleScaffold extends StatelessWidget {
|
||||
final Widget body;
|
||||
final Widget? action;
|
||||
|
||||
SingleScaffold({
|
||||
const SingleScaffold({
|
||||
required this.title,
|
||||
required this.body,
|
||||
this.action,
|
||||
|
@ -14,7 +14,7 @@ class TabScaffold extends StatelessWidget {
|
||||
final int activeTab;
|
||||
final Function(int index) onTabSwitch;
|
||||
|
||||
TabScaffold({
|
||||
const TabScaffold({
|
||||
required this.title,
|
||||
required this.body,
|
||||
this.action,
|
||||
|
@ -10,7 +10,7 @@ class TabStatefulScaffold<T> extends StatefulWidget {
|
||||
final List<String> tabs;
|
||||
final Widget Function(T payload, void Function() refresh)? actionBuilder;
|
||||
|
||||
TabStatefulScaffold({
|
||||
const TabStatefulScaffold({
|
||||
required this.title,
|
||||
required this.bodyBuilder,
|
||||
required this.fetchData,
|
||||
@ -74,7 +74,7 @@ class _TabStatefulScaffoldState<T> extends State<TabStatefulScaffold<T>> {
|
||||
_payload = await widget.fetchData(_activeTab);
|
||||
} catch (err) {
|
||||
_error = err.toString();
|
||||
throw err;
|
||||
rethrow;
|
||||
} finally {
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
@ -90,7 +90,7 @@ class _TabStatefulScaffoldState<T> extends State<TabStatefulScaffold<T>> {
|
||||
title: widget.title,
|
||||
action: widget.actionBuilder == null
|
||||
? null
|
||||
: widget.actionBuilder!(_payload!, _refresh),
|
||||
: widget.actionBuilder!(_payload as T, _refresh),
|
||||
tabs: widget.tabs,
|
||||
activeTab: _activeTab,
|
||||
onTabSwitch: (selected) async {
|
||||
@ -105,7 +105,7 @@ class _TabStatefulScaffoldState<T> extends State<TabStatefulScaffold<T>> {
|
||||
},
|
||||
onRefresh: _refresh,
|
||||
body: ErrorLoadingWrapper(
|
||||
bodyBuilder: () => widget.bodyBuilder(_payload!, _activeTab),
|
||||
bodyBuilder: () => widget.bodyBuilder(_payload as T, _activeTab),
|
||||
error: _error,
|
||||
loading: _payload == null,
|
||||
reload: _refresh,
|
||||
|
@ -9,7 +9,7 @@ class RefreshWrapper extends StatelessWidget {
|
||||
final Widget body;
|
||||
final void Function() onRefresh;
|
||||
|
||||
RefreshWrapper({
|
||||
const RefreshWrapper({
|
||||
required this.onRefresh,
|
||||
required this.body,
|
||||
});
|
||||
@ -44,7 +44,7 @@ class ErrorLoadingWrapper extends StatelessWidget {
|
||||
final void Function() reload;
|
||||
final Widget? Function() bodyBuilder;
|
||||
|
||||
ErrorLoadingWrapper({
|
||||
const ErrorLoadingWrapper({
|
||||
required this.error,
|
||||
required this.loading,
|
||||
required this.reload,
|
||||
@ -58,7 +58,7 @@ class ErrorLoadingWrapper extends StatelessWidget {
|
||||
}
|
||||
|
||||
if (loading) {
|
||||
return Loading();
|
||||
return const Loading();
|
||||
}
|
||||
|
||||
return bodyBuilder()!;
|
||||
|
@ -5,14 +5,13 @@ import 'package:git_touch/scaffolds/list_stateful.dart';
|
||||
import 'package:git_touch/widgets/app_bar_title.dart';
|
||||
import 'package:git_touch/widgets/commit_item.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:git_touch/utils/utils.dart';
|
||||
import 'package:flutter_gen/gen_l10n/S.dart';
|
||||
|
||||
class BbCommitsScreen extends StatelessWidget {
|
||||
final String owner;
|
||||
final String name;
|
||||
final String ref;
|
||||
BbCommitsScreen(this.owner, this.name, this.ref);
|
||||
const BbCommitsScreen(this.owner, this.name, this.ref);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -5,7 +5,6 @@ import 'package:git_touch/scaffolds/list_stateful.dart';
|
||||
import 'package:git_touch/widgets/app_bar_title.dart';
|
||||
import 'package:git_touch/widgets/repository_item.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:git_touch/utils/utils.dart';
|
||||
import 'package:flutter_gen/gen_l10n/S.dart';
|
||||
|
||||
class BbExploreScreen extends StatelessWidget {
|
||||
|
@ -18,7 +18,7 @@ class BbIssueScreen extends StatelessWidget {
|
||||
final String number;
|
||||
final bool isPr;
|
||||
|
||||
BbIssueScreen(this.owner, this.name, this.number, {this.isPr: false});
|
||||
const BbIssueScreen(this.owner, this.name, this.number, {this.isPr = false});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -60,7 +60,7 @@ class BbIssueScreen extends StatelessWidget {
|
||||
url: issue.reporter!.avatarUrl,
|
||||
size: AvatarSize.extraSmall,
|
||||
),
|
||||
SizedBox(width: 4),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
'$owner / $name',
|
||||
style: TextStyle(
|
||||
@ -68,7 +68,7 @@ class BbIssueScreen extends StatelessWidget {
|
||||
color: theme.palette.secondaryText,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 4),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
'#$number',
|
||||
style: TextStyle(
|
||||
@ -79,24 +79,24 @@ class BbIssueScreen extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
issue.title!,
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
const SizedBox(height: 8),
|
||||
StateLabel(StateLabelStatus.issueOpened),
|
||||
SizedBox(height: 16),
|
||||
const SizedBox(height: 16),
|
||||
CommonStyle.border,
|
||||
],
|
||||
)),
|
||||
Column(children: [
|
||||
for (var comment in comments) ...[
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 10),
|
||||
padding: const EdgeInsets.only(left: 10),
|
||||
child: CommentItem(
|
||||
avatar: Avatar(
|
||||
url: comment.user!.avatarUrl,
|
||||
@ -107,7 +107,7 @@ class BbIssueScreen extends StatelessWidget {
|
||||
login: comment.user!.displayName,
|
||||
prefix: 'bitbucket')),
|
||||
CommonStyle.border,
|
||||
SizedBox(height: 16),
|
||||
const SizedBox(height: 16),
|
||||
],
|
||||
]),
|
||||
]);
|
||||
|
@ -1,5 +1,4 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:git_touch/models/auth.dart';
|
||||
import 'package:git_touch/models/theme.dart';
|
||||
import 'package:git_touch/scaffolds/common.dart';
|
||||
@ -11,7 +10,7 @@ class BbIssueCommentScreen extends StatefulWidget {
|
||||
final String owner;
|
||||
final String name;
|
||||
final String number;
|
||||
BbIssueCommentScreen(this.owner, this.name, this.number);
|
||||
const BbIssueCommentScreen(this.owner, this.name, this.number);
|
||||
|
||||
@override
|
||||
_BbIssueCommentScreenState createState() => _BbIssueCommentScreenState();
|
||||
@ -25,7 +24,7 @@ class _BbIssueCommentScreenState extends State<BbIssueCommentScreen> {
|
||||
final theme = Provider.of<ThemeModel>(context);
|
||||
final auth = Provider.of<AuthModel>(context);
|
||||
return CommonScaffold(
|
||||
title: Text('New Comment'),
|
||||
title: const Text('New Comment'),
|
||||
body: Column(
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
@ -42,7 +41,7 @@ class _BbIssueCommentScreenState extends State<BbIssueCommentScreen> {
|
||||
),
|
||||
),
|
||||
CupertinoButton.filled(
|
||||
child: Text('Comment'),
|
||||
child: const Text('Comment'),
|
||||
onPressed: () async {
|
||||
await auth.fetchBb(
|
||||
'/repositories/${widget.owner}/${widget.name}/issues/${widget.number}/comments',
|
||||
|
@ -1,5 +1,4 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:git_touch/models/auth.dart';
|
||||
import 'package:git_touch/models/bitbucket.dart';
|
||||
import 'package:git_touch/models/theme.dart';
|
||||
@ -11,7 +10,7 @@ import 'package:flutter_gen/gen_l10n/S.dart';
|
||||
class BbIssueFormScreen extends StatefulWidget {
|
||||
final String owner;
|
||||
final String name;
|
||||
BbIssueFormScreen(this.owner, this.name);
|
||||
const BbIssueFormScreen(this.owner, this.name);
|
||||
|
||||
@override
|
||||
_BbIssueFormScreenState createState() => _BbIssueFormScreenState();
|
||||
|
@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
|
||||
import 'package:git_touch/models/auth.dart';
|
||||
import 'package:git_touch/models/bitbucket.dart';
|
||||
import 'package:git_touch/scaffolds/list_stateful.dart';
|
||||
import 'package:git_touch/utils/utils.dart';
|
||||
import 'package:git_touch/widgets/action_entry.dart';
|
||||
import 'package:git_touch/widgets/app_bar_title.dart';
|
||||
import 'package:git_touch/widgets/issue_item.dart';
|
||||
@ -12,7 +11,7 @@ import 'package:flutter_gen/gen_l10n/S.dart';
|
||||
class BbIssuesScreen extends StatelessWidget {
|
||||
final String owner;
|
||||
final String name;
|
||||
BbIssuesScreen(this.owner, this.name);
|
||||
const BbIssuesScreen(this.owner, this.name);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -41,7 +40,7 @@ class BbIssuesScreen extends StatelessWidget {
|
||||
avatarUrl: v.reporter!.avatarUrl,
|
||||
author: v.reporter!.displayName,
|
||||
title: v.title,
|
||||
subtitle: '#' + issueNumber.toString(),
|
||||
subtitle: '#$issueNumber',
|
||||
commentCount: 0,
|
||||
updatedAt: v.createdOn,
|
||||
url: '/bitbucket/$owner/$name/issues/$issueNumber',
|
||||
|
@ -4,7 +4,6 @@ import 'package:universal_io/io.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:git_touch/models/auth.dart';
|
||||
import 'package:git_touch/models/bitbucket.dart';
|
||||
import 'package:git_touch/utils/utils.dart';
|
||||
import 'package:git_touch/widgets/action_entry.dart';
|
||||
import 'package:git_touch/widgets/app_bar_title.dart';
|
||||
import 'package:git_touch/widgets/blob_view.dart';
|
||||
@ -17,7 +16,7 @@ class BbObjectScreen extends StatelessWidget {
|
||||
final String name;
|
||||
final String ref;
|
||||
final String? path;
|
||||
BbObjectScreen(this.owner, this.name, this.ref, {this.path});
|
||||
const BbObjectScreen(this.owner, this.name, this.ref, {this.path});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -66,7 +65,7 @@ class BbObjectScreen extends StatelessWidget {
|
||||
}
|
||||
},
|
||||
actionBuilder: () {
|
||||
return ActionEntry(
|
||||
return const ActionEntry(
|
||||
iconData: Ionicons.cog,
|
||||
url: '/choose-code-theme',
|
||||
);
|
||||
|
@ -5,13 +5,12 @@ import 'package:git_touch/scaffolds/list_stateful.dart';
|
||||
import 'package:git_touch/widgets/app_bar_title.dart';
|
||||
import 'package:git_touch/widgets/issue_item.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:git_touch/utils/utils.dart';
|
||||
import 'package:flutter_gen/gen_l10n/S.dart';
|
||||
|
||||
class BbPullsScreen extends StatelessWidget {
|
||||
final String owner;
|
||||
final String name;
|
||||
BbPullsScreen(this.owner, this.name);
|
||||
const BbPullsScreen(this.owner, this.name);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -36,7 +35,7 @@ class BbPullsScreen extends StatelessWidget {
|
||||
avatarUrl: v.author!.avatarUrl,
|
||||
author: v.author!.displayName,
|
||||
title: v.title,
|
||||
subtitle: '#' + pullNumber.toString(),
|
||||
subtitle: '#$pullNumber',
|
||||
commentCount: 0,
|
||||
updatedAt: v.createdOn,
|
||||
url:
|
||||
|
@ -19,7 +19,7 @@ class BbRepoScreen extends StatelessWidget {
|
||||
final String owner;
|
||||
final String name;
|
||||
final String? branch;
|
||||
BbRepoScreen(this.owner, this.name, {this.branch});
|
||||
const BbRepoScreen(this.owner, this.name, {this.branch});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -60,33 +60,31 @@ class BbRepoScreen extends StatelessWidget {
|
||||
items: [
|
||||
TableViewItem(
|
||||
leftIconData: Octicons.code,
|
||||
text: Text('Code'),
|
||||
text: const Text('Code'),
|
||||
rightWidget: Text(filesize(p.size)),
|
||||
url:
|
||||
'/bitbucket/$owner/$name/src/${branch ?? p.mainbranch!.name}',
|
||||
),
|
||||
TableViewItem(
|
||||
leftIconData: Octicons.issue_opened,
|
||||
text: Text('Issues'),
|
||||
text: const Text('Issues'),
|
||||
url: '/bitbucket/$owner/$name/issues',
|
||||
),
|
||||
TableViewItem(
|
||||
leftIconData: Octicons.git_pull_request,
|
||||
text: Text('Pull requests'),
|
||||
text: const Text('Pull requests'),
|
||||
url: '/bitbucket/$owner/$name/pulls',
|
||||
),
|
||||
TableViewItem(
|
||||
leftIconData: Octicons.history,
|
||||
text: Text('Commits'),
|
||||
text: const Text('Commits'),
|
||||
url:
|
||||
'/bitbucket/$owner/$name/commits/${branch ?? p.mainbranch!.name}',
|
||||
),
|
||||
TableViewItem(
|
||||
leftIconData: Octicons.git_branch,
|
||||
text: Text(AppLocalizations.of(context)!.branches),
|
||||
rightWidget: Text((branch ?? p.mainbranch!.name)! +
|
||||
' • ' +
|
||||
branches.length.toString()),
|
||||
rightWidget: Text('${(branch ?? p.mainbranch!.name)!} • ${branches.length}'),
|
||||
onTap: () async {
|
||||
if (branches.length < 2) return;
|
||||
|
||||
|
@ -6,7 +6,6 @@ import 'package:git_touch/widgets/app_bar_title.dart';
|
||||
import 'package:git_touch/widgets/user_item.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:timeago/timeago.dart' as timeago;
|
||||
import 'package:git_touch/utils/utils.dart';
|
||||
import 'package:flutter_gen/gen_l10n/S.dart';
|
||||
|
||||
class BbTeamsScreen extends StatelessWidget {
|
||||
|
@ -14,7 +14,7 @@ class GeBlobScreen extends StatelessWidget {
|
||||
final String name;
|
||||
final String sha;
|
||||
final String path;
|
||||
GeBlobScreen(this.owner, this.name, this.sha, this.path);
|
||||
const GeBlobScreen(this.owner, this.name, this.sha, this.path);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -25,7 +25,7 @@ class GeBlobScreen extends StatelessWidget {
|
||||
final res = await auth.fetchGitee('/repos/$owner/$name/git/blobs/$sha');
|
||||
return GiteeBlob.fromJson(res).content;
|
||||
},
|
||||
action: ActionEntry(iconData: Ionicons.cog, url: '/choose-code-theme'),
|
||||
action: const ActionEntry(iconData: Ionicons.cog, url: '/choose-code-theme'),
|
||||
bodyBuilder: (content, _) {
|
||||
return BlobView(path, base64Text: content);
|
||||
},
|
||||
|
@ -14,7 +14,7 @@ class GeCommitScreen extends StatelessWidget {
|
||||
final String owner;
|
||||
final String name;
|
||||
final String sha;
|
||||
GeCommitScreen(this.owner, this.name, this.sha);
|
||||
const GeCommitScreen(this.owner, this.name, this.sha);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -43,7 +43,7 @@ class GeCommitScreen extends StatelessWidget {
|
||||
url: data.author!.avatarUrl,
|
||||
size: AvatarSize.extraSmall,
|
||||
),
|
||||
SizedBox(width: 4),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
'$owner / $name',
|
||||
style: TextStyle(
|
||||
@ -51,9 +51,9 @@ class GeCommitScreen extends StatelessWidget {
|
||||
color: theme.palette.secondaryText,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 4),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
'${sha.substring(0, 7)}',
|
||||
sha.substring(0, 7),
|
||||
style: TextStyle(
|
||||
fontSize: 17,
|
||||
color: theme.palette.tertiaryText,
|
||||
@ -62,10 +62,10 @@ class GeCommitScreen extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
data.commit!.message!,
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
|
@ -11,7 +11,7 @@ class GeCommitsScreen extends StatelessWidget {
|
||||
final String owner;
|
||||
final String name;
|
||||
final String? branch;
|
||||
GeCommitsScreen(this.owner, this.name, {this.branch});
|
||||
const GeCommitsScreen(this.owner, this.name, {this.branch});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -3,7 +3,6 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:git_touch/models/gitee.dart';
|
||||
import 'package:git_touch/models/theme.dart';
|
||||
import 'package:git_touch/scaffolds/list_stateful.dart';
|
||||
import 'package:git_touch/utils/utils.dart';
|
||||
import 'package:git_touch/widgets/app_bar_title.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:git_touch/models/auth.dart';
|
||||
@ -12,8 +11,9 @@ import 'package:flutter_gen/gen_l10n/S.dart';
|
||||
class GeContributorsScreen extends StatelessWidget {
|
||||
final String owner;
|
||||
final String name;
|
||||
GeContributorsScreen(this.owner, this.name);
|
||||
const GeContributorsScreen(this.owner, this.name);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListStatefulScaffold<GiteeContributor, int>(
|
||||
title: AppBarTitle(AppLocalizations.of(context)!.contributors),
|
||||
@ -40,7 +40,7 @@ class GeContributorsScreen extends StatelessWidget {
|
||||
padding: CommonStyle.padding,
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
SizedBox(width: 10),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
@ -58,7 +58,7 @@ class GeContributorsScreen extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 6),
|
||||
const SizedBox(height: 6),
|
||||
if (v.contributions != null)
|
||||
DefaultTextStyle(
|
||||
style: TextStyle(
|
||||
@ -66,7 +66,7 @@ class GeContributorsScreen extends StatelessWidget {
|
||||
fontSize: 16,
|
||||
),
|
||||
child: Text(
|
||||
"Contributions: " + v.contributions.toString()),
|
||||
"Contributions: ${v.contributions}"),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -13,8 +13,9 @@ class GeFilesScreen extends StatelessWidget {
|
||||
final String owner;
|
||||
final String name;
|
||||
final String pullNumber;
|
||||
GeFilesScreen(this.owner, this.name, this.pullNumber);
|
||||
const GeFilesScreen(this.owner, this.name, this.pullNumber);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListStatefulScaffold<GiteePullFile, int>(
|
||||
title: AppBarTitle(AppLocalizations.of(context)!.files),
|
||||
|
@ -19,7 +19,7 @@ class GeIssueScreen extends StatelessWidget {
|
||||
final String number;
|
||||
final bool isPr;
|
||||
|
||||
GeIssueScreen(this.owner, this.name, this.number, {this.isPr: false});
|
||||
const GeIssueScreen(this.owner, this.name, this.number, {this.isPr = false});
|
||||
|
||||
List<ActionItem> _buildCommentActionItem(
|
||||
BuildContext context, GiteeComment comment) {
|
||||
@ -88,7 +88,7 @@ class GeIssueScreen extends StatelessWidget {
|
||||
url: issue.user!.avatarUrl,
|
||||
size: AvatarSize.extraSmall,
|
||||
),
|
||||
SizedBox(width: 4),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
'$owner / $name',
|
||||
style: TextStyle(
|
||||
@ -96,7 +96,7 @@ class GeIssueScreen extends StatelessWidget {
|
||||
color: theme.palette.secondaryText,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 4),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
'#$number',
|
||||
style: TextStyle(
|
||||
@ -107,28 +107,28 @@ class GeIssueScreen extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
issue.title!,
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
const SizedBox(height: 8),
|
||||
StateLabel(
|
||||
issue.state == 'open'
|
||||
? StateLabelStatus.issueOpened
|
||||
: StateLabelStatus.issueClosed,
|
||||
small: true),
|
||||
SizedBox(height: 16),
|
||||
const SizedBox(height: 16),
|
||||
CommonStyle.border,
|
||||
],
|
||||
)),
|
||||
Column(children: [
|
||||
for (var comment in comments) ...[
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 10),
|
||||
padding: const EdgeInsets.only(left: 10),
|
||||
child: CommentItem(
|
||||
avatar: Avatar(
|
||||
url: comment.user!.avatarUrl,
|
||||
@ -142,7 +142,7 @@ class GeIssueScreen extends StatelessWidget {
|
||||
_buildCommentActionItem(context, comment),
|
||||
)),
|
||||
CommonStyle.border,
|
||||
SizedBox(height: 16),
|
||||
const SizedBox(height: 16),
|
||||
],
|
||||
]),
|
||||
]);
|
||||
|
@ -1,5 +1,4 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:git_touch/models/auth.dart';
|
||||
import 'package:git_touch/models/theme.dart';
|
||||
import 'package:git_touch/scaffolds/common.dart';
|
||||
@ -14,8 +13,8 @@ class GeIssueCommentScreen extends StatefulWidget {
|
||||
final bool isPr;
|
||||
final String body;
|
||||
final String id;
|
||||
GeIssueCommentScreen(this.owner, this.name, this.number,
|
||||
{this.isPr: false, this.body: '', this.id: ''});
|
||||
const GeIssueCommentScreen(this.owner, this.name, this.number,
|
||||
{this.isPr = false, this.body = '', this.id = ''});
|
||||
|
||||
@override
|
||||
_GeIssueCommentScreenState createState() => _GeIssueCommentScreenState();
|
||||
@ -23,7 +22,7 @@ class GeIssueCommentScreen extends StatefulWidget {
|
||||
|
||||
class _GeIssueCommentScreenState extends State<GeIssueCommentScreen> {
|
||||
bool isEdit = false;
|
||||
TextEditingController _controller = new TextEditingController();
|
||||
final TextEditingController _controller = TextEditingController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@ -52,7 +51,7 @@ class _GeIssueCommentScreenState extends State<GeIssueCommentScreen> {
|
||||
),
|
||||
),
|
||||
CupertinoButton.filled(
|
||||
child: Text('Comment'),
|
||||
child: const Text('Comment'),
|
||||
onPressed: () async {
|
||||
if (!isEdit) {
|
||||
await auth.fetchGitee(
|
||||
|
@ -1,5 +1,4 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:git_touch/models/auth.dart';
|
||||
import 'package:git_touch/models/gitee.dart';
|
||||
import 'package:git_touch/models/theme.dart';
|
||||
@ -11,7 +10,7 @@ import 'package:flutter_gen/gen_l10n/S.dart';
|
||||
class GeIssueFormScreen extends StatefulWidget {
|
||||
final String owner;
|
||||
final String name;
|
||||
GeIssueFormScreen(this.owner, this.name);
|
||||
const GeIssueFormScreen(this.owner, this.name);
|
||||
|
||||
@override
|
||||
_GeIssueFormScreenState createState() => _GeIssueFormScreenState();
|
||||
|
@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
|
||||
import 'package:git_touch/models/auth.dart';
|
||||
import 'package:git_touch/models/gitee.dart';
|
||||
import 'package:git_touch/scaffolds/list_stateful.dart';
|
||||
import 'package:git_touch/utils/utils.dart';
|
||||
import 'package:git_touch/widgets/action_entry.dart';
|
||||
import 'package:git_touch/widgets/app_bar_title.dart';
|
||||
import 'package:git_touch/widgets/issue_item.dart';
|
||||
@ -13,7 +12,7 @@ class GeIssuesScreen extends StatelessWidget {
|
||||
final String owner;
|
||||
final String name;
|
||||
final bool isPr;
|
||||
GeIssuesScreen(this.owner, this.name, {this.isPr = false});
|
||||
const GeIssuesScreen(this.owner, this.name, {this.isPr = false});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -37,7 +36,7 @@ class GeIssuesScreen extends StatelessWidget {
|
||||
author: p.user!.login,
|
||||
avatarUrl: p.user!.avatarUrl,
|
||||
commentCount: p.comments,
|
||||
subtitle: '#' + p.number!,
|
||||
subtitle: '#${p.number!}',
|
||||
title: p.title,
|
||||
updatedAt: DateTime.parse(p.updatedAt!),
|
||||
url: '/gitee/$owner/$name/issues/${p.number}',
|
||||
|
@ -19,7 +19,7 @@ class GePullScreen extends StatelessWidget {
|
||||
final String number;
|
||||
final bool isPr;
|
||||
|
||||
GePullScreen(this.owner, this.name, this.number, {this.isPr: false});
|
||||
const GePullScreen(this.owner, this.name, this.number, {this.isPr = false});
|
||||
|
||||
List<ActionItem> _buildCommentActionItem(
|
||||
BuildContext context, GiteeComment comment) {
|
||||
@ -96,8 +96,9 @@ class GePullScreen extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
LinkWidget(
|
||||
url: '/gitee/$owner/$name',
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 8),
|
||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
@ -109,7 +110,7 @@ class GePullScreen extends StatelessWidget {
|
||||
url: pull.user!.avatarUrl,
|
||||
size: AvatarSize.extraSmall,
|
||||
),
|
||||
SizedBox(width: 4),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
'$owner / $name',
|
||||
style: TextStyle(
|
||||
@ -117,7 +118,7 @@ class GePullScreen extends StatelessWidget {
|
||||
color: theme.palette.secondaryText,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 4),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
'#$number',
|
||||
style: TextStyle(
|
||||
@ -128,27 +129,27 @@ class GePullScreen extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
pull.title!,
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
const SizedBox(height: 8),
|
||||
StateLabel(
|
||||
pull.state == 'open'
|
||||
? StateLabelStatus.pullOpened
|
||||
: StateLabelStatus.pullClosed,
|
||||
small: true),
|
||||
SizedBox(height: 16),
|
||||
const SizedBox(height: 16),
|
||||
CommonStyle.border,
|
||||
CommonStyle.border,
|
||||
LinkWidget(
|
||||
url: '/gitee/$owner/$name/pulls/$number/files',
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 8),
|
||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
@ -164,15 +165,15 @@ class GePullScreen extends StatelessWidget {
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'+$additions',
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
color: Colors.green,
|
||||
fontSize: 15,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 2),
|
||||
const SizedBox(width: 2),
|
||||
Text(
|
||||
'-$deletions',
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
color: Colors.red,
|
||||
fontSize: 15,
|
||||
),
|
||||
@ -206,13 +207,13 @@ class GePullScreen extends StatelessWidget {
|
||||
'/gitee/$owner/$name/commits/${commit.sha}',
|
||||
child: Container(
|
||||
padding:
|
||||
EdgeInsets.symmetric(vertical: 8),
|
||||
const EdgeInsets.symmetric(vertical: 8),
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'${commit.sha!.substring(0, 7)}',
|
||||
commit.sha!.substring(0, 7),
|
||||
style: TextStyle(
|
||||
color: theme.palette.primary,
|
||||
fontSize: 17,
|
||||
@ -229,7 +230,6 @@ class GePullScreen extends StatelessWidget {
|
||||
)),
|
||||
]),
|
||||
),
|
||||
url: '/gitee/$owner/$name',
|
||||
),
|
||||
CommonStyle.border,
|
||||
],
|
||||
@ -237,7 +237,7 @@ class GePullScreen extends StatelessWidget {
|
||||
Column(children: [
|
||||
for (var comment in comments) ...[
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 10),
|
||||
padding: const EdgeInsets.only(left: 10),
|
||||
child: CommentItem(
|
||||
avatar: Avatar(
|
||||
url: comment.user!.avatarUrl,
|
||||
@ -251,7 +251,7 @@ class GePullScreen extends StatelessWidget {
|
||||
_buildCommentActionItem(context, comment),
|
||||
)),
|
||||
CommonStyle.border,
|
||||
SizedBox(height: 16),
|
||||
const SizedBox(height: 16),
|
||||
],
|
||||
]),
|
||||
]);
|
||||
|
@ -11,7 +11,7 @@ class GePullsScreen extends StatelessWidget {
|
||||
final String owner;
|
||||
final String name;
|
||||
final bool isPr;
|
||||
GePullsScreen(this.owner, this.name, {this.isPr = false});
|
||||
const GePullsScreen(this.owner, this.name, {this.isPr = false});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -31,7 +31,7 @@ class GePullsScreen extends StatelessWidget {
|
||||
author: p.user!.login,
|
||||
avatarUrl: p.user!.avatarUrl,
|
||||
commentCount: 0, // fix this
|
||||
subtitle: '#' + p.number.toString(),
|
||||
subtitle: '#${p.number}',
|
||||
title: p.title,
|
||||
updatedAt: DateTime.parse(p.updatedAt!),
|
||||
url: '/gitee/$owner/$name/pulls/${p.number}',
|
||||
|
@ -27,7 +27,7 @@ class GeRepoScreen extends StatelessWidget {
|
||||
final String owner;
|
||||
final String name;
|
||||
final String? branch;
|
||||
GeRepoScreen(this.owner, this.name, {this.branch});
|
||||
const GeRepoScreen(this.owner, this.name, {this.branch});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -40,11 +40,10 @@ class GeRepoScreen extends StatelessWidget {
|
||||
return GiteeRepo.fromJson(v);
|
||||
});
|
||||
|
||||
final md =
|
||||
() => auth.fetchGitee('/repos/$owner/$name/readme').then((v) {
|
||||
md() => auth.fetchGitee('/repos/$owner/$name/readme').then((v) {
|
||||
return (v['content'] as String?)?.base64ToUtf8 ?? '';
|
||||
});
|
||||
final html = () => md().then((v) async {
|
||||
html() => md().then((v) async {
|
||||
final res = await http.post(
|
||||
Uri.parse('${auth.activeAccount!.domain}/api/v5/markdown'),
|
||||
headers: {'Authorization': 'token ${auth.token}'},
|
||||
@ -97,7 +96,7 @@ class GeRepoScreen extends StatelessWidget {
|
||||
setData(t);
|
||||
},
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
const SizedBox(width: 8),
|
||||
MutationButton(
|
||||
active: t.item4.isStarred,
|
||||
text: t.item4.isStarred ? 'Unstar' : 'Star',
|
||||
@ -136,34 +135,32 @@ class GeRepoScreen extends StatelessWidget {
|
||||
items: [
|
||||
TableViewItem(
|
||||
leftIconData: Octicons.code,
|
||||
text: Text('Code'),
|
||||
text: const Text('Code'),
|
||||
rightWidget: Text(p.license ?? ''),
|
||||
url: '/gitee/$owner/$name/tree/${branch ?? p.defaultBranch}',
|
||||
),
|
||||
TableViewItem(
|
||||
leftIconData: Octicons.issue_opened,
|
||||
text: Text('Issues'),
|
||||
text: const Text('Issues'),
|
||||
rightWidget: Text(numberFormat.format(p.openIssuesCount)),
|
||||
url: '/gitee/$owner/$name/issues',
|
||||
),
|
||||
if (p.pullRequestsEnabled!)
|
||||
TableViewItem(
|
||||
leftIconData: Octicons.git_pull_request,
|
||||
text: Text('Pull requests'),
|
||||
text: const Text('Pull requests'),
|
||||
url: '/gitee/$owner/$name/pulls',
|
||||
),
|
||||
TableViewItem(
|
||||
leftIconData: Octicons.history,
|
||||
text: Text('Commits'),
|
||||
text: const Text('Commits'),
|
||||
url:
|
||||
'/gitee/$owner/$name/commits?branch=${branch ?? p.defaultBranch}',
|
||||
),
|
||||
TableViewItem(
|
||||
leftIconData: Octicons.git_branch,
|
||||
text: Text(AppLocalizations.of(context)!.branches),
|
||||
rightWidget: Text((branch ?? p.defaultBranch)! +
|
||||
' • ' +
|
||||
branches.length.toString()),
|
||||
rightWidget: Text('${(branch ?? p.defaultBranch)!} • ${branches.length}'),
|
||||
onTap: () async {
|
||||
if (branches.length < 2) return;
|
||||
|
||||
@ -187,7 +184,7 @@ class GeRepoScreen extends StatelessWidget {
|
||||
),
|
||||
TableViewItem(
|
||||
leftIconData: Octicons.organization,
|
||||
text: Text('Contributors'),
|
||||
text: const Text('Contributors'),
|
||||
url: '/gitee/$owner/$name/contributors'),
|
||||
],
|
||||
),
|
||||
|
@ -11,13 +11,13 @@ class GeReposScreen extends StatelessWidget {
|
||||
final String api;
|
||||
final String title;
|
||||
|
||||
GeReposScreen(String owner)
|
||||
const GeReposScreen(String owner)
|
||||
: api = '/users/$owner/repos',
|
||||
title = 'Repositories';
|
||||
GeReposScreen.star(String owner)
|
||||
const GeReposScreen.star(String owner)
|
||||
: api = '/users/$owner/starred',
|
||||
title = 'Stars';
|
||||
GeReposScreen.forks(String owner, String name)
|
||||
const GeReposScreen.forks(String owner, String name)
|
||||
: api = '/repos/$owner/$name/forks',
|
||||
title = 'Forks';
|
||||
|
||||
|
@ -22,7 +22,7 @@ class GeSearchScreen extends StatefulWidget {
|
||||
class _GeSearchScreenState extends State<GeSearchScreen> {
|
||||
int? _activeTab = 0;
|
||||
bool _loading = false;
|
||||
List<List> _payloads = [[], [], []];
|
||||
final List<List> _payloads = [[], [], []];
|
||||
|
||||
TextEditingController? _controller;
|
||||
String get _keyword => _controller!.text.trim();
|
||||
@ -79,7 +79,7 @@ class _GeSearchScreenState extends State<GeSearchScreen> {
|
||||
color: theme.palette.background,
|
||||
child: CupertinoTextField(
|
||||
prefix: Row(
|
||||
children: <Widget>[
|
||||
children: const <Widget>[
|
||||
SizedBox(width: 8),
|
||||
Icon(Octicons.search, size: 20, color: PrimerColors.gray400),
|
||||
],
|
||||
@ -132,7 +132,7 @@ class _GeSearchScreenState extends State<GeSearchScreen> {
|
||||
login: p.login,
|
||||
name: p.name,
|
||||
avatarUrl: p.avatarUrl,
|
||||
bio: Text(p.bio != null ? p.bio : p.htmlUrl),
|
||||
bio: Text(p.bio ?? p.htmlUrl),
|
||||
);
|
||||
default:
|
||||
return IssueItem(
|
||||
@ -160,7 +160,7 @@ class _GeSearchScreenState extends State<GeSearchScreen> {
|
||||
if (theme == AppThemeType.cupertino)
|
||||
Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 8),
|
||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||
child: CupertinoSlidingSegmentedControl(
|
||||
groupValue: _activeTab,
|
||||
onValueChanged: _onTabSwitch,
|
||||
@ -168,13 +168,13 @@ class _GeSearchScreenState extends State<GeSearchScreen> {
|
||||
key,
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
child: Text(text, style: TextStyle(fontSize: 14)),
|
||||
child: Text(text, style: const TextStyle(fontSize: 14)),
|
||||
))),
|
||||
),
|
||||
),
|
||||
),
|
||||
if (_loading)
|
||||
Loading()
|
||||
const Loading()
|
||||
else
|
||||
..._payloads[_activeTab!].map(_buildItem).toList(),
|
||||
],
|
||||
|
@ -14,7 +14,7 @@ class GeTreeScreen extends StatelessWidget {
|
||||
final String owner;
|
||||
final String name;
|
||||
final String sha;
|
||||
GeTreeScreen(this.owner, this.name, this.sha);
|
||||
const GeTreeScreen(this.owner, this.name, this.sha);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -17,7 +17,7 @@ import 'package:timeago/timeago.dart' as timeago;
|
||||
class GeUserScreen extends StatelessWidget {
|
||||
final String login;
|
||||
final bool isViewer;
|
||||
GeUserScreen(this.login, {this.isViewer = false});
|
||||
const GeUserScreen(this.login, {this.isViewer = false});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -35,7 +35,7 @@ class GeUserScreen extends StatelessWidget {
|
||||
},
|
||||
title: AppBarTitle(isViewer ? 'Me' : login),
|
||||
action: isViewer
|
||||
? ActionEntry(
|
||||
? const ActionEntry(
|
||||
iconData: Ionicons.cog,
|
||||
url: '/settings',
|
||||
)
|
||||
|
@ -10,19 +10,19 @@ class GeUsersScreen extends StatelessWidget {
|
||||
final String api;
|
||||
final String title;
|
||||
|
||||
GeUsersScreen.followers(String login)
|
||||
const GeUsersScreen.followers(String login)
|
||||
: api = '/users/$login/followers',
|
||||
title = 'Followers';
|
||||
GeUsersScreen.following(String login)
|
||||
const GeUsersScreen.following(String login)
|
||||
: api = '/users/$login/following',
|
||||
title = "Following";
|
||||
// GeUsersScreen.member(String login)
|
||||
// : api = '/orgs/$login/members',
|
||||
// title = "Members";
|
||||
GeUsersScreen.stargazers(String owner, String repo)
|
||||
const GeUsersScreen.stargazers(String owner, String repo)
|
||||
: api = '/repos/$owner/$repo/stargazers',
|
||||
title = 'Stargazers';
|
||||
GeUsersScreen.watchers(String owner, String repo)
|
||||
const GeUsersScreen.watchers(String owner, String repo)
|
||||
: api = '/repos/$owner/$repo/subscribers',
|
||||
title = 'Watchers';
|
||||
|
||||
|
@ -6,7 +6,6 @@ import 'package:git_touch/graphql/__generated__/github.var.gql.dart';
|
||||
import 'package:git_touch/graphql/__generated__/schema.schema.gql.dart';
|
||||
import 'package:git_touch/models/auth.dart';
|
||||
import 'package:git_touch/scaffolds/list_stateful.dart';
|
||||
import 'package:git_touch/utils/utils.dart';
|
||||
import 'package:git_touch/widgets/app_bar_title.dart';
|
||||
import 'package:git_touch/widgets/commit_item.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
@ -16,15 +15,15 @@ class GhCommits extends StatelessWidget {
|
||||
final String owner;
|
||||
final String name;
|
||||
final String? branch;
|
||||
GhCommits(this.owner, this.name, {this.branch});
|
||||
const GhCommits(this.owner, this.name, {this.branch});
|
||||
|
||||
Widget _buildStatus(GStatusState? state) {
|
||||
const size = 18.0;
|
||||
switch (state) {
|
||||
case GStatusState.SUCCESS:
|
||||
return Icon(Octicons.check, color: GithubPalette.open, size: size);
|
||||
return const Icon(Octicons.check, color: GithubPalette.open, size: size);
|
||||
case GStatusState.FAILURE:
|
||||
return Icon(Octicons.x, color: GithubPalette.closed, size: size);
|
||||
return const Icon(Octicons.x, color: GithubPalette.closed, size: size);
|
||||
default:
|
||||
return Container();
|
||||
}
|
||||
@ -65,7 +64,7 @@ class GhCommits extends StatelessWidget {
|
||||
widgets: p.status == null
|
||||
? null
|
||||
: [
|
||||
SizedBox(width: 4),
|
||||
const SizedBox(width: 4),
|
||||
_buildStatus(p.status!.state),
|
||||
],
|
||||
);
|
||||
|
@ -14,8 +14,9 @@ class GhComparisonScreen extends StatelessWidget {
|
||||
final String name;
|
||||
final String before;
|
||||
final String head;
|
||||
GhComparisonScreen(this.owner, this.name, this.before, this.head);
|
||||
const GhComparisonScreen(this.owner, this.name, this.before, this.head);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return RefreshStatefulScaffold(
|
||||
title: AppBarTitle(AppLocalizations.of(context)!.files),
|
||||
|
@ -11,8 +11,9 @@ import 'package:flutter_gen/gen_l10n/S.dart';
|
||||
class GhContributorsScreen extends StatelessWidget {
|
||||
final String owner;
|
||||
final String name;
|
||||
GhContributorsScreen(this.owner, this.name);
|
||||
const GhContributorsScreen(this.owner, this.name);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListStatefulScaffold<GithubContributorItem, int>(
|
||||
title: AppBarTitle(AppLocalizations.of(context)!.contributors),
|
||||
|
@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:git_touch/models/github.dart';
|
||||
import 'package:git_touch/scaffolds/list_stateful.dart';
|
||||
import 'package:git_touch/utils/utils.dart';
|
||||
import 'package:git_touch/widgets/app_bar_title.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:git_touch/widgets/event_item.dart';
|
||||
@ -11,7 +10,7 @@ import 'package:flutter_gen/gen_l10n/S.dart';
|
||||
|
||||
class GhEventsScreen extends StatelessWidget {
|
||||
final String login;
|
||||
GhEventsScreen(this.login);
|
||||
const GhEventsScreen(this.login);
|
||||
|
||||
@override
|
||||
Widget build(context) {
|
||||
|
@ -13,8 +13,9 @@ class GhFilesScreen extends StatelessWidget {
|
||||
final String owner;
|
||||
final String name;
|
||||
final int pullNumber;
|
||||
GhFilesScreen(this.owner, this.name, this.pullNumber);
|
||||
const GhFilesScreen(this.owner, this.name, this.pullNumber);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListStatefulScaffold<GithubFilesItem, int>(
|
||||
title: AppBarTitle(AppLocalizations.of(context)!.files),
|
||||
|
@ -12,13 +12,13 @@ class GistObjectScreen extends StatelessWidget {
|
||||
final String? raw;
|
||||
final String? content;
|
||||
|
||||
GistObjectScreen(this.login, this.id, this.file, {this.raw, this.content});
|
||||
const GistObjectScreen(this.login, this.id, this.file, {this.raw, this.content});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CommonScaffold(
|
||||
title: AppBarTitle(file),
|
||||
action: ActionEntry(
|
||||
action: const ActionEntry(
|
||||
iconData: Ionicons.cog,
|
||||
url: '/choose-code-theme',
|
||||
),
|
||||
|
@ -13,7 +13,7 @@ import 'package:git_touch/graphql/__generated__/github.req.gql.dart';
|
||||
|
||||
class GhGistsScreen extends StatelessWidget {
|
||||
final String login;
|
||||
GhGistsScreen(this.login);
|
||||
const GhGistsScreen(this.login);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -15,7 +15,7 @@ import 'package:flutter_gen/gen_l10n/S.dart';
|
||||
class GhGistsFilesScreen extends StatelessWidget {
|
||||
final String id;
|
||||
final String login;
|
||||
GhGistsFilesScreen(this.login, this.id);
|
||||
const GhGistsFilesScreen(this.login, this.id);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -1,6 +1,5 @@
|
||||
import 'package:ferry/ferry.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:git_touch/graphql/__generated__/github.data.gql.dart';
|
||||
import 'package:git_touch/graphql/__generated__/github.req.gql.dart';
|
||||
import 'package:git_touch/graphql/__generated__/github.var.gql.dart';
|
||||
@ -21,7 +20,7 @@ class GhIssueScreen extends StatelessWidget {
|
||||
final String owner;
|
||||
final String name;
|
||||
final int number;
|
||||
GhIssueScreen(this.owner, this.name, this.number);
|
||||
const GhIssueScreen(this.owner, this.name, this.number);
|
||||
|
||||
Widget _buildHeader(
|
||||
BuildContext context, {
|
||||
@ -45,7 +44,7 @@ class GhIssueScreen extends StatelessWidget {
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Avatar(url: avatarUrl, size: AvatarSize.extraSmall),
|
||||
SizedBox(width: 4),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
'$owner / $name',
|
||||
style: TextStyle(
|
||||
@ -53,7 +52,7 @@ class GhIssueScreen extends StatelessWidget {
|
||||
color: theme.palette.secondaryText,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 4),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
'#$number',
|
||||
style: TextStyle(
|
||||
@ -64,20 +63,20 @@ class GhIssueScreen extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
const SizedBox(height: 8),
|
||||
StateLabel(status, small: true),
|
||||
SizedBox(height: 8),
|
||||
const SizedBox(height: 8),
|
||||
CommonStyle.border,
|
||||
...extraWidgets,
|
||||
SizedBox(height: 8),
|
||||
const SizedBox(height: 8),
|
||||
body,
|
||||
],
|
||||
),
|
||||
@ -218,8 +217,9 @@ class GhIssueScreen extends StatelessWidget {
|
||||
body: CommentItem.gql(pr, pr, (key) {}),
|
||||
extraWidgets: [
|
||||
LinkWidget(
|
||||
url: '/github/$owner/$name/pull/$number/files',
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 8),
|
||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
@ -231,13 +231,13 @@ class GhIssueScreen extends StatelessWidget {
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Text('+${pr.additions}',
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
color: Colors.green,
|
||||
fontSize: 15,
|
||||
)),
|
||||
SizedBox(width: 2),
|
||||
const SizedBox(width: 2),
|
||||
Text('-${pr.deletions}',
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
color: Colors.red,
|
||||
fontSize: 15,
|
||||
)),
|
||||
@ -248,7 +248,6 @@ class GhIssueScreen extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
url: '/github/$owner/$name/pull/$number/files',
|
||||
),
|
||||
CommonStyle.border,
|
||||
],
|
||||
@ -280,8 +279,8 @@ class GhIssueScreen extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
},
|
||||
onLoadMore: (_cursor) async {
|
||||
final res = await _queryIssue(context, cursor: _cursor);
|
||||
onLoadMore: (cursor) async {
|
||||
final res = await _queryIssue(context, cursor: cursor);
|
||||
if (res.issueOrPullRequest!.G__typename == 'Issue') {
|
||||
final issue = res.issueOrPullRequest
|
||||
as GIssueData_repository_issueOrPullRequest__asIssue;
|
||||
|
@ -1,5 +1,4 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:git_touch/models/auth.dart';
|
||||
import 'package:git_touch/models/theme.dart';
|
||||
import 'package:git_touch/scaffolds/common.dart';
|
||||
@ -11,7 +10,7 @@ import 'package:flutter_gen/gen_l10n/S.dart';
|
||||
class GhIssueFormScreen extends StatefulWidget {
|
||||
final String owner;
|
||||
final String name;
|
||||
GhIssueFormScreen(this.owner, this.name);
|
||||
const GhIssueFormScreen(this.owner, this.name);
|
||||
|
||||
@override
|
||||
_GhIssueFormScreenState createState() => _GhIssueFormScreenState();
|
||||
|
@ -5,7 +5,6 @@ import 'package:git_touch/graphql/__generated__/github.req.gql.dart';
|
||||
import 'package:git_touch/graphql/__generated__/github.var.gql.dart';
|
||||
import 'package:git_touch/models/auth.dart';
|
||||
import 'package:git_touch/scaffolds/list_stateful.dart';
|
||||
import 'package:git_touch/utils/utils.dart';
|
||||
import 'package:git_touch/widgets/action_entry.dart';
|
||||
import 'package:git_touch/widgets/app_bar_title.dart';
|
||||
import 'package:git_touch/widgets/issue_item.dart';
|
||||
@ -16,7 +15,7 @@ import 'package:flutter_gen/gen_l10n/S.dart';
|
||||
class GhIssuesScreen extends StatelessWidget {
|
||||
final String owner;
|
||||
final String name;
|
||||
GhIssuesScreen(this.owner, this.name);
|
||||
const GhIssuesScreen(this.owner, this.name);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -46,7 +45,7 @@ class GhIssuesScreen extends StatelessWidget {
|
||||
author: p.author?.login,
|
||||
avatarUrl: p.author?.avatarUrl,
|
||||
commentCount: p.comments.totalCount,
|
||||
subtitle: '#' + p.number.toString(),
|
||||
subtitle: '#${p.number}',
|
||||
title: p.title,
|
||||
updatedAt: p.updatedAt,
|
||||
labels: p.labels!.nodes!.isEmpty
|
||||
|
@ -3,7 +3,6 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:git_touch/models/github.dart';
|
||||
import 'package:git_touch/models/notification.dart';
|
||||
import 'package:git_touch/scaffolds/list_stateful.dart';
|
||||
import 'package:git_touch/utils/utils.dart';
|
||||
import 'package:git_touch/widgets/app_bar_title.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:git_touch/widgets/event_item.dart';
|
||||
|
@ -30,21 +30,21 @@ class GhNotificationScreenState extends State<GhNotificationScreen> {
|
||||
context.read<NotificationModel>().setCount(ns.length);
|
||||
}
|
||||
|
||||
Map<String, NotificationGroup> _groupMap = {};
|
||||
Map<String, NotificationGroup> groupMap = {};
|
||||
|
||||
ns.forEach((item) {
|
||||
for (var item in ns) {
|
||||
final repo = item.repository!.fullName ?? ''; // TODO: nullable
|
||||
if (_groupMap[repo] == null) {
|
||||
_groupMap[repo] = NotificationGroup(repo);
|
||||
if (groupMap[repo] == null) {
|
||||
groupMap[repo] = NotificationGroup(repo);
|
||||
}
|
||||
|
||||
_groupMap[repo]!.items.add(item);
|
||||
});
|
||||
groupMap[repo]!.items.add(item);
|
||||
}
|
||||
|
||||
if (_groupMap.isNotEmpty) {
|
||||
if (groupMap.isNotEmpty) {
|
||||
// query state of issues and pull requests
|
||||
var schema = '{';
|
||||
_groupMap.forEach((repo, group) {
|
||||
groupMap.forEach((repo, group) {
|
||||
// Check if issue and pull request exist
|
||||
if (group.items.where((item) {
|
||||
return item.subject!.type == 'Issue' ||
|
||||
@ -56,7 +56,7 @@ class GhNotificationScreenState extends State<GhNotificationScreen> {
|
||||
schema +=
|
||||
'${group.key}: repository(owner: "${group.owner}", name: "${group.name}") {';
|
||||
|
||||
group.items.forEach((item) {
|
||||
for (var item in group.items) {
|
||||
switch (item.subject!.type) {
|
||||
case 'Issue':
|
||||
schema += '''
|
||||
@ -73,31 +73,31 @@ ${item.key}: pullRequest(number: ${item.subject!.number}) {
|
||||
''';
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
schema += '}';
|
||||
});
|
||||
schema += '}';
|
||||
|
||||
if (schema == '{}') return _groupMap;
|
||||
if (schema == '{}') return groupMap;
|
||||
|
||||
// Fimber.d(schema);
|
||||
var data = await context.read<AuthModel>().query(schema);
|
||||
_groupMap.forEach((repo, group) {
|
||||
group.items.forEach((item) {
|
||||
groupMap.forEach((repo, group) {
|
||||
for (var item in group.items) {
|
||||
var groupData = data[group.key];
|
||||
if (groupData == null) return;
|
||||
if (groupData == null) continue;
|
||||
|
||||
var itemData = data[group.key][item.key];
|
||||
if (itemData != null) {
|
||||
item.state = itemData['state'];
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
// Fimber.d(data);
|
||||
}
|
||||
|
||||
return _groupMap;
|
||||
return groupMap;
|
||||
}
|
||||
|
||||
Widget _buildGroupItem(
|
||||
@ -168,7 +168,7 @@ ${item.key}: pullRequest(number: ${item.subject!.number}) {
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
Padding(padding: EdgeInsets.only(top: 10)),
|
||||
const Padding(padding: EdgeInsets.only(top: 10)),
|
||||
...groupMap.entries
|
||||
.map((entry) => _buildGroupItem(context, entry, groupMap))
|
||||
.toList()
|
||||
|
@ -17,7 +17,7 @@ class GhObjectScreen extends StatelessWidget {
|
||||
final String ref;
|
||||
final String? path;
|
||||
final String? raw;
|
||||
GhObjectScreen(this.owner, this.name, this.ref, {this.path, this.raw});
|
||||
const GhObjectScreen(this.owner, this.name, this.ref, {this.path, this.raw});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -49,7 +49,7 @@ class GhObjectScreen extends StatelessWidget {
|
||||
},
|
||||
actionBuilder: (data, _) {
|
||||
if (data.isFile) {
|
||||
return ActionEntry(
|
||||
return const ActionEntry(
|
||||
iconData: Ionicons.cog,
|
||||
url: '/choose-code-theme',
|
||||
);
|
||||
|
@ -15,7 +15,7 @@ import 'package:flutter_gen/gen_l10n/S.dart';
|
||||
/// So we use RESTful API here for repos of org
|
||||
class GhOrgReposScreen extends StatelessWidget {
|
||||
final String owner;
|
||||
GhOrgReposScreen(this.owner);
|
||||
const GhOrgReposScreen(this.owner);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -10,8 +10,9 @@ import 'package:flutter_gen/gen_l10n/S.dart';
|
||||
|
||||
class GhUserOrganizationScreen extends StatelessWidget {
|
||||
final String login;
|
||||
GhUserOrganizationScreen(this.login);
|
||||
const GhUserOrganizationScreen(this.login);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListStatefulScaffold<GithubUserOrganizationItem, int>(
|
||||
title: AppBarTitle(AppLocalizations.of(context)!.organizations),
|
||||
|
@ -14,7 +14,7 @@ import 'package:flutter_gen/gen_l10n/S.dart';
|
||||
class GhPullsScreen extends StatelessWidget {
|
||||
final String owner;
|
||||
final String name;
|
||||
GhPullsScreen(this.owner, this.name);
|
||||
const GhPullsScreen(this.owner, this.name);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -41,7 +41,7 @@ class GhPullsScreen extends StatelessWidget {
|
||||
author: p.author?.login,
|
||||
avatarUrl: p.author?.avatarUrl,
|
||||
commentCount: p.comments.totalCount,
|
||||
subtitle: '#' + p.number.toString(),
|
||||
subtitle: '#${p.number}',
|
||||
title: p.title,
|
||||
updatedAt: p.updatedAt,
|
||||
labels: p.labels!.nodes!.isEmpty
|
||||
|
@ -13,13 +13,13 @@ import 'package:git_touch/graphql/__generated__/github.req.gql.dart';
|
||||
class GhReleasesScreen extends StatelessWidget {
|
||||
final String owner;
|
||||
final String name;
|
||||
GhReleasesScreen(this.owner, this.name);
|
||||
const GhReleasesScreen(this.owner, this.name);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListStatefulScaffold<GReleasesData_repository_releases_nodes,
|
||||
String?>(
|
||||
title: AppBarTitle("Releases"),
|
||||
title: const AppBarTitle("Releases"),
|
||||
fetch: (page) async {
|
||||
final req = GReleasesReq((b) => b
|
||||
..vars.owner = owner
|
||||
|
@ -29,7 +29,7 @@ class GhRepoScreen extends StatelessWidget {
|
||||
final String owner;
|
||||
final String name;
|
||||
final String? branch;
|
||||
GhRepoScreen(this.owner, this.name, {this.branch});
|
||||
const GhRepoScreen(this.owner, this.name, {this.branch});
|
||||
|
||||
String _buildWatchState(GSubscriptionState? state) {
|
||||
switch (state) {
|
||||
@ -65,7 +65,7 @@ class GhRepoScreen extends StatelessWidget {
|
||||
.getJSON('/repos/$owner/$name/stats/contributors')
|
||||
.then((v) => (v as List).length);
|
||||
|
||||
final readmeFactory = (String acceptHeader) {
|
||||
readmeFactory(String acceptHeader) {
|
||||
return () {
|
||||
return ghClient.request(
|
||||
'GET',
|
||||
@ -78,7 +78,7 @@ class GhRepoScreen extends StatelessWidget {
|
||||
return '';
|
||||
});
|
||||
};
|
||||
};
|
||||
}
|
||||
final readmeData = MarkdownViewData(
|
||||
context,
|
||||
md: readmeFactory('application/vnd.github.v3.raw'),
|
||||
@ -93,8 +93,7 @@ class GhRepoScreen extends StatelessWidget {
|
||||
title: AppLocalizations.of(context)!.repositoryActions,
|
||||
items: [
|
||||
ActionItem(
|
||||
text: AppLocalizations.of(context)!.projects +
|
||||
'(${repo.projects.totalCount})',
|
||||
text: '${AppLocalizations.of(context)!.projects}(${repo.projects.totalCount})',
|
||||
url: repo.projectsUrl,
|
||||
),
|
||||
...ActionItem.getUrlActions(repo.url),
|
||||
@ -165,7 +164,7 @@ class GhRepoScreen extends StatelessWidget {
|
||||
]);
|
||||
},
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
const SizedBox(width: 8),
|
||||
MutationButton(
|
||||
active: repo.viewerHasStarred,
|
||||
text: repo.viewerHasStarred ? 'Unstar' : 'Star',
|
||||
@ -275,9 +274,7 @@ class GhRepoScreen extends StatelessWidget {
|
||||
TableViewItem(
|
||||
leftIconData: Octicons.git_branch,
|
||||
text: Text(AppLocalizations.of(context)!.branches),
|
||||
rightWidget: Text(ref.name +
|
||||
' • ' +
|
||||
numberFormat.format(repo.refs!.totalCount)),
|
||||
rightWidget: Text('${ref.name} • ${numberFormat.format(repo.refs!.totalCount)}'),
|
||||
onTap: () async {
|
||||
final refs = repo.refs!.nodes!;
|
||||
if (refs.length < 2) return;
|
||||
|
@ -12,12 +12,12 @@ import 'package:timeago/timeago.dart' as timeago;
|
||||
|
||||
class GhRepos extends StatelessWidget {
|
||||
final String login;
|
||||
GhRepos(this.login);
|
||||
const GhRepos(this.login);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListStatefulScaffold<GReposRepoItem, String?>(
|
||||
title: AppBarTitle('Repositories'),
|
||||
title: const AppBarTitle('Repositories'),
|
||||
fetch: (cursor) async {
|
||||
final auth = context.read<AuthModel>();
|
||||
final req = GReposReq((b) {
|
||||
@ -43,12 +43,12 @@ class GhRepos extends StatelessWidget {
|
||||
|
||||
class GhStars extends StatelessWidget {
|
||||
final String login;
|
||||
GhStars(this.login);
|
||||
const GhStars(this.login);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListStatefulScaffold<GReposRepoItem, String?>(
|
||||
title: AppBarTitle('Stars'),
|
||||
title: const AppBarTitle('Stars'),
|
||||
fetch: (cursor) async {
|
||||
final auth = context.read<AuthModel>();
|
||||
final req = GStarsReq((b) {
|
||||
|
@ -21,7 +21,7 @@ class GhSearchScreen extends StatefulWidget {
|
||||
class _GhSearchScreenState extends State<GhSearchScreen> {
|
||||
int? _activeTab = 0;
|
||||
bool _loading = false;
|
||||
List<List?> _payloads = [[], [], []];
|
||||
final List<List?> _payloads = [[], [], []];
|
||||
|
||||
TextEditingController? _controller;
|
||||
|
||||
@ -121,7 +121,7 @@ class _GhSearchScreenState extends State<GhSearchScreen> {
|
||||
color: theme.palette.background,
|
||||
child: CupertinoTextField(
|
||||
prefix: Row(
|
||||
children: <Widget>[
|
||||
children: const <Widget>[
|
||||
SizedBox(width: 8),
|
||||
Icon(Octicons.search, size: 20, color: PrimerColors.gray400),
|
||||
],
|
||||
@ -199,10 +199,10 @@ class _GhSearchScreenState extends State<GhSearchScreen> {
|
||||
author: p['author']['login'],
|
||||
avatarUrl: p['author']['avatarUrl'],
|
||||
commentCount: p['comments']['totalCount'],
|
||||
subtitle: '#' + p['number'].toString(),
|
||||
subtitle: '#${p['number']}',
|
||||
title: p['title'],
|
||||
updatedAt: DateTime.parse(p['updatedAt']),
|
||||
url: '/github' + Uri.parse(p['url']).path,
|
||||
url: '/github${Uri.parse(p['url']).path}',
|
||||
isPr: p['__typename'] == 'PullRequest',
|
||||
);
|
||||
}
|
||||
@ -220,7 +220,7 @@ class _GhSearchScreenState extends State<GhSearchScreen> {
|
||||
if (theme == AppThemeType.cupertino)
|
||||
Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 8),
|
||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||
child: CupertinoSlidingSegmentedControl(
|
||||
groupValue: _activeTab,
|
||||
onValueChanged: _onTabSwitch,
|
||||
@ -228,13 +228,13 @@ class _GhSearchScreenState extends State<GhSearchScreen> {
|
||||
key,
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
child: Text(text, style: TextStyle(fontSize: 14)),
|
||||
child: Text(text, style: const TextStyle(fontSize: 14)),
|
||||
))),
|
||||
),
|
||||
),
|
||||
),
|
||||
if (_loading)
|
||||
Loading()
|
||||
const Loading()
|
||||
else
|
||||
..._payloads[_activeTab!]!.map(_buildItem).toList(),
|
||||
],
|
||||
|
@ -13,6 +13,7 @@ import 'package:flutter_gen/gen_l10n/S.dart';
|
||||
class GhTrendingScreen extends StatelessWidget {
|
||||
static final trending = GithubTrending(prefix: 'https://gtrend.yapie.me');
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return TabStatefulScaffold<List>(
|
||||
title: AppBarTitle(AppLocalizations.of(context)!.trending),
|
||||
@ -67,7 +68,7 @@ class GhTrendingScreen extends StatelessWidget {
|
||||
size: 17,
|
||||
color: theme.palette.secondaryText,
|
||||
),
|
||||
SizedBox(width: 4),
|
||||
const SizedBox(width: 4),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'${v.username} / ${v.repo!.name}',
|
||||
|
@ -139,7 +139,7 @@ class _User extends StatelessWidget {
|
||||
leftIconData: Octicons.organization,
|
||||
text: TextWithAt(
|
||||
text: p!.company!,
|
||||
linkFactory: (text) => '/github/' + text.substring(1),
|
||||
linkFactory: (text) => '/github/${text.substring(1)}',
|
||||
style: TextStyle(fontSize: 17, color: theme.palette.text),
|
||||
oneLine: true,
|
||||
),
|
||||
@ -149,8 +149,7 @@ class _User extends StatelessWidget {
|
||||
leftIconData: Octicons.location,
|
||||
text: Text(p!.location!),
|
||||
onTap: () {
|
||||
launchStringUrl('https://www.google.com/maps/place/' +
|
||||
p!.location!.replaceAll(RegExp(r'\s+'), ''));
|
||||
launchStringUrl('https://www.google.com/maps/place/${p!.location!.replaceAll(RegExp(r'\s+'), '')}');
|
||||
},
|
||||
),
|
||||
if (isNotNullOrEmpty(p!.email))
|
||||
@ -158,7 +157,7 @@ class _User extends StatelessWidget {
|
||||
leftIconData: Octicons.mail,
|
||||
text: Text(p!.email),
|
||||
onTap: () {
|
||||
launchStringUrl('mailto:' + p!.email);
|
||||
launchStringUrl('mailto:${p!.email}');
|
||||
},
|
||||
),
|
||||
if (isNotNullOrEmpty(p!.websiteUrl))
|
||||
@ -188,7 +187,7 @@ class _User extends StatelessWidget {
|
||||
|
||||
class _Org extends StatelessWidget {
|
||||
final GUserData_repositoryOwner__asOrganization? p;
|
||||
_Org(this.p);
|
||||
const _Org(this.p);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -227,8 +226,7 @@ class _Org extends StatelessWidget {
|
||||
leftIconData: Octicons.location,
|
||||
text: Text(p!.location!),
|
||||
onTap: () {
|
||||
launchStringUrl('https://www.google.com/maps/place/' +
|
||||
p!.location!.replaceAll(RegExp(r'\s+'), ''));
|
||||
launchStringUrl('https://www.google.com/maps/place/${p!.location!.replaceAll(RegExp(r'\s+'), '')}');
|
||||
},
|
||||
),
|
||||
if (isNotNullOrEmpty(p!.email))
|
||||
@ -236,7 +234,7 @@ class _Org extends StatelessWidget {
|
||||
leftIconData: Octicons.mail,
|
||||
text: Text(p!.email!),
|
||||
onTap: () {
|
||||
launchStringUrl('mailto:' + p!.email!);
|
||||
launchStringUrl('mailto:${p!.email!}');
|
||||
},
|
||||
),
|
||||
if (isNotNullOrEmpty(p!.websiteUrl))
|
||||
@ -276,7 +274,7 @@ class GhViewer extends StatelessWidget {
|
||||
return res.data!.viewer;
|
||||
},
|
||||
title: AppBarTitle(AppLocalizations.of(context)!.me),
|
||||
action: ActionEntry(
|
||||
action: const ActionEntry(
|
||||
iconData: Ionicons.cog,
|
||||
url: '/settings',
|
||||
),
|
||||
@ -289,7 +287,7 @@ class GhViewer extends StatelessWidget {
|
||||
|
||||
class GhUser extends StatelessWidget {
|
||||
final String login;
|
||||
GhUser(this.login);
|
||||
const GhUser(this.login);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -11,12 +11,12 @@ import 'package:provider/provider.dart';
|
||||
|
||||
class GhFollowers extends StatelessWidget {
|
||||
final String login;
|
||||
GhFollowers(this.login);
|
||||
const GhFollowers(this.login);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListStatefulScaffold<GUserItem, String?>(
|
||||
title: AppBarTitle('Followers'),
|
||||
title: const AppBarTitle('Followers'),
|
||||
fetch: (cursor) async {
|
||||
final auth = context.read<AuthModel>();
|
||||
final req = GFollowersReq((b) {
|
||||
@ -41,12 +41,12 @@ class GhFollowers extends StatelessWidget {
|
||||
|
||||
class GhFollowing extends StatelessWidget {
|
||||
final String login;
|
||||
GhFollowing(this.login);
|
||||
const GhFollowing(this.login);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListStatefulScaffold<GUserItem, String?>(
|
||||
title: AppBarTitle('Following'),
|
||||
title: const AppBarTitle('Following'),
|
||||
fetch: (cursor) async {
|
||||
final auth = context.read<AuthModel>();
|
||||
final req = GFollowingReq((b) {
|
||||
@ -71,12 +71,12 @@ class GhFollowing extends StatelessWidget {
|
||||
|
||||
class GhMembers extends StatelessWidget {
|
||||
final String login;
|
||||
GhMembers(this.login);
|
||||
const GhMembers(this.login);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListStatefulScaffold<GUserItem, String?>(
|
||||
title: AppBarTitle('Members'),
|
||||
title: const AppBarTitle('Members'),
|
||||
fetch: (cursor) async {
|
||||
final auth = context.read<AuthModel>();
|
||||
final req = GMembersReq((b) {
|
||||
@ -102,12 +102,12 @@ class GhMembers extends StatelessWidget {
|
||||
class GhWachers extends StatelessWidget {
|
||||
final String owner;
|
||||
final String name;
|
||||
GhWachers(this.owner, this.name);
|
||||
const GhWachers(this.owner, this.name);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListStatefulScaffold<GUserItem, String?>(
|
||||
title: AppBarTitle('Wachers'),
|
||||
title: const AppBarTitle('Wachers'),
|
||||
fetch: (cursor) async {
|
||||
final auth = context.read<AuthModel>();
|
||||
final req = GWatchersReq((b) {
|
||||
@ -134,12 +134,12 @@ class GhWachers extends StatelessWidget {
|
||||
class GhStargazers extends StatelessWidget {
|
||||
final String owner;
|
||||
final String name;
|
||||
GhStargazers(this.owner, this.name);
|
||||
const GhStargazers(this.owner, this.name);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListStatefulScaffold<GUserItem, String?>(
|
||||
title: AppBarTitle('Stargazers'),
|
||||
title: const AppBarTitle('Stargazers'),
|
||||
fetch: (cursor) async {
|
||||
final auth = context.read<AuthModel>();
|
||||
final req = GStargazersReq((b) {
|
||||
|
@ -12,7 +12,7 @@ class GlBlobScreen extends StatelessWidget {
|
||||
final int id;
|
||||
final String ref;
|
||||
final String? path;
|
||||
GlBlobScreen(this.id, this.ref, {this.path});
|
||||
const GlBlobScreen(this.id, this.ref, {this.path});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -24,7 +24,7 @@ class GlBlobScreen extends StatelessWidget {
|
||||
'/projects/$id/repository/files/${path!.urlencode}?ref=$ref');
|
||||
return GitlabBlob.fromJson(res);
|
||||
},
|
||||
action: ActionEntry(iconData: Ionicons.cog, url: '/choose-code-theme'),
|
||||
action: const ActionEntry(iconData: Ionicons.cog, url: '/choose-code-theme'),
|
||||
bodyBuilder: (data, _) {
|
||||
return BlobView(path, base64Text: data.content);
|
||||
},
|
||||
|
@ -15,7 +15,7 @@ import 'package:flutter_gen/gen_l10n/S.dart';
|
||||
class GlCommitScreen extends StatelessWidget {
|
||||
final String id;
|
||||
final String? sha;
|
||||
GlCommitScreen(this.id, {this.sha});
|
||||
const GlCommitScreen(this.id, {this.sha});
|
||||
|
||||
Future<List<GitlabDiff>> _query(BuildContext context) async {
|
||||
final auth = context.read<AuthModel>();
|
||||
|
@ -11,7 +11,7 @@ class GlCommitsScreen extends StatelessWidget {
|
||||
final String id;
|
||||
final String? prefix;
|
||||
final String? branch;
|
||||
GlCommitsScreen(this.id, {this.prefix, this.branch});
|
||||
const GlCommitsScreen(this.id, {this.prefix, this.branch});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -14,7 +14,7 @@ import 'package:flutter_gen/gen_l10n/S.dart';
|
||||
|
||||
class GlGroupScreen extends StatelessWidget {
|
||||
final int id;
|
||||
GlGroupScreen(this.id);
|
||||
const GlGroupScreen(this.id);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -14,13 +14,13 @@ class GlIssueScreen extends StatelessWidget {
|
||||
final int iid;
|
||||
final bool isMr;
|
||||
|
||||
GlIssueScreen(this.projectId, this.iid, {this.isMr = false});
|
||||
const GlIssueScreen(this.projectId, this.iid, {this.isMr = false});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return RefreshStatefulScaffold<
|
||||
Tuple3<GitlabTodoTarget, Iterable<GitlabIssueNote>, List?>>(
|
||||
title: Text(AppLocalizations.of(context)!.issue + '#$iid'),
|
||||
title: Text('${AppLocalizations.of(context)!.issue}#$iid'),
|
||||
fetch: () async {
|
||||
final type = isMr ? 'merge_requests' : 'issues';
|
||||
final auth = context.read<AuthModel>();
|
||||
|
@ -1,5 +1,4 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:git_touch/models/auth.dart';
|
||||
import 'package:git_touch/models/gitlab.dart';
|
||||
import 'package:git_touch/models/theme.dart';
|
||||
@ -10,7 +9,7 @@ import 'package:flutter_gen/gen_l10n/S.dart';
|
||||
|
||||
class GlIssueFormScreen extends StatefulWidget {
|
||||
final int id;
|
||||
GlIssueFormScreen(this.id);
|
||||
const GlIssueFormScreen(this.id);
|
||||
|
||||
@override
|
||||
_GlIssueFormScreenState createState() => _GlIssueFormScreenState();
|
||||
|
@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
|
||||
import 'package:git_touch/models/auth.dart';
|
||||
import 'package:git_touch/models/gitlab.dart';
|
||||
import 'package:git_touch/scaffolds/list_stateful.dart';
|
||||
import 'package:git_touch/utils/utils.dart';
|
||||
import 'package:git_touch/widgets/action_entry.dart';
|
||||
import 'package:git_touch/widgets/app_bar_title.dart';
|
||||
import 'package:git_touch/widgets/issue_item.dart';
|
||||
@ -13,7 +12,7 @@ import 'package:flutter_gen/gen_l10n/S.dart';
|
||||
class GlIssuesScreen extends StatelessWidget {
|
||||
final String id;
|
||||
final String? prefix;
|
||||
GlIssuesScreen(this.id, {this.prefix});
|
||||
const GlIssuesScreen(this.id, {this.prefix});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -39,7 +38,7 @@ class GlIssuesScreen extends StatelessWidget {
|
||||
author: p.author!.username,
|
||||
avatarUrl: p.author!.avatarUrl,
|
||||
commentCount: p.userNotesCount,
|
||||
subtitle: '#' + p.iid.toString(),
|
||||
subtitle: '#${p.iid}',
|
||||
title: p.title,
|
||||
updatedAt: p.updatedAt,
|
||||
labels: p.labels!.isEmpty
|
||||
|
@ -10,7 +10,7 @@ import 'package:flutter_gen/gen_l10n/S.dart';
|
||||
class GlMembersScreen extends StatelessWidget {
|
||||
final int id;
|
||||
final String type;
|
||||
GlMembersScreen(this.id, this.type);
|
||||
const GlMembersScreen(this.id, this.type);
|
||||
|
||||
// https://docs.gitlab.com/ee/api/access_requests.html#valid-access-levels
|
||||
static const accessLevelMap = {
|
||||
|
@ -11,7 +11,7 @@ import 'package:flutter_gen/gen_l10n/S.dart';
|
||||
class GlMergeRequestsScreen extends StatelessWidget {
|
||||
final String id;
|
||||
final String? prefix;
|
||||
GlMergeRequestsScreen(this.id, {this.prefix});
|
||||
const GlMergeRequestsScreen(this.id, {this.prefix});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -33,7 +33,7 @@ class GlMergeRequestsScreen extends StatelessWidget {
|
||||
author: p.author!.username,
|
||||
avatarUrl: p.author!.avatarUrl,
|
||||
commentCount: p.userNotesCount,
|
||||
subtitle: '#' + p.iid.toString(),
|
||||
subtitle: '#${p.iid}',
|
||||
title: p.title,
|
||||
updatedAt: p.updatedAt,
|
||||
labels: p.labels!.isEmpty
|
||||
|
@ -20,7 +20,7 @@ import 'package:flutter_gen/gen_l10n/S.dart';
|
||||
class GlProjectScreen extends StatelessWidget {
|
||||
final int id;
|
||||
final String? branch;
|
||||
GlProjectScreen(this.id, {this.branch});
|
||||
const GlProjectScreen(this.id, {this.branch});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -46,7 +46,7 @@ class GlProjectScreen extends StatelessWidget {
|
||||
|
||||
MarkdownViewData? readmeData;
|
||||
if (p.readmeUrl != null) {
|
||||
final md = () => auth.fetchWithGitlabToken(
|
||||
md() => auth.fetchWithGitlabToken(
|
||||
p.readmeUrl!.replaceFirst(r'/blob/', '/raw/'));
|
||||
readmeData = MarkdownViewData(
|
||||
context,
|
||||
@ -163,7 +163,7 @@ class GlProjectScreen extends StatelessWidget {
|
||||
future: langFuture,
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.data == null) {
|
||||
return Text('');
|
||||
return const Text('');
|
||||
} else {
|
||||
final langs = snapshot.data!.keys;
|
||||
return Text(langs.isEmpty
|
||||
@ -176,7 +176,7 @@ class GlProjectScreen extends StatelessWidget {
|
||||
? null
|
||||
: Text(filesize(p.statistics!.repositorySize)),
|
||||
url:
|
||||
'/gitlab/projects/$id/tree/${branch == null ? p.defaultBranch : branch}',
|
||||
'/gitlab/projects/$id/tree/${branch ?? p.defaultBranch}',
|
||||
),
|
||||
if (p.issuesEnabled!)
|
||||
TableViewItem(
|
||||
@ -204,9 +204,7 @@ class GlProjectScreen extends StatelessWidget {
|
||||
leftIconData: Octicons.git_branch,
|
||||
text: Text(AppLocalizations.of(context)!.branches),
|
||||
rightWidget: Text(
|
||||
((branch ?? p.defaultBranch) ?? '' /** empty project */) +
|
||||
' • ' +
|
||||
branches.length.toString()),
|
||||
'${(branch ?? p.defaultBranch) ?? ''} • ${branches.length}'),
|
||||
onTap: () async {
|
||||
if (branches.length < 2) return;
|
||||
|
||||
|
@ -3,7 +3,6 @@ import 'package:git_touch/models/auth.dart';
|
||||
import 'package:git_touch/models/gitlab.dart';
|
||||
import 'package:git_touch/models/theme.dart';
|
||||
import 'package:git_touch/scaffolds/list_stateful.dart';
|
||||
import 'package:git_touch/utils/utils.dart';
|
||||
import 'package:git_touch/widgets/app_bar_title.dart';
|
||||
import 'package:git_touch/widgets/avatar.dart';
|
||||
import 'package:git_touch/widgets/link.dart';
|
||||
@ -12,7 +11,7 @@ import 'package:flutter_gen/gen_l10n/S.dart';
|
||||
|
||||
class GlProjectActivityScreen extends StatelessWidget {
|
||||
final int id;
|
||||
GlProjectActivityScreen(this.id);
|
||||
const GlProjectActivityScreen(this.id);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -35,7 +34,7 @@ class GlProjectActivityScreen extends StatelessWidget {
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Avatar(url: data.author!.avatarUrl),
|
||||
SizedBox(width: 12),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
@ -51,7 +50,7 @@ class GlProjectActivityScreen extends StatelessWidget {
|
||||
),
|
||||
TextSpan(
|
||||
text:
|
||||
' ' + data.actionName! + data.targetType!),
|
||||
' ${data.actionName!}${data.targetType!}'),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -10,7 +10,7 @@ import 'package:flutter_gen/gen_l10n/S.dart';
|
||||
|
||||
class GlStarrersScreen extends StatelessWidget {
|
||||
final int id;
|
||||
GlStarrersScreen(this.id);
|
||||
const GlStarrersScreen(this.id);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -34,7 +34,7 @@ class GlStarrersScreen extends StatelessWidget {
|
||||
avatarUrl: v.user!.avatarUrl,
|
||||
login: v.user!.username,
|
||||
name: v.user!.name,
|
||||
bio: Text('Starred ' + timeago.format(v.starredSince!)),
|
||||
bio: Text('Starred ${timeago.format(v.starredSince!)}'),
|
||||
id: v.user!.id,
|
||||
);
|
||||
},
|
||||
|
@ -62,7 +62,7 @@ class GlTodosScreen extends StatelessWidget {
|
||||
final theme = Provider.of<ThemeModel>(context);
|
||||
|
||||
return RefreshStatefulScaffold<Iterable<GitlabTodo>>(
|
||||
title: Text('Todos'),
|
||||
title: const Text('Todos'),
|
||||
fetch: () async {
|
||||
final vs = await context.read<AuthModel>().fetchGitlab('/todos');
|
||||
return (vs as List).map((v) => GitlabTodo.fromJson(v));
|
||||
@ -81,7 +81,7 @@ class GlTodosScreen extends StatelessWidget {
|
||||
Avatar(
|
||||
url: item.author!.avatarUrl,
|
||||
linkUrl: '/gitlab/user/${item.author!.id}'),
|
||||
SizedBox(width: 12),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Text.rich(
|
||||
TextSpan(
|
||||
|
@ -6,14 +6,13 @@ import 'package:git_touch/widgets/object_tree.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:git_touch/models/auth.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:git_touch/utils/utils.dart';
|
||||
import 'package:flutter_gen/gen_l10n/S.dart';
|
||||
|
||||
class GlTreeScreen extends StatelessWidget {
|
||||
final int id;
|
||||
final String ref;
|
||||
final String? path;
|
||||
GlTreeScreen(this.id, this.ref, {this.path});
|
||||
const GlTreeScreen(this.id, this.ref, {this.path});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -11,7 +11,7 @@ class GoCommitsScreen extends StatelessWidget {
|
||||
final String owner;
|
||||
final String name;
|
||||
final String? branch;
|
||||
GoCommitsScreen(this.owner, this.name, {this.branch = 'master'});
|
||||
const GoCommitsScreen(this.owner, this.name, {this.branch = 'master'});
|
||||
|
||||
// TODO: API only returns most recent commit. No provision for all commits.
|
||||
@override
|
||||
|
@ -3,7 +3,6 @@ import 'package:flutter_gen/gen_l10n/S.dart';
|
||||
import 'package:git_touch/models/auth.dart';
|
||||
import 'package:git_touch/models/gogs.dart';
|
||||
import 'package:git_touch/scaffolds/list_stateful.dart';
|
||||
import 'package:git_touch/utils/utils.dart';
|
||||
import 'package:git_touch/widgets/action_entry.dart';
|
||||
import 'package:git_touch/widgets/app_bar_title.dart';
|
||||
import 'package:git_touch/widgets/issue_item.dart';
|
||||
@ -14,7 +13,7 @@ class GoIssuesScreen extends StatelessWidget {
|
||||
final String owner;
|
||||
final String name;
|
||||
final bool isPr;
|
||||
GoIssuesScreen(this.owner, this.name, {this.isPr = false});
|
||||
const GoIssuesScreen(this.owner, this.name, {this.isPr = false});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -43,7 +42,7 @@ class GoIssuesScreen extends StatelessWidget {
|
||||
author: p.user!.username,
|
||||
avatarUrl: p.user!.avatarUrl,
|
||||
commentCount: p.comments,
|
||||
subtitle: '#' + p.number.toString(),
|
||||
subtitle: '#${p.number}',
|
||||
title: p.title,
|
||||
updatedAt: p.updatedAt,
|
||||
url: isPr
|
||||
|
@ -16,7 +16,7 @@ class GoObjectScreen extends StatelessWidget {
|
||||
final String name;
|
||||
final String? path;
|
||||
final String? ref;
|
||||
GoObjectScreen(this.owner, this.name, {this.path, this.ref});
|
||||
const GoObjectScreen(this.owner, this.name, {this.path, this.ref});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -33,7 +33,7 @@ class GoObjectScreen extends StatelessWidget {
|
||||
if (p is List) {
|
||||
return null;
|
||||
} else {
|
||||
return ActionEntry(
|
||||
return const ActionEntry(
|
||||
iconData: Ionicons.cog,
|
||||
url: '/choose-code-theme',
|
||||
);
|
||||
|
@ -12,7 +12,7 @@ class GoOrgsScreen extends StatelessWidget {
|
||||
final String api;
|
||||
final bool isViewer;
|
||||
// TODO: implement list of orgs screen when API is available
|
||||
GoOrgsScreen.ofUser(String login, {required this.isViewer})
|
||||
const GoOrgsScreen.ofUser(String login, {required this.isViewer})
|
||||
: api = isViewer ? '/users/$login/orgs' : '/user/orgs';
|
||||
|
||||
@override
|
||||
|
@ -19,7 +19,7 @@ class GoRepoScreen extends StatelessWidget {
|
||||
final String owner;
|
||||
final String name;
|
||||
final String? branch;
|
||||
GoRepoScreen(this.owner, this.name, {this.branch});
|
||||
const GoRepoScreen(this.owner, this.name, {this.branch});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -32,11 +32,11 @@ class GoRepoScreen extends StatelessWidget {
|
||||
return GogsRepository.fromJson(v);
|
||||
});
|
||||
|
||||
final md = () =>
|
||||
md() =>
|
||||
auth.fetchGogs('/repos/$owner/$name/contents/README.md').then((v) {
|
||||
return (v['content'] as String?)?.base64ToUtf8 ?? '';
|
||||
});
|
||||
final html = () => md().then((v) async {
|
||||
html() => md().then((v) async {
|
||||
final res = await http.post(
|
||||
Uri.parse('${auth.activeAccount!.domain}/api/v1/markdown/raw'),
|
||||
headers: {'Authorization': 'token ${auth.token}'},
|
||||
@ -47,8 +47,9 @@ class GoRepoScreen extends StatelessWidget {
|
||||
final readmeData = MarkdownViewData(context, md: md, html: html);
|
||||
List<GogsBranch> branches =
|
||||
await auth.fetchGogs('/repos/$owner/$name/branches').then((v) {
|
||||
if (!(v is List))
|
||||
return []; // Valid API Response only returned if repo contains >= 2 branches
|
||||
if (v is! List) {
|
||||
return [];
|
||||
} // Valid API Response only returned if repo contains >= 2 branches
|
||||
return [for (var branch in v) GogsBranch.fromJson(branch)];
|
||||
});
|
||||
|
||||
@ -92,30 +93,28 @@ class GoRepoScreen extends StatelessWidget {
|
||||
items: [
|
||||
TableViewItem(
|
||||
leftIconData: Octicons.code,
|
||||
text: Text('Code'),
|
||||
text: const Text('Code'),
|
||||
url: '/gogs/$owner/$name/blob?ref=${branch ?? 'master'}',
|
||||
),
|
||||
TableViewItem(
|
||||
leftIconData: Octicons.issue_opened,
|
||||
text: Text('Issues'),
|
||||
text: const Text('Issues'),
|
||||
url: '/gogs/$owner/$name/issues',
|
||||
),
|
||||
TableViewItem(
|
||||
const TableViewItem(
|
||||
leftIconData: Octicons.git_pull_request,
|
||||
text: Text(
|
||||
'Pull requests'), // TODO: when API endpoint is available
|
||||
),
|
||||
TableViewItem(
|
||||
leftIconData: Octicons.history,
|
||||
text: Text('Commits'),
|
||||
text: const Text('Commits'),
|
||||
url: '/gogs/$owner/$name/commits?ref=${branch ?? 'master'}',
|
||||
),
|
||||
TableViewItem(
|
||||
leftIconData: Octicons.git_branch,
|
||||
text: Text(AppLocalizations.of(context)!.branches),
|
||||
rightWidget: Text((branch ?? 'master') +
|
||||
' • ' +
|
||||
'${branches.length.toString()}'),
|
||||
rightWidget: Text('${branch ?? 'master'} • ${branches.length.toString()}'),
|
||||
onTap: () async {
|
||||
await theme.showPicker(
|
||||
context,
|
||||
|
@ -11,10 +11,10 @@ class GoReposScreen extends StatelessWidget {
|
||||
final String title;
|
||||
final bool isViewer;
|
||||
|
||||
GoReposScreen(String owner, {this.isViewer = false})
|
||||
const GoReposScreen(String owner, {this.isViewer = false})
|
||||
: api = isViewer ? '/users/$owner/repos' : '/user/repos',
|
||||
title = 'Repositories';
|
||||
GoReposScreen.org(String owner)
|
||||
const GoReposScreen.org(String owner)
|
||||
: api = '/orgs/$owner/repos',
|
||||
title = 'Repositories',
|
||||
isViewer = false;
|
||||
|
@ -4,6 +4,6 @@ import 'package:flutter/material.dart';
|
||||
class GoSearchScreen extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Center(child: Text('Coming Soon...'));
|
||||
return const Center(child: Text('Coming Soon...'));
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ import 'package:tuple/tuple.dart';
|
||||
class GoUserScreen extends StatelessWidget {
|
||||
final String login;
|
||||
final bool isViewer;
|
||||
GoUserScreen(this.login, {this.isViewer = false});
|
||||
const GoUserScreen(this.login, {this.isViewer = false});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -36,7 +36,7 @@ class GoUserScreen extends StatelessWidget {
|
||||
]);
|
||||
},
|
||||
action: isViewer
|
||||
? ActionEntry(
|
||||
? const ActionEntry(
|
||||
iconData: Ionicons.cog,
|
||||
url: '/settings',
|
||||
)
|
||||
@ -75,7 +75,7 @@ class GoUserScreen extends StatelessWidget {
|
||||
items: [
|
||||
TableViewItem(
|
||||
leftIconData: Octicons.home,
|
||||
text: Text('Organizations'),
|
||||
text: const Text('Organizations'),
|
||||
url:
|
||||
'/gogs/${user.username}?tab=organizations&isViewer=$isViewer',
|
||||
),
|
||||
|
@ -10,10 +10,10 @@ class GoUsersScreen extends StatelessWidget {
|
||||
final String api;
|
||||
final String title;
|
||||
|
||||
GoUsersScreen.followers(String login)
|
||||
const GoUsersScreen.followers(String login)
|
||||
: api = '/users/$login/followers',
|
||||
title = 'Followers';
|
||||
GoUsersScreen.following(String login)
|
||||
const GoUsersScreen.following(String login)
|
||||
: api = '/users/$login/following',
|
||||
title = "Following";
|
||||
|
||||
|
@ -11,7 +11,7 @@ class GtCommitsScreen extends StatelessWidget {
|
||||
final String owner;
|
||||
final String name;
|
||||
// final String branch; // TODO:
|
||||
GtCommitsScreen(this.owner, this.name);
|
||||
const GtCommitsScreen(this.owner, this.name);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -19,7 +19,7 @@ class GtIssueScreen extends StatelessWidget {
|
||||
final String number;
|
||||
final bool isPr;
|
||||
|
||||
GtIssueScreen(this.owner, this.name, this.number, {this.isPr: false});
|
||||
const GtIssueScreen(this.owner, this.name, this.number, {this.isPr = false});
|
||||
|
||||
List<ActionItem> _buildCommentActionItem(
|
||||
BuildContext context, GiteaComment comment) {
|
||||
@ -88,7 +88,7 @@ class GtIssueScreen extends StatelessWidget {
|
||||
url: issue.user!.avatarUrl,
|
||||
size: AvatarSize.extraSmall,
|
||||
),
|
||||
SizedBox(width: 4),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
'$owner / $name',
|
||||
style: TextStyle(
|
||||
@ -96,7 +96,7 @@ class GtIssueScreen extends StatelessWidget {
|
||||
color: theme.palette.secondaryText,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 4),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
'#$number',
|
||||
style: TextStyle(
|
||||
@ -107,28 +107,28 @@ class GtIssueScreen extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
issue.title!,
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
const SizedBox(height: 8),
|
||||
StateLabel(
|
||||
issue.state == 'open'
|
||||
? StateLabelStatus.issueOpened
|
||||
: StateLabelStatus.issueClosed,
|
||||
small: true),
|
||||
SizedBox(height: 16),
|
||||
const SizedBox(height: 16),
|
||||
CommonStyle.border,
|
||||
],
|
||||
)),
|
||||
Column(children: [
|
||||
for (var comment in comments) ...[
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 10),
|
||||
padding: const EdgeInsets.only(left: 10),
|
||||
child: CommentItem(
|
||||
avatar: Avatar(
|
||||
url: comment.user!.avatarUrl,
|
||||
@ -142,7 +142,7 @@ class GtIssueScreen extends StatelessWidget {
|
||||
_buildCommentActionItem(context, comment),
|
||||
)),
|
||||
CommonStyle.border,
|
||||
SizedBox(height: 16),
|
||||
const SizedBox(height: 16),
|
||||
],
|
||||
]),
|
||||
]);
|
||||
|
@ -1,5 +1,4 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:git_touch/models/auth.dart';
|
||||
import 'package:git_touch/models/theme.dart';
|
||||
import 'package:git_touch/scaffolds/common.dart';
|
||||
@ -14,8 +13,8 @@ class GtIssueCommentScreen extends StatefulWidget {
|
||||
final bool isPr;
|
||||
final String body;
|
||||
final String id;
|
||||
GtIssueCommentScreen(this.owner, this.name, this.number,
|
||||
{this.isPr: false, this.body: '', this.id: ''});
|
||||
const GtIssueCommentScreen(this.owner, this.name, this.number,
|
||||
{this.isPr = false, this.body = '', this.id = ''});
|
||||
|
||||
@override
|
||||
_GtIssueCommentScreenState createState() => _GtIssueCommentScreenState();
|
||||
@ -23,7 +22,7 @@ class GtIssueCommentScreen extends StatefulWidget {
|
||||
|
||||
class _GtIssueCommentScreenState extends State<GtIssueCommentScreen> {
|
||||
bool isEdit = false;
|
||||
TextEditingController _controller = new TextEditingController();
|
||||
final TextEditingController _controller = TextEditingController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@ -52,7 +51,7 @@ class _GtIssueCommentScreenState extends State<GtIssueCommentScreen> {
|
||||
),
|
||||
),
|
||||
CupertinoButton.filled(
|
||||
child: Text('Comment'),
|
||||
child: const Text('Comment'),
|
||||
onPressed: () async {
|
||||
if (!isEdit) {
|
||||
await auth.fetchGitea(
|
||||
|
@ -1,5 +1,4 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:git_touch/models/auth.dart';
|
||||
import 'package:git_touch/models/gitea.dart';
|
||||
import 'package:git_touch/models/theme.dart';
|
||||
@ -11,7 +10,7 @@ import 'package:flutter_gen/gen_l10n/S.dart';
|
||||
class GtIssueFormScreen extends StatefulWidget {
|
||||
final String owner;
|
||||
final String name;
|
||||
GtIssueFormScreen(this.owner, this.name);
|
||||
const GtIssueFormScreen(this.owner, this.name);
|
||||
|
||||
@override
|
||||
_GtIssueFormScreenState createState() => _GtIssueFormScreenState();
|
||||
|
@ -3,7 +3,6 @@ import 'package:flutter_gen/gen_l10n/S.dart';
|
||||
import 'package:git_touch/models/auth.dart';
|
||||
import 'package:git_touch/models/gitea.dart';
|
||||
import 'package:git_touch/scaffolds/list_stateful.dart';
|
||||
import 'package:git_touch/utils/utils.dart';
|
||||
import 'package:git_touch/widgets/action_entry.dart';
|
||||
import 'package:git_touch/widgets/app_bar_title.dart';
|
||||
import 'package:git_touch/widgets/issue_item.dart';
|
||||
@ -14,7 +13,7 @@ class GtIssuesScreen extends StatelessWidget {
|
||||
final String owner;
|
||||
final String name;
|
||||
final bool isPr;
|
||||
GtIssuesScreen(this.owner, this.name, {this.isPr = false});
|
||||
const GtIssuesScreen(this.owner, this.name, {this.isPr = false});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -43,7 +42,7 @@ class GtIssuesScreen extends StatelessWidget {
|
||||
author: p.user!.login,
|
||||
avatarUrl: p.user!.avatarUrl,
|
||||
commentCount: p.comments,
|
||||
subtitle: '#' + p.number.toString(),
|
||||
subtitle: '#${p.number}',
|
||||
title: p.title,
|
||||
updatedAt: p.updatedAt,
|
||||
url: isPr
|
||||
|
@ -15,7 +15,7 @@ class GtObjectScreen extends StatelessWidget {
|
||||
final String owner;
|
||||
final String name;
|
||||
final String? path;
|
||||
GtObjectScreen(this.owner, this.name, {this.path});
|
||||
const GtObjectScreen(this.owner, this.name, {this.path});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -32,7 +32,7 @@ class GtObjectScreen extends StatelessWidget {
|
||||
if (p is List) {
|
||||
return null;
|
||||
} else {
|
||||
return ActionEntry(
|
||||
return const ActionEntry(
|
||||
iconData: Ionicons.cog,
|
||||
url: '/choose-code-theme',
|
||||
);
|
||||
|
@ -9,8 +9,8 @@ import 'package:flutter_gen/gen_l10n/S.dart';
|
||||
|
||||
class GtOrgsScreen extends StatelessWidget {
|
||||
final String api;
|
||||
GtOrgsScreen() : api = '/orgs';
|
||||
GtOrgsScreen.ofUser(String login) : api = '/users/$login/orgs';
|
||||
const GtOrgsScreen() : api = '/orgs';
|
||||
const GtOrgsScreen.ofUser(String login) : api = '/users/$login/orgs';
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -19,7 +19,7 @@ import 'package:flutter_gen/gen_l10n/S.dart';
|
||||
class GtRepoScreen extends StatelessWidget {
|
||||
final String owner;
|
||||
final String name;
|
||||
GtRepoScreen(this.owner, this.name);
|
||||
const GtRepoScreen(this.owner, this.name);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -31,11 +31,11 @@ class GtRepoScreen extends StatelessWidget {
|
||||
return GiteaRepository.fromJson(v);
|
||||
});
|
||||
|
||||
final md = () =>
|
||||
md() =>
|
||||
auth.fetchGitea('/repos/$owner/$name/contents/README.md').then((v) {
|
||||
return (v['content'] as String?)?.base64ToUtf8 ?? '';
|
||||
});
|
||||
final html = () => md().then((v) async {
|
||||
html() => md().then((v) async {
|
||||
final res = await http.post(
|
||||
Uri.parse('${auth.activeAccount!.domain}/api/v1/markdown/raw'),
|
||||
headers: {'Authorization': 'token ${auth.token}'},
|
||||
@ -84,25 +84,25 @@ class GtRepoScreen extends StatelessWidget {
|
||||
items: [
|
||||
TableViewItem(
|
||||
leftIconData: Octicons.code,
|
||||
text: Text('Code'),
|
||||
text: const Text('Code'),
|
||||
rightWidget: Text(filesize(p.size! * 1000)),
|
||||
url: '/gitea/$owner/$name/blob',
|
||||
),
|
||||
TableViewItem(
|
||||
leftIconData: Octicons.issue_opened,
|
||||
text: Text('Issues'),
|
||||
text: const Text('Issues'),
|
||||
rightWidget: Text(numberFormat.format(p.openIssuesCount)),
|
||||
url: '/gitea/$owner/$name/issues',
|
||||
),
|
||||
TableViewItem(
|
||||
leftIconData: Octicons.git_pull_request,
|
||||
text: Text('Pull requests'),
|
||||
text: const Text('Pull requests'),
|
||||
rightWidget: Text(numberFormat.format(p.openPrCounter)),
|
||||
url: '/gitea/$owner/$name/pulls',
|
||||
),
|
||||
TableViewItem(
|
||||
leftIconData: Octicons.history,
|
||||
text: Text('Commits'),
|
||||
text: const Text('Commits'),
|
||||
url: '/gitea/$owner/$name/commits',
|
||||
),
|
||||
],
|
||||
|
@ -11,16 +11,16 @@ class GtReposScreen extends StatelessWidget {
|
||||
final String api;
|
||||
final String title;
|
||||
|
||||
GtReposScreen(String owner)
|
||||
const GtReposScreen(String owner)
|
||||
: api = '/users/$owner/repos',
|
||||
title = 'Repositories';
|
||||
GtReposScreen.star(String owner)
|
||||
const GtReposScreen.star(String owner)
|
||||
: api = '/users/$owner/starred',
|
||||
title = 'Stars';
|
||||
GtReposScreen.org(String owner)
|
||||
const GtReposScreen.org(String owner)
|
||||
: api = '/orgs/$owner/repos',
|
||||
title = 'Repositories';
|
||||
GtReposScreen.forks(String owner, String repo)
|
||||
const GtReposScreen.forks(String owner, String repo)
|
||||
: api = '/repos/$owner/$repo/forks',
|
||||
title = 'Forks';
|
||||
|
||||
|
@ -21,7 +21,7 @@ class GtStatusScreen extends StatelessWidget {
|
||||
auth.fetchGitea('/settings/repository'),
|
||||
auth.fetchGitea('/settings/ui'),
|
||||
]);
|
||||
return JsonEncoder.withIndent(' ').convert({
|
||||
return const JsonEncoder.withIndent(' ').convert({
|
||||
...res[0],
|
||||
'attachment': res[1],
|
||||
'api': res[2],
|
||||
|
@ -26,7 +26,7 @@ class GtUserScreenPayload {
|
||||
class GtUserScreen extends StatelessWidget {
|
||||
final String login;
|
||||
final bool isViewer;
|
||||
GtUserScreen(this.login, {this.isViewer = false});
|
||||
const GtUserScreen(this.login, {this.isViewer = false});
|
||||
|
||||
static List<List<ContributionDay>> normalizeHeatmap(List userHeatmap) {
|
||||
final heatmapItems = [
|
||||
@ -91,7 +91,7 @@ class GtUserScreen extends StatelessWidget {
|
||||
return payload;
|
||||
},
|
||||
action: isViewer
|
||||
? ActionEntry(
|
||||
? const ActionEntry(
|
||||
iconData: Ionicons.cog,
|
||||
url: '/settings',
|
||||
)
|
||||
@ -134,7 +134,7 @@ class GtUserScreen extends StatelessWidget {
|
||||
items: [
|
||||
TableViewItem(
|
||||
leftIconData: Octicons.home,
|
||||
text: Text('Organizations'),
|
||||
text: const Text('Organizations'),
|
||||
url: '/gitea/$login?tab=organizations',
|
||||
),
|
||||
],
|
||||
@ -201,7 +201,7 @@ class GtUserScreen extends StatelessWidget {
|
||||
],
|
||||
);
|
||||
} else {
|
||||
return Text('404'); // TODO:
|
||||
return const Text('404'); // TODO:
|
||||
}
|
||||
},
|
||||
);
|
||||
|
@ -11,19 +11,19 @@ class GtUsersScreen extends StatelessWidget {
|
||||
final String api;
|
||||
final String title;
|
||||
|
||||
GtUsersScreen.followers(String login)
|
||||
const GtUsersScreen.followers(String login)
|
||||
: api = '/users/$login/followers',
|
||||
title = 'Followers';
|
||||
GtUsersScreen.following(String login)
|
||||
const GtUsersScreen.following(String login)
|
||||
: api = '/users/$login/following',
|
||||
title = "Following";
|
||||
GtUsersScreen.member(String login)
|
||||
const GtUsersScreen.member(String login)
|
||||
: api = '/orgs/$login/members',
|
||||
title = "Members";
|
||||
GtUsersScreen.stargazers(String owner, String repo)
|
||||
const GtUsersScreen.stargazers(String owner, String repo)
|
||||
: api = '/repos/$owner/$repo/stargazers',
|
||||
title = 'Stargazers';
|
||||
GtUsersScreen.watchers(String owner, String repo)
|
||||
const GtUsersScreen.watchers(String owner, String repo)
|
||||
: api = '/repos/$owner/$repo/subscribers',
|
||||
title = 'Watchers';
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user