mirror of
https://github.com/git-touch/git-touch
synced 2025-01-31 08:04:51 +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/widgets/link.dart';
|
||||
import 'package:primer/primer.dart';
|
||||
import 'package:seti/seti.dart';
|
||||
|
||||
class ObjectScreen extends StatelessWidget {
|
||||
final String owner;
|
||||
@ -37,14 +38,28 @@ class ObjectScreen extends StatelessWidget {
|
||||
'https://raw.githubusercontent.com/$owner/$name/$branch/' +
|
||||
paths.join('/'); // TODO:
|
||||
|
||||
IconData _buildIconData(item) {
|
||||
static const _iconDefaultColor = PrimerColors.blue300;
|
||||
|
||||
List<Widget> _buildIcon(item) {
|
||||
switch (item['type']) {
|
||||
case 'tree':
|
||||
return Octicons.file_directory;
|
||||
return [
|
||||
SizedBox(width: 10),
|
||||
Icon(Octicons.file_directory, color: _iconDefaultColor, size: 20),
|
||||
SizedBox(width: 10),
|
||||
];
|
||||
case 'blob':
|
||||
return Octicons.file;
|
||||
return [
|
||||
SizedBox(width: 6),
|
||||
SetiIcon(item['name'], size: 28),
|
||||
SizedBox(width: 6),
|
||||
];
|
||||
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) {
|
||||
var entries = payload['entries'] as List;
|
||||
return Column(
|
||||
children: entries.map((item) {
|
||||
return Link(
|
||||
screenBuilder: (context) {
|
||||
// TODO: All image types
|
||||
var ext = path.extension(item['name']);
|
||||
if (ext.isNotEmpty) ext = ext.substring(1);
|
||||
if (['png', 'jpg', 'jpeg'].contains(ext)) {
|
||||
return ImageView(NetworkImage('$rawUrl/' + item['name']));
|
||||
}
|
||||
return ObjectScreen(
|
||||
name: name,
|
||||
owner: owner,
|
||||
branch: branch,
|
||||
paths: [...paths, item['name']],
|
||||
type: item['type'],
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
border:
|
||||
Border(bottom: BorderSide(color: Colors.grey.shade100))),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Icon(_buildIconData(item), color: Color(0x80032f62), size: 20),
|
||||
SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Text(item['name'],
|
||||
style: TextStyle(
|
||||
fontSize: 16, color: PrimerColors.blue500)))
|
||||
],
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: join(
|
||||
BorderView(),
|
||||
entries.map((item) {
|
||||
return Link(
|
||||
screenBuilder: (context) {
|
||||
// TODO: All image types
|
||||
var ext = path.extension(item['name']);
|
||||
if (ext.isNotEmpty) ext = ext.substring(1);
|
||||
if (['png', 'jpg', 'jpeg'].contains(ext)) {
|
||||
return ImageView(NetworkImage('$rawUrl/' + item['name']));
|
||||
}
|
||||
return ObjectScreen(
|
||||
name: name,
|
||||
owner: owner,
|
||||
branch: branch,
|
||||
paths: [...paths, item['name']],
|
||||
type: item['type'],
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
height: 40,
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
..._buildIcon(item),
|
||||
Expanded(
|
||||
child: Text(item['name'],
|
||||
style: TextStyle(
|
||||
fontSize: 16, color: PrimerColors.gray900)))
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
35
pubspec.yaml
35
pubspec.yaml
@ -25,13 +25,14 @@ dependencies:
|
||||
shared_preferences: ^0.5.0
|
||||
nanoid: ^0.0.6
|
||||
share: ^0.6.0
|
||||
flutter_vector_icons: ^0.0.2
|
||||
flutter_vector_icons: ^0.2.1
|
||||
github_contributions: ^0.1.1
|
||||
flutter_svg: ^0.13.0
|
||||
launch_review: ^2.0.0
|
||||
flutter_highlight: ^0.3.0
|
||||
timeago: ^2.0.18
|
||||
provider: ^3.1.0
|
||||
seti: ^0.1.0
|
||||
primer:
|
||||
git:
|
||||
url: git://github.com/pd4d10/primer-flutter
|
||||
@ -52,38 +53,6 @@ dev_dependencies:
|
||||
|
||||
# The following section is specific to 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
|
||||
|
||||
# To add assets to your application, add an assets section, like this:
|
||||
# assets:
|
||||
# - images/a_dot_burr.jpeg
|
||||
# - images/a_dot_ham.jpeg
|
||||
|
||||
assets:
|
||||
- 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