Skip to content

Commit

Permalink
Add Flutter support to the FluentIcons library (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
aakash1313 authored Sep 17, 2020
1 parent 0cccf12 commit 1fb0cc1
Show file tree
Hide file tree
Showing 87 changed files with 33,693 additions and 562 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,26 @@ jobs:
- name: Generate BUILD.gn file for Android
run: python3 generate_build_gn_android.py
working-directory: importer

build-flutter:
name: Build Flutter library
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Use Node 11
uses: actions/setup-node@v1
with:
node-version: 11.x

- run: npm install
working-directory: importer

- name: Run generate script
run: npm run deploy:flutter
working-directory: importer

# TODO: https://github.com/microsoft/fluentui-system-icons/issues/34
# - name: Build Flutter library
# uses: ?
21 changes: 21 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@ jobs:
run: python3 generate_build_gn_android.py
working-directory: importer

## Flutter
- name: Run Flutter generate script
run: npm run deploy:flutter
working-directory: importer

# TODO: https://github.com/microsoft/fluentui-system-icons/issues/34
# - name: Build and publish Flutter library
# uses: ?

## Publish
# Needs to be "-E" instead of "-r" on macOS
- name: Replace version numbers in README.md
Expand All @@ -81,6 +90,18 @@ jobs:
sed -i.bk -r "s/[0-9]+\.[0-9]+\.[0-9]+/$NEW_VERSION/g" ios/FluentIcons.podspec
rm ios/FluentIcons.podspec.bk
# Needs to be "-E" instead of "-r" on macOS
- name: Replace version number in flutter/CHANGELOG.md
run: |
sed -i.bk -r "s/[0-9]+\.[0-9]+\.[0-9]+/$NEW_VERSION/g" flutter/CHANGELOG.md
rm flutter/CHANGELOG.md.bk
# Needs to be "-E" instead of "-r" on macOS
- name: Replace version number in flutter/pubspec.yaml
run: |
sed -i.bk -r "s/[0-9]+\.[0-9]+\.[0-9]+/$NEW_VERSION/g" pubspec.yaml
rm flutter/pubspec.yaml.bk
- name: Update icon sheet
run: python3 generate_icons_md.py

Expand Down
25 changes: 22 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Fluent System Icons
# Fluent UI System Icons

![CI](https://github.com/microsoft/fluentui-system-icons/workflows/CI/badge.svg)

Fluent System Icons are a collection of familiar, friendly and modern icons from Microsoft.
Fluent UI System Icons are a collection of familiar, friendly and modern icons from Microsoft.

![fluent system icons](art/readme-banner.png)

Expand Down Expand Up @@ -43,6 +43,18 @@ git "[email protected]:microsoft/fluentui-system-icons.git" "1.1.57"

For library docs, see [ios/README.md](ios/README.md).

### Flutter

In the `pubspec.yaml` of your flutter project, add the following dependency:

```yaml
dependencies:
...
fluentui_system_icons: "1.1.29"
```
For library docs, see [flutter/README.md](flutter/README.md)
## Contributing
### Importer
Expand Down Expand Up @@ -79,11 +91,18 @@ You can build and run the demo apps following the steps below.
3. Select the `sample-showcase` in the build configuration dropdown
4. Click run
### Flutter
Prerequisite: Make sure you have flutter configured in Android Studio
1. Open the [flutter](flutter) directory in Android Studio
2. Select the 'example' in the directory and open it in Android Studio
3. Click run
## Contact
Please feel free to [open a GitHub issue](https://github.com/microsoft/fluentui-system-icons/issues/new) and assign to the following points of contact with questions or requests.
* Jason Custer([@jasoncuster](https://github.com/jasoncuster)) / Spencer Nelson([@spencer-nelson](https://github.com/spencer-nelson)) / Joe Woodward([@thewoodpecker](https://github.com/thewoodpecker)) - Design
* Nick Romano([@nickromano](https://github.com/nickromano)) - iOS
* Nick Romano([@rickromano](https://github.com/nickromano)) - iOS
* Will Hou([@willhou](https://github.com/willhou)) - Android
* Akashdeep Singh([@aakash1313](https://github.com/aakash1313)) - Flutter
## Code of Conduct
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct) or contact [email protected] with any additional questions or comments.
89 changes: 89 additions & 0 deletions flutter/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/

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

# 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
.packages
.pub-cache/
.pub/
build/
# If you're building an application, you may want to check-in your pubspec.lock
pubspec.lock
.metadata

# 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/Generated.xcconfig
**/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
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages

example/android/\.project

example/android/\.settings/org\.eclipse\.buildship\.core\.prefs

example/android/app/\.classpath

example/android/app/\.project

example/android/app/\.settings/org\.eclipse\.buildship\.core\.prefs

example/ios/Flutter/flutter_export_environment\.sh
1 change: 1 addition & 0 deletions flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
## [1.1.54] - Complete change log present here https://github.com/microsoft/fluentui-system-icons/tags
22 changes: 22 additions & 0 deletions flutter/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Fluent UI System Icons
Copyright (c) Microsoft Corporation.

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
48 changes: 48 additions & 0 deletions flutter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Fluent UI System Icons

Fluent UI System Icons are a collection of familiar, friendly and modern icons from Microsoft.

👍 Like us on [pub.dev](https://pub.dev/packages/fluentui_system_icons)!

## Usage

```dart
import 'package:fluentui_system_icons/fluent_icons.dart';
class MyFlutterWidget extends StatelessWidget {
Widget build(BuildContext context) {
return IconButton(
// Use the FluentIcons + name of the icon you want
icon: Icon(FluentIcons.access_time_24_regular),
onPressed: () { print("Button pressed"); }
);
}
}
```
## Example

View the Flutter app in the [example](example) directory to see all the available `FluentUISystemIcons`.

## FAQs

### Why aren't the icons showing properly on mobile?

This is very common issue observed after including a library, please make sure you follow the below
mentioned steps from your terminal:
1. flutter pub get
2. flutter clean
3. Delete the app from your device/emulator
4. Rebuild and deploy the app again

### What does the number signify in the icons names?

The numbers in the icon signify the size of the icons.

### Why do i get this error `flutter --flow-control-collections are needed` while running the example app?

This generally when the app is not build properly. Please try the below steps:

1. flutter pub get
2. flutter clean
3. Invalidate caches and restart Android Studio

37 changes: 37 additions & 0 deletions flutter/example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/


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


# Flutter/Dart/Pub related
**/doc/api/
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
/build/
build/
# If you're building an application, you may want to check-in your pubspec.lock
pubspec.lock
ios/.generated/
packages


7 changes: 7 additions & 0 deletions flutter/example/android/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
gradle-wrapper.jar
/.gradle
/captures/
/gradlew
/gradlew.bat
/local.properties
GeneratedPluginRegistrant.java
63 changes: 63 additions & 0 deletions flutter/example/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 28

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}

lintOptions {
disable 'InvalidPackage'
}

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.flutter_sample_showcase"
minSdkVersion 16
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}

buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}

flutter {
source '../..'
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
Loading

0 comments on commit 1fb0cc1

Please sign in to comment.