Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/override icon color #4

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 35 additions & 7 deletions file_icon/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,40 @@
## [0.3.0] - 2020-02-10
# [1.0.0](https://github.com/git-touch/file-icon/compare/v0.3.0...v1.0.0) (2021-03-07)

- Rename to `file_icon`
- update `seti-ui` from upstream
### Bug Fixes

## [0.2.0] - 2019-09-11
- broken soft link ([3857ebb](https://github.com/git-touch/file-icon/commit/3857ebbbcc777106aae3c4c8fc1490d66cc7a502))
- example file_icon deps ([3f6afe3](https://github.com/git-touch/file-icon/commit/3f6afe32d21bd379052178e6a6bca72cdb45afd7))

- Refactor
### Features

## [0.1.0] - 2019-09-09
- null safety ([10777eb](https://github.com/git-touch/file-icon/commit/10777eba5a97e4015ccdfe7b23798309c9e5c2b0))

- First release
# [0.3.0](https://github.com/git-touch/file-icon/compare/v0.2.0...v0.3.0) (2020-02-10)

### Bug Fixes

- copy font dest ([3fe9b4f](https://github.com/git-touch/file-icon/commit/3fe9b4fddb185be276b13a3f750d503edee21d08))
- drop generated code ([a25d8ed](https://github.com/git-touch/file-icon/commit/a25d8ed0d6a121799a7c434ebf12e16c300a1bf0))
- font package ([92bc697](https://github.com/git-touch/file-icon/commit/92bc697ed836c69dbbddd660eb75932fc20143be))

# [0.2.0](https://github.com/git-touch/file-icon/compare/v0.1.0...v0.2.0) (2019-09-11)

### Bug Fixes

- extension match ([d546c0f](https://github.com/git-touch/file-icon/commit/d546c0f4c18843fcb543509a46a3c83ca20a994a))
- remove font package for web ([15e97ea](https://github.com/git-touch/file-icon/commit/15e97eae5c56658cbe61b93d7791c0343258432d))

### Features

- **gallery:** adjust name and size ([e5c2395](https://github.com/git-touch/file-icon/commit/e5c2395b0aa64826ff6740bed64e9da976d947f9))

# [0.1.0](https://github.com/git-touch/file-icon/compare/c9eab3ee12b57ea535badec60bbcff3456c0ebff...v0.1.0) (2019-09-09)

### Bug Fixes

- add default icon and color ([c66af33](https://github.com/git-touch/file-icon/commit/c66af3376b1062a9eed7951bd11f8a3f930760ae))
- add font package field ([17a6495](https://github.com/git-touch/file-icon/commit/17a6495952795d1799b214612ccee596dedde902))

### Features

- add widget to show icon by file name ([c9eab3e](https://github.com/git-touch/file-icon/commit/c9eab3ee12b57ea535badec60bbcff3456c0ebff))
3 changes: 3 additions & 0 deletions file_icon/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ class MyWidget extends StatelessWidget {

// Icon size
size: 32,

// Override icon color
color: Colors.black,
);
}
}
Expand Down
11 changes: 6 additions & 5 deletions file_icon/lib/file_icon.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ import 'src/data.dart';

class FileIcon extends StatelessWidget {
final String fileName;
final double size;
final double? size;
final Color? color;

FileIcon(String fileName, {this.size})
FileIcon(String fileName, {this.size, this.color})
: this.fileName = fileName.toLowerCase();

@override
Widget build(BuildContext context) {
String key;
String? key;

if (iconSetMap.containsKey(fileName)) {
key = fileName;
Expand All @@ -32,11 +33,11 @@ class FileIcon extends StatelessWidget {

return Icon(
IconData(
iconSetMap[key].codePoint,
iconSetMap[key]!.codePoint,
fontFamily: 'Seti',
fontPackage: 'file_icon',
),
color: Color(iconSetMap[key].color),
color: color ?? Color(iconSetMap[key]!.color),
size: size,
);
}
Expand Down
4 changes: 2 additions & 2 deletions file_icon/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: file_icon
description: File icons for different file types, auto detected by file name.
version: 0.3.0
version: 1.0.0
author: Rongjian Zhang <pd4d10@gmail.com>
homepage: https://github.com/pd4d10/file-icon

environment:
sdk: ">=2.3.0 <3.0.0"
sdk: ">=2.12.0 <3.0.0"

dependencies:
flutter:
Expand Down