mirror of
https://github.com/git-touch/git-touch
synced 2025-02-07 15:18:47 +01:00
feat: use seti icons
This commit is contained in:
parent
029bebaf0d
commit
8b580e2376
@ -9,6 +9,7 @@ import 'package:git_touch/scaffolds/refresh.dart';
|
|||||||
import 'package:git_touch/utils/utils.dart';
|
import 'package:git_touch/utils/utils.dart';
|
||||||
import 'package:git_touch/widgets/link.dart';
|
import 'package:git_touch/widgets/link.dart';
|
||||||
import 'package:primer/primer.dart';
|
import 'package:primer/primer.dart';
|
||||||
|
import 'package:seti/seti.dart';
|
||||||
|
|
||||||
class ObjectScreen extends StatelessWidget {
|
class ObjectScreen extends StatelessWidget {
|
||||||
final String owner;
|
final String owner;
|
||||||
@ -37,14 +38,28 @@ class ObjectScreen extends StatelessWidget {
|
|||||||
'https://raw.githubusercontent.com/$owner/$name/$branch/' +
|
'https://raw.githubusercontent.com/$owner/$name/$branch/' +
|
||||||
paths.join('/'); // TODO:
|
paths.join('/'); // TODO:
|
||||||
|
|
||||||
IconData _buildIconData(item) {
|
static const _iconDefaultColor = PrimerColors.blue300;
|
||||||
|
|
||||||
|
List<Widget> _buildIcon(item) {
|
||||||
switch (item['type']) {
|
switch (item['type']) {
|
||||||
case 'tree':
|
case 'tree':
|
||||||
return Octicons.file_directory;
|
return [
|
||||||
|
SizedBox(width: 10),
|
||||||
|
Icon(Octicons.file_directory, color: _iconDefaultColor, size: 20),
|
||||||
|
SizedBox(width: 10),
|
||||||
|
];
|
||||||
case 'blob':
|
case 'blob':
|
||||||
return Octicons.file;
|
return [
|
||||||
|
SizedBox(width: 6),
|
||||||
|
SetiIcon(item['name'], size: 28),
|
||||||
|
SizedBox(width: 6),
|
||||||
|
];
|
||||||
default:
|
default:
|
||||||
return Octicons.link;
|
return [
|
||||||
|
SizedBox(width: 10),
|
||||||
|
Icon(Octicons.link, color: _iconDefaultColor, size: 20),
|
||||||
|
SizedBox(width: 10),
|
||||||
|
]; // FIXME: link type
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,41 +87,41 @@ class ObjectScreen extends StatelessWidget {
|
|||||||
Widget _buildTree(payload) {
|
Widget _buildTree(payload) {
|
||||||
var entries = payload['entries'] as List;
|
var entries = payload['entries'] as List;
|
||||||
return Column(
|
return Column(
|
||||||
children: entries.map((item) {
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
return Link(
|
children: join(
|
||||||
screenBuilder: (context) {
|
BorderView(),
|
||||||
// TODO: All image types
|
entries.map((item) {
|
||||||
var ext = path.extension(item['name']);
|
return Link(
|
||||||
if (ext.isNotEmpty) ext = ext.substring(1);
|
screenBuilder: (context) {
|
||||||
if (['png', 'jpg', 'jpeg'].contains(ext)) {
|
// TODO: All image types
|
||||||
return ImageView(NetworkImage('$rawUrl/' + item['name']));
|
var ext = path.extension(item['name']);
|
||||||
}
|
if (ext.isNotEmpty) ext = ext.substring(1);
|
||||||
return ObjectScreen(
|
if (['png', 'jpg', 'jpeg'].contains(ext)) {
|
||||||
name: name,
|
return ImageView(NetworkImage('$rawUrl/' + item['name']));
|
||||||
owner: owner,
|
}
|
||||||
branch: branch,
|
return ObjectScreen(
|
||||||
paths: [...paths, item['name']],
|
name: name,
|
||||||
type: item['type'],
|
owner: owner,
|
||||||
);
|
branch: branch,
|
||||||
},
|
paths: [...paths, item['name']],
|
||||||
child: Container(
|
type: item['type'],
|
||||||
padding: EdgeInsets.all(12),
|
);
|
||||||
decoration: BoxDecoration(
|
},
|
||||||
border:
|
child: Container(
|
||||||
Border(bottom: BorderSide(color: Colors.grey.shade100))),
|
height: 40,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Icon(_buildIconData(item), color: Color(0x80032f62), size: 20),
|
..._buildIcon(item),
|
||||||
SizedBox(width: 8),
|
Expanded(
|
||||||
Expanded(
|
child: Text(item['name'],
|
||||||
child: Text(item['name'],
|
style: TextStyle(
|
||||||
style: TextStyle(
|
fontSize: 16, color: PrimerColors.gray900)))
|
||||||
fontSize: 16, color: PrimerColors.blue500)))
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
);
|
}).toList(),
|
||||||
}).toList(),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
35
pubspec.yaml
35
pubspec.yaml
@ -25,13 +25,14 @@ dependencies:
|
|||||||
shared_preferences: ^0.5.0
|
shared_preferences: ^0.5.0
|
||||||
nanoid: ^0.0.6
|
nanoid: ^0.0.6
|
||||||
share: ^0.6.0
|
share: ^0.6.0
|
||||||
flutter_vector_icons: ^0.0.2
|
flutter_vector_icons: ^0.2.1
|
||||||
github_contributions: ^0.1.1
|
github_contributions: ^0.1.1
|
||||||
flutter_svg: ^0.13.0
|
flutter_svg: ^0.13.0
|
||||||
launch_review: ^2.0.0
|
launch_review: ^2.0.0
|
||||||
flutter_highlight: ^0.3.0
|
flutter_highlight: ^0.3.0
|
||||||
timeago: ^2.0.18
|
timeago: ^2.0.18
|
||||||
provider: ^3.1.0
|
provider: ^3.1.0
|
||||||
|
seti: ^0.1.0
|
||||||
primer:
|
primer:
|
||||||
git:
|
git:
|
||||||
url: git://github.com/pd4d10/primer-flutter
|
url: git://github.com/pd4d10/primer-flutter
|
||||||
@ -52,38 +53,6 @@ dev_dependencies:
|
|||||||
|
|
||||||
# The following section is specific to Flutter.
|
# The following section is specific to Flutter.
|
||||||
flutter:
|
flutter:
|
||||||
# The following line ensures that the Material Icons font is
|
|
||||||
# included with your application, so that you can use the icons in
|
|
||||||
# the material Icons class.
|
|
||||||
uses-material-design: true
|
uses-material-design: true
|
||||||
|
|
||||||
# To add assets to your application, add an assets section, like this:
|
|
||||||
# assets:
|
|
||||||
# - images/a_dot_burr.jpeg
|
|
||||||
# - images/a_dot_ham.jpeg
|
|
||||||
|
|
||||||
assets:
|
assets:
|
||||||
- images/
|
- images/
|
||||||
# An image asset can refer to one or more resolution-specific "variants", see
|
|
||||||
# https://flutter.io/assets-and-images/#resolution-aware.
|
|
||||||
# For details regarding adding assets from package dependencies, see
|
|
||||||
# https://flutter.io/assets-and-images/#from-packages
|
|
||||||
# To add custom fonts to your application, add a fonts section here,
|
|
||||||
# in this "flutter" section. Each entry in this list should have a
|
|
||||||
# "family" key with the font family name, and a "fonts" key with a
|
|
||||||
# list giving the asset and other descriptors for the font. For
|
|
||||||
# example:
|
|
||||||
# fonts:
|
|
||||||
# - family: Schyler
|
|
||||||
# fonts:
|
|
||||||
# - asset: fonts/Schyler-Regular.ttf
|
|
||||||
# - asset: fonts/Schyler-Italic.ttf
|
|
||||||
# style: italic
|
|
||||||
# - family: Trajan Pro
|
|
||||||
# fonts:
|
|
||||||
# - asset: fonts/TrajanPro.ttf
|
|
||||||
# - asset: fonts/TrajanPro_Bold.ttf
|
|
||||||
# weight: 700
|
|
||||||
#
|
|
||||||
# For details regarding fonts from package dependencies,
|
|
||||||
# see https://flutter.io/custom-fonts/#from-packages
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user