mirror of
https://github.com/git-touch/git-touch
synced 2025-01-31 08:04:51 +01:00
feat: style tweaks
This commit is contained in:
parent
94cd4ec945
commit
2acf85742b
@ -28,7 +28,7 @@ class LongListPayload<T, K> {
|
||||
// Since the list could be very long, and some users may only want to to check trailing items
|
||||
// We should load leading and trailing items at first fetching, and do load more in the middle
|
||||
// e.g. https://github.com/reactjs/rfcs/pull/68
|
||||
class LongListScaffold<T, K> extends StatefulWidget {
|
||||
class LongListStatefulScaffold<T, K> extends StatefulWidget {
|
||||
final Widget title;
|
||||
final Widget Function(T headerPayload) trailingBuilder;
|
||||
final Widget Function(T headerPayload) headerBuilder;
|
||||
@ -36,7 +36,7 @@ class LongListScaffold<T, K> extends StatefulWidget {
|
||||
final Future<LongListPayload<T, K>> Function() onRefresh;
|
||||
final Future<LongListPayload<T, K>> Function(String cursor) onLoadMore;
|
||||
|
||||
LongListScaffold({
|
||||
LongListStatefulScaffold({
|
||||
@required this.title,
|
||||
this.trailingBuilder,
|
||||
@required this.headerBuilder,
|
||||
@ -46,10 +46,12 @@ class LongListScaffold<T, K> extends StatefulWidget {
|
||||
});
|
||||
|
||||
@override
|
||||
_LongListScaffoldState createState() => _LongListScaffoldState();
|
||||
_LongListStatefulScaffoldState createState() =>
|
||||
_LongListStatefulScaffoldState();
|
||||
}
|
||||
|
||||
class _LongListScaffoldState<T, K> extends State<LongListScaffold<T, K>> {
|
||||
class _LongListStatefulScaffoldState<T, K>
|
||||
extends State<LongListStatefulScaffold<T, K>> {
|
||||
bool loading;
|
||||
bool loadingMore = false;
|
||||
String error = '';
|
||||
|
@ -337,7 +337,7 @@ mutation {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return LongListScaffold(
|
||||
return LongListStatefulScaffold(
|
||||
title: Text('Issue #$number'),
|
||||
trailingBuilder: (payload) {
|
||||
return ActionButton(
|
||||
|
@ -32,7 +32,7 @@ class ObjectScreen extends StatelessWidget {
|
||||
this.type = 'tree',
|
||||
});
|
||||
|
||||
String get _expression => '$branch:' + paths.join('/');
|
||||
String get _expression => '$branch:$_path';
|
||||
String get _extname {
|
||||
if (paths.isEmpty) return '';
|
||||
var dotext = path.extension(paths.last);
|
||||
@ -41,10 +41,10 @@ class ObjectScreen extends StatelessWidget {
|
||||
}
|
||||
|
||||
String get _language => _extname.isEmpty ? 'plaintext' : _extname;
|
||||
String get _path => paths.join('/');
|
||||
|
||||
String get rawUrl =>
|
||||
'https://raw.githubusercontent.com/$owner/$name/$branch/' +
|
||||
paths.join('/'); // TODO:
|
||||
'https://raw.githubusercontent.com/$owner/$name/$branch/$_path'; // TODO:
|
||||
|
||||
static const _iconDefaultColor = PrimerColors.blue300;
|
||||
|
||||
@ -145,7 +145,7 @@ class ObjectScreen extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return RefreshStatefulScaffold(
|
||||
title: AppBarTitle(paths.join('/')),
|
||||
title: AppBarTitle(_path.isEmpty ? 'Files' : _path),
|
||||
fetchData: () async {
|
||||
var data = await Provider.of<AuthModel>(context).query('''{
|
||||
repository(owner: "$owner", name: "$name") {
|
||||
|
@ -131,24 +131,6 @@ class RepositoryScreen extends StatelessWidget {
|
||||
return ActionButton(
|
||||
title: 'Repository Actions',
|
||||
items: [
|
||||
ActionItem(
|
||||
text: '@$owner',
|
||||
onPress: () {
|
||||
if (data == null) return;
|
||||
WidgetBuilder builder;
|
||||
|
||||
switch (data[0]['owner']['__typename']) {
|
||||
case 'Organization':
|
||||
builder = (_) => OrganizationScreen(owner);
|
||||
break;
|
||||
case 'User':
|
||||
builder = (_) => UserScreen(owner);
|
||||
break;
|
||||
}
|
||||
|
||||
Provider.of<ThemeModel>(context).pushRoute(context, builder);
|
||||
},
|
||||
),
|
||||
if (data != null) ...[
|
||||
ActionItem(
|
||||
text: data[0]['viewerHasStarred'] ? 'Unstar' : 'Star',
|
||||
|
@ -63,27 +63,24 @@ class IssueItem extends StatelessWidget {
|
||||
? Octicons.git_pull_request
|
||||
: Octicons.issue_opened,
|
||||
color: Palette.green,
|
||||
size: 16),
|
||||
size: 18),
|
||||
SizedBox(width: 6),
|
||||
Expanded(
|
||||
child: Container(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: join(SizedBox(height: 8), [
|
||||
// Text(
|
||||
// owner +
|
||||
// '/' +
|
||||
// name +
|
||||
// ' #' +
|
||||
// payload['number'].toString(),
|
||||
// style: TextStyle(fontSize: 13, color: Colors.black54),
|
||||
// ),
|
||||
// Padding(padding: EdgeInsets.only(top: 4)),
|
||||
Text(
|
||||
payload['title'] + ' (#${payload['number']})',
|
||||
Text.rich(
|
||||
TextSpan(children: [
|
||||
TextSpan(text: payload['title'] + ' '),
|
||||
TextSpan(
|
||||
text: '#${payload['number']}',
|
||||
style: TextStyle(color: PrimerColors.gray500),
|
||||
),
|
||||
]),
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: PrimerColors.gray900,
|
||||
color: PrimerColors.blue500,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
|
Loading…
x
Reference in New Issue
Block a user