Skip to content

Commit

Permalink
Flutter plugin init
Browse files Browse the repository at this point in the history
  • Loading branch information
marchellodev committed Aug 5, 2021
1 parent 51b12ae commit 7558bef
Show file tree
Hide file tree
Showing 11 changed files with 714 additions and 0 deletions.
75 changes: 75 additions & 0 deletions packages/lucide-flutter/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
**/doc/api/
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
build/

# Android related
**/android/**/gradle-wrapper.jar
**/android/.gradle
**/android/captures/
**/android/gradlew
**/android/gradlew.bat
**/android/local.properties
**/android/**/GeneratedPluginRegistrant.java

# iOS/XCode related
**/ios/**/*.mode1v3
**/ios/**/*.mode2v3
**/ios/**/*.moved-aside
**/ios/**/*.pbxuser
**/ios/**/*.perspectivev3
**/ios/**/*sync/
**/ios/**/.sconsign.dblite
**/ios/**/.tags*
**/ios/**/.vagrant/
**/ios/**/DerivedData/
**/ios/**/Icon?
**/ios/**/Pods/
**/ios/**/.symlinks/
**/ios/**/profile
**/ios/**/xcuserdata
**/ios/.generated/
**/ios/Flutter/App.framework
**/ios/Flutter/Flutter.framework
**/ios/Flutter/Flutter.podspec
**/ios/Flutter/Generated.xcconfig
**/ios/Flutter/ephemeral
**/ios/Flutter/app.flx
**/ios/Flutter/app.zip
**/ios/Flutter/flutter_assets/
**/ios/Flutter/flutter_export_environment.sh
**/ios/ServiceDefinitions.json
**/ios/Runner/GeneratedPluginRegistrant.*

# Exceptions to above rules.
!**/ios/**/default.mode1v3
!**/ios/**/default.mode2v3
!**/ios/**/default.pbxuser
!**/ios/**/default.perspectivev3
3 changes: 3 additions & 0 deletions packages/lucide-flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 0.15.28

* Initial release
15 changes: 15 additions & 0 deletions packages/lucide-flutter/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
ISC License

Copyright (c) 2020, Lucide Contributors

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
8 changes: 8 additions & 0 deletions packages/lucide-flutter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# lucide_icons

Lucide Icons ([lucide.dev](https://lucide.dev)) for Flutter. Visit the website for the full list of icons

## Example
```dart
Icon(LucideIcons.activity);
```
18 changes: 18 additions & 0 deletions packages/lucide-flutter/analysis_option.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
include: package:lint/analysis_options.yaml

linter:
rules:
omit_local_variable_types: true
avoid_classes_with_only_static_members: false
prefer_single_quotes: true

file_names: false

avoid_setters_without_getters: false

sort_pub_dependencies: false

prefer_relative_imports: true

# only for debug
avoid_print: false
Binary file added packages/lucide-flutter/assets/Lucide.ttf
Binary file not shown.
9 changes: 9 additions & 0 deletions packages/lucide-flutter/example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
```dart
Icon(LucideIcons.activity);
Icon(LucideIcons.airplay);
// ...
// for full list see
// https://lucide.dev
```
498 changes: 498 additions & 0 deletions packages/lucide-flutter/lib/lucide_icons.dart

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions packages/lucide-flutter/lib/src/icon_data.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import 'package:flutter/widgets.dart';

class LucideIconData extends IconData {
const LucideIconData(int codePoint)
: super(
codePoint,
fontFamily: 'Lucide',
fontPackage: 'lucide_icons',
);
}
29 changes: 29 additions & 0 deletions packages/lucide-flutter/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: lucide_icons
description: Lucide icon pack for Flutter
version: 0.15.28
homepage: https://lucide.dev
repository: https://github.com/lucide-icons/lucide

environment:
sdk: ">=2.12.0 <3.0.0"
flutter: ">=1.17.0"

dependencies:
flutter:
sdk: flutter

dev_dependencies:
flutter_test:
sdk: flutter

html: ^0.15.0
recase: ^4.0.0

lint: ^1.5.3


flutter:
fonts:
- family: Lucide
fonts:
- asset: assets/Lucide.ttf
49 changes: 49 additions & 0 deletions packages/lucide-flutter/tool/generate_fonts.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import "dart:io";

import 'package:html/parser.dart' show parse;
import 'package:recase/recase.dart';

void main(List<String> args) {
File fontsPreviewFile = File(args[0]);

if (!fontsPreviewFile.existsSync()) {
print('lucide preview file not found');
exit(0);
}

String content = fontsPreviewFile.readAsStringSync();
final c = parse(content);
final list = c.getElementsByClassName('glyph');

List<String> generatedOutput = [
"library lucide_icons;\n",
"import \"package:flutter/widgets.dart\";\n",
"import \"src/icon_data.dart\";\n\n",
"// THIS FILE IS AUTOMATICALLY GENERATED!\n\n",
"class LucideIcons {\n"
];

for (final icon in list) {
final name = icon
.getElementsByClassName('class')
.first
.attributes['value']!
.replaceFirst('.icon-', '');
final val = icon
.getElementsByClassName('point')
.first
.attributes['value']!
.replaceFirst('&#x', '')
.replaceFirst(';', '');

generatedOutput.add(
"static const IconData ${ReCase(name).camelCase} = const LucideIconData(0x$val);\n");

print('$val $name');
}

generatedOutput.add("}\n");

File output = File('./lib/lucide_icons.dart');
output.writeAsStringSync(generatedOutput.join());
}

0 comments on commit 7558bef

Please sign in to comment.