diff --git a/third_party/packages/flutter_svg/CHANGELOG.md b/third_party/packages/flutter_svg/CHANGELOG.md new file mode 100644 index 000000000000..d17a8ff4c20f --- /dev/null +++ b/third_party/packages/flutter_svg/CHANGELOG.md @@ -0,0 +1,691 @@ +# CHANGES + +## 2.0.10+1 + +- Relax http dependency. + +## 2.0.10 + +- Use package:http for network requests, and allow injection of the client. +- Bump vector_graphics dependency. + +## 2.0.9 + +- Adds back `SvgPicture(theme:)` parameter with a deprecation. Although this + parameter was inherently broken, removing it would require a major semver + bump, which would cause consumers to miss out on important fixes. + +## 2.0.8 + +- Adds back `DefaultSvgTheme`. +- Bump vector_graphics to 1.1.9+1 +- Adds debugFillProperties +- Fix bug for cache keys. + +## 2.0.7 + +- Fix broken `matchTextDirection`. + +## 2.0.6 + +- Fix test-only issues with latest Flutter stable (3.10). +- Roll vector_graphics to higher minimum version. + +## 2.0.5 + +- Allow malformed UTF-8 in loaders. +- Make the cache respect the SvgTheme and ColorMapper, if present. + +## 2.0.4 + +- Newer version of vector_graphics. +- Caching bug fix. +- Reintroduce clipBehavior. + +## 2.0.3 + +- Require newer version of vector_graphics. +- Fix bug in cache that incorrectly fired assert. + +## 2.0.2 + +- Require newer version of vector_graphics with multiple fixes around + inheritence, patterns, and currentColor handling. + +## 2.0.1 + +- Disable Isolate parsing in debug mode. +- Fix internal Color representation leakage from `package:vector_graphics_compiler`. + +## 2.0.0+1 + +- Fix bug in asset loading from packages. + +## 2.0.0 + +- Use parsing backend from `vector_graphics_compiler`. + - Out of order defs now supported. + - Patterns supported. + - Many optimizations added. + - **REGRESSION**: Lost support for `dx` and `dy` on `text`. See + https://github.com/dnfield/vector_graphics/issues/44 if this is important to + you. +- Parse SVG data in background isolate by default. +- Use widgets/rendering strategy from `vector_graphics`. +- Much less caching. +- More tests work without special handling - most of parsing is now sync, + and the loaders know how to avoid using `compute` in tests. For SVGs that + contain images, `vg.waitForPendingDecodes` is available. + +**DEPRECATIONS** + +- The `VectorDrawable` classes have gone away. +- The `AvdPicture` and related classes/parser have gone away. +- The `PictureCache` and `PictureStream` classes have gone away. +- The `PicturePovider` class exists only for access to a no-op cache. +- Several static members on `SvgPicture` and the `svg` utility class have gone + away. +- The `color` and `colorBlendMode` properties have been removed. Instead, use + the `colorFilter` property. + +## 1.1.6 + +- Fix transforms on image tags, clipPaths. +- Avoid painting zero-width strokes. + +## 1.1.5 + +- More permissive about color strings. + +## 1.1.4 + +- Handle default image width/height properly. + +## 1.1.3 + +- Handle `pt` values. + +## 1.1.2 + +- Update path parsing/drawing dependencies to fix arc parsing bug. + +## 1.1.1+1 + +- Fix regression introduced in 1.1.1 +- Update fix for fill/stroke inheritence when currentColor is specified in the + SVG but not in the theme. + +## 1.1.1 + +- Fix a bug introduced in 1.1.0 related to fill/stroke inheritence. +- Explicit dev_dependency on flutter_lints +- Avoid deprecated API from Flutter. + +## 1.1.0 + +- Respect stroke* properties when a paint definition is used for a stroke. +- Respect stroke* properties from groups with no `@stroke` property. +- Bump package versions. + +## 1.0.3+1 + +- Fix bugs in picture disposal. + +## 1.0.3 + +- Use `longestLine` rather than `minIntrinsicWidth` to place text. +- Avoid unnecessary painting when a picture doesn't actually change in + [RenderPicture]. + +## 1.0.2 + +- Avoid cache invalidation when `currentColor` or font based units are not used. +- Support `rem` units. + +## 1.0.1 + +- Fix bug with incorrect fills in some cases of `` elements. +- Analysis cleanup of Dart code. +- Fix bug where self-closing `` tags could alter rendering. +- Fix bug where an invalid `@stroke-dasharray` could cause an infinite loop. +- Fix bugs related to nested `` elements in ``. +- Remove unnecessary `sync*` related code. + +## 1.0.0 + +- New widget/RenderObject implementation to avoid rebuilds/paints when + near or overlapping an animating widget. Also should improve raster + cacheability. +- Correctly list web as a supported platform. +- Support for em/ex units. +- Stable 1.0.0 release. + +## 0.23.0+1 + +- Missing commit that reduced breakages introduced in 0.23.0 + +## 0.23.0 + +- Support for currentColor +- Some API breaks around PictureProvider to support currentColor +- Support for `xml:space` +- Support for `text-decoration` +- Support for `font-style` + +## 0.22.1 + +- Pick up performance improvements in path_parsing 0.2.1 +- Performance improvements in XML parsing of SVGs. + +## 0.22.0 + +- Expose `PictureCache` on `PictureProvider`, and deprecate + `PictureProvider.cacheCount` and `PictureProvider.clearCache`. This is + intended to allow users to set a maximum cache size, which was previously + impossible. + +## 0.21.0+1 + +- Fix alignment/sizing issues introduced in 0.21.0 + +## 0.21.0 + +- Stable nullsafe release. + +## 0.21.0-nullsafety.1 + +- Fix bug introduced when width and height are both null on the widget. +- Use more efficient method for XML attribute parsing. + +## 0.21.0-nullsafety.0 + +- Fix sizing when both width and height are null. This is potentially breaking. +- Bump versions to stable nullsafe when possible +- Update README with links to alternative implementations of SVG in Flutter. +- Attempt to report file source/key when errors happen. +- Add missing platforms to example project, update Android embedding. +- Minor fixes for future error handling to respect new Dart rules/expectations. + +## 0.20.0-nullsafety.4 + +- Adds option `warningsAsErrors` that throws errors when detecting unsupported + SVG elements. + +## 0.20.0-nullsafety.3 + +- Fix broken image for pub. + +## 0.20.0-nullsafety.2 + +- Fix bug where HTTP headers were not passed along to the HTTP client. + +## 0.20.0-nullsafety.1 + +- Remove unnecessary package:collection dependency + +## 0.20.0-nullsafety.0 + +- Initial release with null safety +- Remove dead code +- Fix up incorrect `catchError` usages + +## 0.19.2+1 + +- Fix a bug where color filters were applied when they should not be. + +## 0.19.2 + +- Allow for opt-in/out of color filter caching behavior, undeprecate color + filtering on the providers, and allow for a global override. + +## 0.19.1 + +- Fix color filtering when BlendMode.color is used. + +## 0.19.0 + +- Avoid unnecessary cache invalidation of SVGs drawn with color changes by: + - Deprecate color filter related options on PictureProvider classes. + - Make ColorFilter a property on SvgPicture + - Use the ColorFiltered widget for filtered SVGs. +- Fix RTL rendering bug + +## 0.18.1 + +- Bump the path_drawing dependency to 0.4.1+1 +- Expose clipBehavior from FittedBox +- Expose SVG ids in `Drawable*` classes. +- Change type of `alignment` to `AlignmentGeometry` on `SvgPicture`. +- Fixed bug in transform parsing + +## 0.18.0 + +- Drop DiagnosticbleMixin usage. +- Bump XML dependency to ^4.1.0 and resolve deprecated API usages. +- Await futures in tests. + +## 0.17.4 + +- Allow `precachePicture` to take `null` for a `BuildContext`. +- Provide a clearer error message when nested `` elements are used. + +## 0.17.3+1 + +- Fixed regression in v0.17.3 for shape elements with no explicit fill but + explicit opacity. + +## 0.17.3 + +- Be more permissive about whitespace in transform attributes. +- Stop defaulting color to black when not present, fixing issue with colors + carried over from `use` elements. + +## 0.17.2 + +- Bumped minimum Flutter version to 1.6.7 to pick up DiagnosticableMixin. +- Allow more variations of whitespace in base64 encoded image data. + +## 0.17.1 + +- Fix for issue with `use` elements refering to groups or other `use` elements + not correctly applying styles. + +## 0.17.0 + +- Make ColorFiltering apply to whole layer instead of per paint operation. +- **BREAKING** Remove `colorFilter` parameter from `VectorDrawable.draw`. +- Fix color filtering for text. + +## 0.16.1 + +- Support `image` tags in `defs`. +- Make `DrawableRasterImage` implement `DrawableStyleable`. + +## 0.16.0 + +- Move `transform` out of `DrawableStyle` and onto `DrawableStyleable`. Shapes + already worked this way, and the transform logic was handled in a confusingly + different way than all the other style attributes. +- Support `` elements having `id`s. +- Properly apply transforms to referenced use eleemnts. + +## 0.15.0 + +- Respect transformations on `` tags. +- Be more tolerant of malformed base64 data, similar to browsers (specifically, + having spaces present in the data). ## 0.14.4 +- Apply masks in the correct order when blend modes are involved in shapes. + +## 0.14.4 + +- Support for masks on groups. +- Update example project to Android X. + +## 0.14.3 + +- Support for the `mix-blend-mode` attribute. + +## 0.14.2 + +- Format, open up obtainKey for testing. + +## 0.14.1 + +- Support for HSL colors (thanks to [@christianalfoni](https://github.com/christianalfoni)) + +## 0.14.0 + +- Added support for masks (thanks to [@krispypen](https://github.com/krispypen)) +- Allow for clearing of the picture cache + +## 0.13.1 + +- Fix case where color filters were incorrectly getting created. + +## 0.13.0+2 + +- Same fix for group opacity/saveLayer as in 0.12.4+2 + +## 0.13.0+1 + +- Bump path_drawing dependency, which includes bug fixes in parsing. + +## 0.13.0 + +- Updated SDK constraint to support new error message formats +- Updated error message formats +- Misc. updates for new SDK features + +## 0.12.4+2 + +- Changed version constraint to prevent pulling down from wrong flutter version. +- Fixed group opacity/saveLayer bug. + +## 0.12.4+1 + +- Bump dep on path_drawing which contains bugfixes for parsing. + +## 0.12.4 + +- Fixed `opacity` handling, particularly for groups. Previously, opacities were + averaged together, which resulted in incorrect compositing (particularly if + overlapping shapes were drawn within a group). Now, a new layer is created + with the opacity applied to the whole. This may cause some performance + degredation, but is more correct. +- Allow font-size to be specified in `px` (with an explicit postfix). +- Add `excludeFromSemantics` property for purely decorative SVGs. The default + value is false. + +## 0.12.3 + +- Fixed bug with stream completer unregistration. +- Fixed bug with text transforms in new parsing. +- Fixed bug with RGBA parsing for opacity + +## 0.12.2 + +- Fixed bug with AVD parsing from strings. + +## 0.12.1 + +- Support for `display="none"` and `visibility="hidden"`. + +## 0.12.0 + +- **BREAKING** Avoid scaling based on devicePixelRatio. This turned out to be a + mistake, and caused rendering inconsistencies across devices. It was + particularly harmful on devices where the ratio was less than 1.0. +- Add `precachePicture` method to allow for pre-caching of SVG assets. Similar + in functionality to `precacheImage` in the Flutter framework. Also added + improvements to error handling in the various related routines. + +## 0.11.0+1 + +- Format source code +- Remove unintentionally committed pubspec.lock + +## 0.11.0 + +- Rewrote parsing logic to unpin dart-xml dependency, and bumped Dart XML + dependency. +- Fix bug where unsupported elements could impact drawing. Unhandled elements + that have children will now be completely ignored. This is technically a + breaking change, as previously a child of an unsupported element could have + been drawn if it was supported. Fixes [#126](https://github.com/dnfield/flutter_svg/issues/126). + +## 0.10.4 + +- Fix bug in transform logic [#122](https://github.com/dnfield/flutter_svg/issues/122) +- Avoid defaulting to the rootBundle, using th DefaultAssetBundle instead when + resolving pictures [#118](https://github.com/dnfield/flutter_svg/pull/118) + +## 0.10.3 + +- Pin dart-xml to 3.2.5, as 3.3.0 is a breaking change (next release will + address this). +- Support `px` postfixes on many double literals. + +## 0.10.2 + +- Added a `semanticsLabel` property to `SvgPicture`. +- Updated tests to support async changes in Flutter's `Picture.toImage` method. + - This is breaking for tests - tests will now require a more recent version of + Flutter to run. It should not break consumers though. + +## 0.10.1 + +This is technically a breaking release, but it also includes important fixes for +v0.10.0. Rather than splitting the breaking parts out in to v0.11.0 so soon +after the release of v0.10.0, I'm including some more breaking changes here. +This will not normally be done. + +- Fix bug that caused `` elements that weren't self-closing to parse + improperly. +- Many documentation updates/improvements. +- Added support for gradients that use `xlink:href` +- **BREAKING**: Changed some of the methods on `DrawableDefinitionServer` to + support gradients better. +- **BREAKING**: Removed the `PaintServer` typedef, since this was only serving + gradients and we need to have more control there for `xlink:href` support. + +## 0.10.0+1 + +- Fix bug that caused an empty `` element prevent rendering. + +## 0.10.0 + +- Rewrite parsing to be more space efficient. +- Refactor parsing to enable more output possibilities. +- Create a dedicated SVG parsing class (SvgParser). +- Updates to text - better support for nested text/tspans. +- Miscellaneous bug fixes. +- Testing improvements. + +## 0.9.0+1 + +- Fix inheritance issues with `text-anchor`. +- Fix a few inconsistencies in text anchor processing/positioning. + +## 0.9.0 + +- **BREAKING** Improvements to text positioning. Thanks to @krispypen! + +## 0.8.3 + +- Implement support for `clipPath` outside of `defs` eleemnts. +- Implement support for `use` in a `clipPath`. +- Recommend `usvg` rather than `svgcleaner` per author's recommendation. + +## 0.8.2 + +- Make `DrawableNoop` implement `DrawableStyleable` to avoid crashing with + certain unhandled elements. +- Improve error reporting for certain `Flutter Logo which can be rendered by this package! + + +Draw SVG files using Flutter. + +## Getting Started + +Basic usage (to create an SVG rendering widget from an asset): + +```dart +final String assetName = 'assets/image.svg'; +final Widget svg = SvgPicture.asset( + assetName, + semanticsLabel: 'Acme Logo' +); +``` + +You can color/tint the image like so: + +```dart +final String assetName = 'assets/up_arrow.svg'; +final Widget svgIcon = SvgPicture.asset( + assetName, + colorFilter: ColorFilter.mode(Colors.red, BlendMode.srcIn), + semanticsLabel: 'A red up arrow' +); +``` + +The default placeholder is an empty box (`LimitedBox`) - although if a `height` +or `width` is specified on the `SvgPicture`, a `SizedBox` will be used instead +(which ensures better layout experience). There is currently no way to show an +Error visually, however errors will get properly logged to the console in debug +mode. + +You can also specify a placeholder widget. The placeholder will display during +parsing/loading (normally only relevant for network access). + +```dart +// Will print error messages to the console. +final String assetName = 'assets/image_that_does_not_exist.svg'; +final Widget svg = SvgPicture.asset( + assetName, +); + +final Widget networkSvg = SvgPicture.network( + 'https://site-that-takes-a-while.com/image.svg', + semanticsLabel: 'A shark?!', + placeholderBuilder: (BuildContext context) => Container( + padding: const EdgeInsets.all(30.0), + child: const CircularProgressIndicator()), +); +``` + +If you'd like to render the SVG to some other canvas, you can do something like: + +```dart +import 'package:flutter_svg/flutter_svg.dart'; +final String rawSvg = '''...'''; +final PictureInfo pictureInfo = await vg.loadPicture(SvgStringLoader(rawSvg), null); + +// You can draw the picture to a canvas: +canvas.drawPicture(pictureInfo.picture); + +// Or convert the picture to an image: +final ui.Image image = pictureInfo.picture.toImage(...); + +pictureInfo.picture.dispose(); +``` + +The `SvgPicture` helps to automate this logic, and it provides some convenience +wrappers for getting assets from multiple sources. Unlike the `vector_graphics` +package, this package _does not render the data to an `Image` at any point_. +This carries a performance penalty for some common use cases, but also allows +for more flexibility around scaling. + +## Precompiling and Optimizing SVGs + +The vector_graphics backend supports SVG compilation which produces a binary +format that is faster to parse and can optimize SVGs to reduce the amount of +clipping, masking, and overdraw. The SVG compilation is provided by +[`package:vector_graphics_compiler`](https://pub.dev/packages/vector_graphics_compiler). + +```sh +dart run vector_graphics_compiler -i assets/foo.svg -o assets/foo.svg.vec +``` + +The output `foo.svg.vec` can be loaded using the default constructor of +`SvgPicture`. + +```dart +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:vector_graphics/vector_graphics.dart'; + +final Widget svg = SvgPicture( + const AssetBytesLoader('assets/foo.svg.vec') +); +``` + +### Check SVG compatibility + +An SVG can be tested for compatibility with the vector graphics backend by +running the compiler locally to see if any errors are thrown. + +```sh +dart run vector_graphics_compiler -i $SVG_FILE -o $TEMPORARY_OUTPUT_TO_BE_DELETED --no-optimize-masks --no-optimize-clips --no-optimize-overdraw --no-tessellate +``` + +## Recommended Adobe Illustrator SVG Configuration +- In Styling: choose Presentation Attributes instead of Inline CSS because CSS is not fully supported. +- In Images: choose Embded not Linked to other file to get a single svg with no dependency to other files. +- In Objects IDs: choose layer names to add every layer name to svg tags or you can use minimal,it is optional. +![Export configuration](https://user-images.githubusercontent.com/2842459/62599914-91de9c00-b8fe-11e9-8fb7-4af57d5100f7.png) + +## SVG sample attribution + +SVGs in `/assets/w3samples` pulled from [W3 sample files](https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/) + +SVGs in `/assets/deborah_ufw` provided by @deborah-ufw + +SVGs in `/assets/simple` are pulled from trivial examples or generated to test +basic functionality - some of them come directly from the SVG 1.1 spec. Some +have also come or been adapted from issues raised in this repository. + +SVGs in `/assets/wikimedia` are pulled from [Wikimedia Commons](https://commons.wikimedia.org/wiki/Main_Page) + +Android Drawables in `/assets/android_vd` are pulled from Android Documentation +and examples. + +The Flutter Logo created based on the Flutter Logo Widget © Google. + +The Dart logo is from +[dartlang.org](https://github.com/dart-lang/site-shared/blob/master/src/_assets/images/dart/logo%2Btext/horizontal/original.svg) +© Google + +SVGs in `/assets/noto-emoji` are from [Google i18n noto-emoji](https://github.com/googlei18n/noto-emoji), +licensed under the Apache license. + +Please submit SVGs that can't render properly (e.g. that don't render here the +way they do in chrome), as long as they're not using anything "probably out of +scope" (above). diff --git a/third_party/packages/flutter_svg/example/.gitignore b/third_party/packages/flutter_svg/example/.gitignore new file mode 100644 index 000000000000..b2845c378966 --- /dev/null +++ b/third_party/packages/flutter_svg/example/.gitignore @@ -0,0 +1,13 @@ +.DS_Store +.dart_tool/ + +.packages +.pub/ + +build/ + +.flutter-plugins + +flutter_export_environment.sh + +flutter_*.log diff --git a/third_party/packages/flutter_svg/example/.metadata b/third_party/packages/flutter_svg/example/.metadata new file mode 100644 index 000000000000..7ac78721d199 --- /dev/null +++ b/third_party/packages/flutter_svg/example/.metadata @@ -0,0 +1,30 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled. + +version: + revision: 1725a26e2950a3d98e2af8c98759e11a47b2f90e + channel: master + +project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: 1725a26e2950a3d98e2af8c98759e11a47b2f90e + base_revision: 1725a26e2950a3d98e2af8c98759e11a47b2f90e + - platform: macos + create_revision: 1725a26e2950a3d98e2af8c98759e11a47b2f90e + base_revision: 1725a26e2950a3d98e2af8c98759e11a47b2f90e + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/third_party/packages/flutter_svg/example/README.md b/third_party/packages/flutter_svg/example/README.md new file mode 100644 index 000000000000..5a3229390ff8 --- /dev/null +++ b/third_party/packages/flutter_svg/example/README.md @@ -0,0 +1,12 @@ +# example + +A new Flutter project. + +## Getting Started + +For help getting started with Flutter, view our online +[documentation](https://flutter.io/). + +## Benchmarking + +`flutter drive --profile --endless-trace-buffer --target test_driver/bench.dart` diff --git a/third_party/packages/flutter_svg/example/analysis_options.yaml b/third_party/packages/flutter_svg/example/analysis_options.yaml new file mode 100644 index 000000000000..61b6c4de17c9 --- /dev/null +++ b/third_party/packages/flutter_svg/example/analysis_options.yaml @@ -0,0 +1,29 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +include: package:flutter_lints/flutter.yaml + +linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at + # https://dart-lang.github.io/linter/lints/index.html. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. + rules: + # avoid_print: false # Uncomment to disable the `avoid_print` rule + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/third_party/packages/flutter_svg/example/android/.gitignore b/third_party/packages/flutter_svg/example/android/.gitignore new file mode 100644 index 000000000000..0a741cb43d66 --- /dev/null +++ b/third_party/packages/flutter_svg/example/android/.gitignore @@ -0,0 +1,11 @@ +gradle-wrapper.jar +/.gradle +/captures/ +/gradlew +/gradlew.bat +/local.properties +GeneratedPluginRegistrant.java + +# Remember to never publicly share your keystore. +# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app +key.properties diff --git a/third_party/packages/flutter_svg/example/android/app/build.gradle b/third_party/packages/flutter_svg/example/android/app/build.gradle new file mode 100644 index 000000000000..fc7c0763dd33 --- /dev/null +++ b/third_party/packages/flutter_svg/example/android/app/build.gradle @@ -0,0 +1,59 @@ +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 31 + + sourceSets { + main.java.srcDirs += 'src/main/kotlin' + } + + defaultConfig { + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId "com.example.example" + minSdkVersion 16 + targetSdkVersion 30 + 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" +} diff --git a/third_party/packages/flutter_svg/example/android/app/src/debug/AndroidManifest.xml b/third_party/packages/flutter_svg/example/android/app/src/debug/AndroidManifest.xml new file mode 100644 index 000000000000..c208884f3014 --- /dev/null +++ b/third_party/packages/flutter_svg/example/android/app/src/debug/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/third_party/packages/flutter_svg/example/android/app/src/main/AndroidManifest.xml b/third_party/packages/flutter_svg/example/android/app/src/main/AndroidManifest.xml new file mode 100644 index 000000000000..6f325b42a72d --- /dev/null +++ b/third_party/packages/flutter_svg/example/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + diff --git a/third_party/packages/flutter_svg/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt b/third_party/packages/flutter_svg/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt new file mode 100644 index 000000000000..e793a000d6a9 --- /dev/null +++ b/third_party/packages/flutter_svg/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt @@ -0,0 +1,6 @@ +package com.example.example + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity: FlutterActivity() { +} diff --git a/third_party/packages/flutter_svg/example/android/app/src/main/res/drawable-v21/launch_background.xml b/third_party/packages/flutter_svg/example/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100644 index 000000000000..f74085f3f6a2 --- /dev/null +++ b/third_party/packages/flutter_svg/example/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/third_party/packages/flutter_svg/example/android/app/src/main/res/drawable/launch_background.xml b/third_party/packages/flutter_svg/example/android/app/src/main/res/drawable/launch_background.xml new file mode 100644 index 000000000000..304732f88420 --- /dev/null +++ b/third_party/packages/flutter_svg/example/android/app/src/main/res/drawable/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/third_party/packages/flutter_svg/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/third_party/packages/flutter_svg/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 000000000000..db77bb4b7b09 Binary files /dev/null and b/third_party/packages/flutter_svg/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/third_party/packages/flutter_svg/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/third_party/packages/flutter_svg/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 000000000000..17987b79bb8a Binary files /dev/null and b/third_party/packages/flutter_svg/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/third_party/packages/flutter_svg/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/third_party/packages/flutter_svg/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 000000000000..09d4391482be Binary files /dev/null and b/third_party/packages/flutter_svg/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/third_party/packages/flutter_svg/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/third_party/packages/flutter_svg/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 000000000000..d5f1c8d34e7a Binary files /dev/null and b/third_party/packages/flutter_svg/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/third_party/packages/flutter_svg/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/third_party/packages/flutter_svg/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 000000000000..4d6372eebdb2 Binary files /dev/null and b/third_party/packages/flutter_svg/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/third_party/packages/flutter_svg/example/android/app/src/main/res/values-night/styles.xml b/third_party/packages/flutter_svg/example/android/app/src/main/res/values-night/styles.xml new file mode 100644 index 000000000000..449a9f930826 --- /dev/null +++ b/third_party/packages/flutter_svg/example/android/app/src/main/res/values-night/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/third_party/packages/flutter_svg/example/android/app/src/main/res/values/styles.xml b/third_party/packages/flutter_svg/example/android/app/src/main/res/values/styles.xml new file mode 100644 index 000000000000..d74aa35c2826 --- /dev/null +++ b/third_party/packages/flutter_svg/example/android/app/src/main/res/values/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/third_party/packages/flutter_svg/example/android/app/src/profile/AndroidManifest.xml b/third_party/packages/flutter_svg/example/android/app/src/profile/AndroidManifest.xml new file mode 100644 index 000000000000..c208884f3014 --- /dev/null +++ b/third_party/packages/flutter_svg/example/android/app/src/profile/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/third_party/packages/flutter_svg/example/android/build.gradle b/third_party/packages/flutter_svg/example/android/build.gradle new file mode 100644 index 000000000000..e688f0a6933a --- /dev/null +++ b/third_party/packages/flutter_svg/example/android/build.gradle @@ -0,0 +1,33 @@ +buildscript { + // Do not copy this. It's strictly because this application does not care + // about Kotlin version and wants to always do its best to work. + ext.kotlin_version = '+' + repositories { + google() + jcenter() + } + + dependencies { + classpath 'com.android.tools.build:gradle:7.3.0' + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + } +} + +allprojects { + repositories { + google() + jcenter() + } +} + +rootProject.buildDir = '../build' +subprojects { + project.buildDir = "${rootProject.buildDir}/${project.name}" +} +subprojects { + project.evaluationDependsOn(':app') +} + +task clean(type: Delete) { + delete rootProject.buildDir +} diff --git a/third_party/packages/flutter_svg/example/android/example_android.iml b/third_party/packages/flutter_svg/example/android/example_android.iml new file mode 100644 index 000000000000..18999696a6a3 --- /dev/null +++ b/third_party/packages/flutter_svg/example/android/example_android.iml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/third_party/packages/flutter_svg/example/android/gradle.properties b/third_party/packages/flutter_svg/example/android/gradle.properties new file mode 100644 index 000000000000..94adc3a3f97a --- /dev/null +++ b/third_party/packages/flutter_svg/example/android/gradle.properties @@ -0,0 +1,3 @@ +org.gradle.jvmargs=-Xmx1536M +android.useAndroidX=true +android.enableJetifier=true diff --git a/third_party/packages/flutter_svg/example/android/gradle/wrapper/gradle-wrapper.properties b/third_party/packages/flutter_svg/example/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000000..6b665338b34e --- /dev/null +++ b/third_party/packages/flutter_svg/example/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Fri Jun 23 08:50:38 CEST 2017 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip diff --git a/third_party/packages/flutter_svg/example/android/settings.gradle b/third_party/packages/flutter_svg/example/android/settings.gradle new file mode 100644 index 000000000000..44e62bcf06ae --- /dev/null +++ b/third_party/packages/flutter_svg/example/android/settings.gradle @@ -0,0 +1,11 @@ +include ':app' + +def localPropertiesFile = new File(rootProject.projectDir, "local.properties") +def properties = new Properties() + +assert localPropertiesFile.exists() +localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } + +def flutterSdkPath = properties.getProperty("flutter.sdk") +assert flutterSdkPath != null, "flutter.sdk not set in local.properties" +apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" diff --git a/third_party/packages/flutter_svg/example/assets/android_vd/battery_charging.xml b/third_party/packages/flutter_svg/example/assets/android_vd/battery_charging.xml new file mode 100644 index 000000000000..61628a7602aa --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/android_vd/battery_charging.xml @@ -0,0 +1,22 @@ + + + + + + + \ No newline at end of file diff --git a/third_party/packages/flutter_svg/example/assets/dart.svg b/third_party/packages/flutter_svg/example/assets/dart.svg new file mode 100644 index 000000000000..261e2bbf97da --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/dart.svg @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/third_party/packages/flutter_svg/example/assets/deborah_ufw/new-action-expander.svg b/third_party/packages/flutter_svg/example/assets/deborah_ufw/new-action-expander.svg new file mode 100644 index 000000000000..3cbd1068517c --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/deborah_ufw/new-action-expander.svg @@ -0,0 +1,14 @@ + + + + + + + + diff --git a/third_party/packages/flutter_svg/example/assets/deborah_ufw/new-camera.svg b/third_party/packages/flutter_svg/example/assets/deborah_ufw/new-camera.svg new file mode 100644 index 000000000000..b49e595b6c94 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/deborah_ufw/new-camera.svg @@ -0,0 +1,21 @@ + + + + + + + diff --git a/third_party/packages/flutter_svg/example/assets/deborah_ufw/new-gif-button.svg b/third_party/packages/flutter_svg/example/assets/deborah_ufw/new-gif-button.svg new file mode 100644 index 000000000000..2340bf1acfb6 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/deborah_ufw/new-gif-button.svg @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + diff --git a/third_party/packages/flutter_svg/example/assets/deborah_ufw/new-gif.svg b/third_party/packages/flutter_svg/example/assets/deborah_ufw/new-gif.svg new file mode 100644 index 000000000000..cf9e9cab65be --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/deborah_ufw/new-gif.svg @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/third_party/packages/flutter_svg/example/assets/deborah_ufw/new-image.svg b/third_party/packages/flutter_svg/example/assets/deborah_ufw/new-image.svg new file mode 100644 index 000000000000..ed41cff77c18 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/deborah_ufw/new-image.svg @@ -0,0 +1,19 @@ + + + + + + + + diff --git a/third_party/packages/flutter_svg/example/assets/deborah_ufw/new-mention.svg b/third_party/packages/flutter_svg/example/assets/deborah_ufw/new-mention.svg new file mode 100644 index 000000000000..085a7d41b8b8 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/deborah_ufw/new-mention.svg @@ -0,0 +1,22 @@ + + + + + diff --git a/third_party/packages/flutter_svg/example/assets/deborah_ufw/new-pause-button.svg b/third_party/packages/flutter_svg/example/assets/deborah_ufw/new-pause-button.svg new file mode 100644 index 000000000000..90deeee9a5af --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/deborah_ufw/new-pause-button.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + diff --git a/third_party/packages/flutter_svg/example/assets/deborah_ufw/new-play-button.svg b/third_party/packages/flutter_svg/example/assets/deborah_ufw/new-play-button.svg new file mode 100644 index 000000000000..40799c91370e --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/deborah_ufw/new-play-button.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + diff --git a/third_party/packages/flutter_svg/example/assets/deborah_ufw/new-send-circle.svg b/third_party/packages/flutter_svg/example/assets/deborah_ufw/new-send-circle.svg new file mode 100644 index 000000000000..ab58e6b145fd --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/deborah_ufw/new-send-circle.svg @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + diff --git a/third_party/packages/flutter_svg/example/assets/deborah_ufw/numeric_25.svg b/third_party/packages/flutter_svg/example/assets/deborah_ufw/numeric_25.svg new file mode 100644 index 000000000000..ea6f38c2b3d8 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/deborah_ufw/numeric_25.svg @@ -0,0 +1,19 @@ + + + +icon-font/25/numeric_25 +Created with Sketch. + + + + diff --git a/third_party/packages/flutter_svg/example/assets/flutter_logo.svg b/third_party/packages/flutter_svg/example/assets/flutter_logo.svg new file mode 100644 index 000000000000..ec3d9144f352 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/flutter_logo.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/third_party/packages/flutter_svg/example/assets/noto-emoji/emoji_u1f600.svg b/third_party/packages/flutter_svg/example/assets/noto-emoji/emoji_u1f600.svg new file mode 100644 index 000000000000..9916423433b1 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/noto-emoji/emoji_u1f600.svg @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/third_party/packages/flutter_svg/example/assets/simple/blend_and_mask.svg b/third_party/packages/flutter_svg/example/assets/simple/blend_and_mask.svg new file mode 100644 index 000000000000..b914058f3967 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/blend_and_mask.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + diff --git a/third_party/packages/flutter_svg/example/assets/simple/blend_mode_devil.svg b/third_party/packages/flutter_svg/example/assets/simple/blend_mode_devil.svg new file mode 100644 index 000000000000..913bdf5df820 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/blend_mode_devil.svg @@ -0,0 +1,198 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 3Asset 23 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/third_party/packages/flutter_svg/example/assets/simple/clip_path.svg b/third_party/packages/flutter_svg/example/assets/simple/clip_path.svg new file mode 100644 index 000000000000..214d353b44f1 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/clip_path.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + diff --git a/third_party/packages/flutter_svg/example/assets/simple/clip_path_2.svg b/third_party/packages/flutter_svg/example/assets/simple/clip_path_2.svg new file mode 100644 index 000000000000..69e4f3fca3c0 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/clip_path_2.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/third_party/packages/flutter_svg/example/assets/simple/clip_path_3.svg b/third_party/packages/flutter_svg/example/assets/simple/clip_path_3.svg new file mode 100644 index 000000000000..93218c16db06 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/clip_path_3.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/third_party/packages/flutter_svg/example/assets/simple/clip_path_transform.svg b/third_party/packages/flutter_svg/example/assets/simple/clip_path_transform.svg new file mode 100644 index 000000000000..80a791eb12a7 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/clip_path_transform.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/third_party/packages/flutter_svg/example/assets/simple/dash_path.svg b/third_party/packages/flutter_svg/example/assets/simple/dash_path.svg new file mode 100644 index 000000000000..70f58f828251 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/dash_path.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/third_party/packages/flutter_svg/example/assets/simple/dash_zero.svg b/third_party/packages/flutter_svg/example/assets/simple/dash_zero.svg new file mode 100644 index 000000000000..b4c5925544d9 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/dash_zero.svg @@ -0,0 +1,3 @@ + + + diff --git a/third_party/packages/flutter_svg/example/assets/simple/ellipse.svg b/third_party/packages/flutter_svg/example/assets/simple/ellipse.svg new file mode 100644 index 000000000000..2ad80bdac7b5 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/ellipse.svg @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/third_party/packages/flutter_svg/example/assets/simple/empty_defs.svg b/third_party/packages/flutter_svg/example/assets/simple/empty_defs.svg new file mode 100644 index 000000000000..18e04804cc66 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/empty_defs.svg @@ -0,0 +1,13 @@ + + + + \ No newline at end of file diff --git a/third_party/packages/flutter_svg/example/assets/simple/empty_group.svg b/third_party/packages/flutter_svg/example/assets/simple/empty_group.svg new file mode 100644 index 000000000000..af423cf01068 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/empty_group.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/third_party/packages/flutter_svg/example/assets/simple/equation.svg b/third_party/packages/flutter_svg/example/assets/simple/equation.svg new file mode 100644 index 000000000000..4aa4df5f0675 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/equation.svg @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/third_party/packages/flutter_svg/example/assets/simple/fill-rule-inherit.svg b/third_party/packages/flutter_svg/example/assets/simple/fill-rule-inherit.svg new file mode 100644 index 000000000000..cedebd1a5c4e --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/fill-rule-inherit.svg @@ -0,0 +1,4 @@ + + + \ No newline at end of file diff --git a/third_party/packages/flutter_svg/example/assets/simple/fill_inheritence_test.svg b/third_party/packages/flutter_svg/example/assets/simple/fill_inheritence_test.svg new file mode 100644 index 000000000000..93a8222771c6 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/fill_inheritence_test.svg @@ -0,0 +1,4 @@ + + + + diff --git a/third_party/packages/flutter_svg/example/assets/simple/group_composite_opacity.svg b/third_party/packages/flutter_svg/example/assets/simple/group_composite_opacity.svg new file mode 100644 index 000000000000..9a87ce3c29ed --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/group_composite_opacity.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + diff --git a/third_party/packages/flutter_svg/example/assets/simple/group_fill_opacity.svg b/third_party/packages/flutter_svg/example/assets/simple/group_fill_opacity.svg new file mode 100644 index 000000000000..44216e06c1c3 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/group_fill_opacity.svg @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/third_party/packages/flutter_svg/example/assets/simple/group_in_defs.svg b/third_party/packages/flutter_svg/example/assets/simple/group_in_defs.svg new file mode 100644 index 000000000000..243c4b3ea47d --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/group_in_defs.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/third_party/packages/flutter_svg/example/assets/simple/group_mask.svg b/third_party/packages/flutter_svg/example/assets/simple/group_mask.svg new file mode 100644 index 000000000000..0d97150a2504 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/group_mask.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/third_party/packages/flutter_svg/example/assets/simple/group_opacity.svg b/third_party/packages/flutter_svg/example/assets/simple/group_opacity.svg new file mode 100644 index 000000000000..85e75db327fb --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/group_opacity.svg @@ -0,0 +1,46 @@ + + + + Example opacity01 - opacity property + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/third_party/packages/flutter_svg/example/assets/simple/group_opacity_transform.svg b/third_party/packages/flutter_svg/example/assets/simple/group_opacity_transform.svg new file mode 100644 index 000000000000..050226d65ad4 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/group_opacity_transform.svg @@ -0,0 +1,9 @@ + + + + + + + + diff --git a/third_party/packages/flutter_svg/example/assets/simple/hidden.svg b/third_party/packages/flutter_svg/example/assets/simple/hidden.svg new file mode 100644 index 000000000000..e53744f7b5d1 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/hidden.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/third_party/packages/flutter_svg/example/assets/simple/href-fill.svg b/third_party/packages/flutter_svg/example/assets/simple/href-fill.svg new file mode 100644 index 000000000000..4e0817155d79 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/href-fill.svg @@ -0,0 +1,16 @@ + + + + + + + + diff --git a/third_party/packages/flutter_svg/example/assets/simple/image.svg b/third_party/packages/flutter_svg/example/assets/simple/image.svg new file mode 100644 index 000000000000..fb8249c83623 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/image.svg @@ -0,0 +1,8 @@ + + + + diff --git a/third_party/packages/flutter_svg/example/assets/simple/image_def.svg b/third_party/packages/flutter_svg/example/assets/simple/image_def.svg new file mode 100644 index 000000000000..35b2bbe82790 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/image_def.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/third_party/packages/flutter_svg/example/assets/simple/image_transform_before_translate.svg b/third_party/packages/flutter_svg/example/assets/simple/image_transform_before_translate.svg new file mode 100644 index 000000000000..f74b1a25893b --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/image_transform_before_translate.svg @@ -0,0 +1,5 @@ + + + \ No newline at end of file diff --git a/third_party/packages/flutter_svg/example/assets/simple/implicit_fill_with_opacity.svg b/third_party/packages/flutter_svg/example/assets/simple/implicit_fill_with_opacity.svg new file mode 100644 index 000000000000..309055e3c3fd --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/implicit_fill_with_opacity.svg @@ -0,0 +1,4 @@ + + + + diff --git a/third_party/packages/flutter_svg/example/assets/simple/invalid_dash_array.svg b/third_party/packages/flutter_svg/example/assets/simple/invalid_dash_array.svg new file mode 100644 index 000000000000..24b0b96cf0c5 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/invalid_dash_array.svg @@ -0,0 +1,3 @@ +a + + \ No newline at end of file diff --git a/third_party/packages/flutter_svg/example/assets/simple/linear_gradient.svg b/third_party/packages/flutter_svg/example/assets/simple/linear_gradient.svg new file mode 100644 index 000000000000..71de9c64894e --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/linear_gradient.svg @@ -0,0 +1,11 @@ + + + + + + + + + + \ No newline at end of file diff --git a/third_party/packages/flutter_svg/example/assets/simple/linear_gradient_2.svg b/third_party/packages/flutter_svg/example/assets/simple/linear_gradient_2.svg new file mode 100644 index 000000000000..54c92ead9c37 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/linear_gradient_2.svg @@ -0,0 +1,24 @@ + + + + Example lingrad01 - fill a rectangle using a + linear gradient paint server + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/third_party/packages/flutter_svg/example/assets/simple/linear_gradient_absolute_user_space_translate.svg b/third_party/packages/flutter_svg/example/assets/simple/linear_gradient_absolute_user_space_translate.svg new file mode 100644 index 000000000000..14245d72b257 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/linear_gradient_absolute_user_space_translate.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/third_party/packages/flutter_svg/example/assets/simple/linear_gradient_percentage_bounding_translate.svg b/third_party/packages/flutter_svg/example/assets/simple/linear_gradient_percentage_bounding_translate.svg new file mode 100644 index 000000000000..272eae3fb1db --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/linear_gradient_percentage_bounding_translate.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/third_party/packages/flutter_svg/example/assets/simple/linear_gradient_percentage_user_space_translate.svg b/third_party/packages/flutter_svg/example/assets/simple/linear_gradient_percentage_user_space_translate.svg new file mode 100644 index 000000000000..cd8a97a8e2f1 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/linear_gradient_percentage_user_space_translate.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/third_party/packages/flutter_svg/example/assets/simple/linear_gradient_xlink.svg b/third_party/packages/flutter_svg/example/assets/simple/linear_gradient_xlink.svg new file mode 100644 index 000000000000..b20f1dd1be51 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/linear_gradient_xlink.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/third_party/packages/flutter_svg/example/assets/simple/male.svg b/third_party/packages/flutter_svg/example/assets/simple/male.svg new file mode 100644 index 000000000000..5dc9f18ff316 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/male.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/third_party/packages/flutter_svg/example/assets/simple/mask.svg b/third_party/packages/flutter_svg/example/assets/simple/mask.svg new file mode 100644 index 000000000000..c2e447f926e5 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/mask.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/third_party/packages/flutter_svg/example/assets/simple/mask_with_gradient.svg b/third_party/packages/flutter_svg/example/assets/simple/mask_with_gradient.svg new file mode 100644 index 000000000000..8524a1349963 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/mask_with_gradient.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/third_party/packages/flutter_svg/example/assets/simple/mask_with_use.svg b/third_party/packages/flutter_svg/example/assets/simple/mask_with_use.svg new file mode 100644 index 000000000000..ee5e01fa39a3 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/mask_with_use.svg @@ -0,0 +1,10 @@ + + + + + + + + \ No newline at end of file diff --git a/third_party/packages/flutter_svg/example/assets/simple/mask_with_use2.svg b/third_party/packages/flutter_svg/example/assets/simple/mask_with_use2.svg new file mode 100644 index 000000000000..9a12ee155786 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/mask_with_use2.svg @@ -0,0 +1,15 @@ + + + + + + + + +   + +   + + diff --git a/third_party/packages/flutter_svg/example/assets/simple/nested_group.svg b/third_party/packages/flutter_svg/example/assets/simple/nested_group.svg new file mode 100644 index 000000000000..e0677f87089e --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/nested_group.svg @@ -0,0 +1,8 @@ + + + + + + + \ No newline at end of file diff --git a/third_party/packages/flutter_svg/example/assets/simple/opacity_on_path.svg b/third_party/packages/flutter_svg/example/assets/simple/opacity_on_path.svg new file mode 100644 index 000000000000..481dd35233f8 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/opacity_on_path.svg @@ -0,0 +1,4 @@ + + + diff --git a/third_party/packages/flutter_svg/example/assets/simple/radial_gradient.svg b/third_party/packages/flutter_svg/example/assets/simple/radial_gradient.svg new file mode 100644 index 000000000000..c7de1853734e --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/radial_gradient.svg @@ -0,0 +1,23 @@ + + + + Example radgrad01 - fill a rectangle by referencing a + radial gradient paint server + + + + + + + + + + + + + + + + diff --git a/third_party/packages/flutter_svg/example/assets/simple/radial_gradient_absolute_user_space_translate.svg b/third_party/packages/flutter_svg/example/assets/simple/radial_gradient_absolute_user_space_translate.svg new file mode 100644 index 000000000000..9b31aaa99d41 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/radial_gradient_absolute_user_space_translate.svg @@ -0,0 +1,10 @@ + + + + + + + + + diff --git a/third_party/packages/flutter_svg/example/assets/simple/radial_gradient_focal.svg b/third_party/packages/flutter_svg/example/assets/simple/radial_gradient_focal.svg new file mode 100644 index 000000000000..862c829f50b3 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/radial_gradient_focal.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/third_party/packages/flutter_svg/example/assets/simple/radial_gradient_percentage_bounding_translate.svg b/third_party/packages/flutter_svg/example/assets/simple/radial_gradient_percentage_bounding_translate.svg new file mode 100644 index 000000000000..91279aa96eb1 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/radial_gradient_percentage_bounding_translate.svg @@ -0,0 +1,10 @@ + + + + + + + + + diff --git a/third_party/packages/flutter_svg/example/assets/simple/radial_gradient_percentage_user_space_translate.svg b/third_party/packages/flutter_svg/example/assets/simple/radial_gradient_percentage_user_space_translate.svg new file mode 100644 index 000000000000..7d8827bc4036 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/radial_gradient_percentage_user_space_translate.svg @@ -0,0 +1,10 @@ + + + + + + + + + diff --git a/third_party/packages/flutter_svg/example/assets/simple/radial_gradient_xlink.svg b/third_party/packages/flutter_svg/example/assets/simple/radial_gradient_xlink.svg new file mode 100644 index 000000000000..ea3f3cd0ba1e --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/radial_gradient_xlink.svg @@ -0,0 +1,24 @@ + + + + Example radgrad01 - fill a rectangle by referencing a + radial gradient paint server + + + + + + + + + + + + + + + + + diff --git a/third_party/packages/flutter_svg/example/assets/simple/radial_ref_linear_gradient.svg b/third_party/packages/flutter_svg/example/assets/simple/radial_ref_linear_gradient.svg new file mode 100644 index 000000000000..cb3ad4142a05 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/radial_ref_linear_gradient.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + diff --git a/third_party/packages/flutter_svg/example/assets/simple/rect_rrect.svg b/third_party/packages/flutter_svg/example/assets/simple/rect_rrect.svg new file mode 100644 index 000000000000..24ce5bcbb0eb --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/rect_rrect.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/third_party/packages/flutter_svg/example/assets/simple/rect_rrect_no_ry.svg b/third_party/packages/flutter_svg/example/assets/simple/rect_rrect_no_ry.svg new file mode 100644 index 000000000000..59734736b771 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/rect_rrect_no_ry.svg @@ -0,0 +1,3 @@ + + + diff --git a/third_party/packages/flutter_svg/example/assets/simple/stroke_inherit_circles.svg b/third_party/packages/flutter_svg/example/assets/simple/stroke_inherit_circles.svg new file mode 100644 index 000000000000..804bfad35d6d --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/stroke_inherit_circles.svg @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/third_party/packages/flutter_svg/example/assets/simple/style_attr.svg b/third_party/packages/flutter_svg/example/assets/simple/style_attr.svg new file mode 100644 index 000000000000..1c42fd79dd0f --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/style_attr.svg @@ -0,0 +1,6 @@ + + + diff --git a/third_party/packages/flutter_svg/example/assets/simple/text.svg b/third_party/packages/flutter_svg/example/assets/simple/text.svg new file mode 100644 index 000000000000..ac5bb68b079a --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/text.svg @@ -0,0 +1,16 @@ + + + + Example text01 - 'Hello, out there' in blue + + + Hello, out there + + + + + \ No newline at end of file diff --git a/third_party/packages/flutter_svg/example/assets/simple/text_2.svg b/third_party/packages/flutter_svg/example/assets/simple/text_2.svg new file mode 100644 index 000000000000..077e16e4678b --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/text_2.svg @@ -0,0 +1,28 @@ + + + + Example text01 + + + Plain text Roboto + + Plain text Verdana + + + Bold text Verdana + + + + + + Stroked bold line + Line 3 + + \ No newline at end of file diff --git a/third_party/packages/flutter_svg/example/assets/simple/text_3.svg b/third_party/packages/flutter_svg/example/assets/simple/text_3.svg new file mode 100644 index 000000000000..38fee3d76840 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/text_3.svg @@ -0,0 +1,11 @@ + + + + + + + platform + flutter|dart vm + + \ No newline at end of file diff --git a/third_party/packages/flutter_svg/example/assets/simple/text_4.svg b/third_party/packages/flutter_svg/example/assets/simple/text_4.svg new file mode 100644 index 000000000000..4348492e7d44 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/text_4.svg @@ -0,0 +1,22 @@ + + + + Example text04 - Font style + + + Normal text + + Italic text + + + Oblique text + + + Italic bold text + diff --git a/third_party/packages/flutter_svg/example/assets/simple/text_5.svg b/third_party/packages/flutter_svg/example/assets/simple/text_5.svg new file mode 100644 index 000000000000..63f711fb196a --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/text_5.svg @@ -0,0 +1,21 @@ + + + Example text05 - Text decoration + + + Overline text + + + Strike text + + + Underline text + + diff --git a/third_party/packages/flutter_svg/example/assets/simple/text_6.svg b/third_party/packages/flutter_svg/example/assets/simple/text_6.svg new file mode 100644 index 000000000000..f1bd9d00f4c8 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/text_6.svg @@ -0,0 +1,18 @@ + + + Example text 06 - Text anchor + + + Text anchor start + + + Text anchor middle + + + Text anchor end + + diff --git a/third_party/packages/flutter_svg/example/assets/simple/use_circles.svg b/third_party/packages/flutter_svg/example/assets/simple/use_circles.svg new file mode 100644 index 000000000000..56b1e49614cf --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/use_circles.svg @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/third_party/packages/flutter_svg/example/assets/simple/use_circles_def.svg b/third_party/packages/flutter_svg/example/assets/simple/use_circles_def.svg new file mode 100644 index 000000000000..3df93330803a --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/use_circles_def.svg @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/third_party/packages/flutter_svg/example/assets/simple/use_emc2.svg b/third_party/packages/flutter_svg/example/assets/simple/use_emc2.svg new file mode 100644 index 000000000000..8a3982f780e9 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/use_emc2.svg @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/third_party/packages/flutter_svg/example/assets/simple/use_fill.svg b/third_party/packages/flutter_svg/example/assets/simple/use_fill.svg new file mode 100644 index 000000000000..5f87895642ea --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/use_fill.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/third_party/packages/flutter_svg/example/assets/simple/use_fill_test.svg b/third_party/packages/flutter_svg/example/assets/simple/use_fill_test.svg new file mode 100644 index 000000000000..3bf0fe96a3e1 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/use_fill_test.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/third_party/packages/flutter_svg/example/assets/simple/use_opacity_grid.svg b/third_party/packages/flutter_svg/example/assets/simple/use_opacity_grid.svg new file mode 100644 index 000000000000..cee08c158a81 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/use_opacity_grid.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/third_party/packages/flutter_svg/example/assets/simple/width_height_viewbox.svg b/third_party/packages/flutter_svg/example/assets/simple/width_height_viewbox.svg new file mode 100644 index 000000000000..99658b912dc3 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/width_height_viewbox.svg @@ -0,0 +1,15 @@ + + + Close + Created with Sketch. + + + + + + + + + + + \ No newline at end of file diff --git a/third_party/packages/flutter_svg/example/assets/simple/zero_width_strokes.svg b/third_party/packages/flutter_svg/example/assets/simple/zero_width_strokes.svg new file mode 100644 index 000000000000..36e37d8d7b95 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/simple/zero_width_strokes.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/third_party/packages/flutter_svg/example/assets/svg_currentcolor.svg b/third_party/packages/flutter_svg/example/assets/svg_currentcolor.svg new file mode 100644 index 000000000000..850efed2c235 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/svg_currentcolor.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/third_party/packages/flutter_svg/example/assets/text_transform.svg b/third_party/packages/flutter_svg/example/assets/text_transform.svg new file mode 100644 index 000000000000..8ca73425908d --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/text_transform.svg @@ -0,0 +1,8 @@ + + + + + A + + + diff --git a/third_party/packages/flutter_svg/example/assets/w3samples/aa.svg b/third_party/packages/flutter_svg/example/assets/w3samples/aa.svg new file mode 100644 index 000000000000..2f2d26b165a7 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/w3samples/aa.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/third_party/packages/flutter_svg/example/assets/w3samples/alphachannel.svg b/third_party/packages/flutter_svg/example/assets/w3samples/alphachannel.svg new file mode 100644 index 000000000000..be7bf45d07ee --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/w3samples/alphachannel.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/third_party/packages/flutter_svg/example/assets/wikimedia/Firefox_Logo_2017.svg b/third_party/packages/flutter_svg/example/assets/wikimedia/Firefox_Logo_2017.svg new file mode 100644 index 000000000000..87caae6a7913 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/wikimedia/Firefox_Logo_2017.svg @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + firefox-logo + + + + + + + + + + + + + + + + + diff --git a/third_party/packages/flutter_svg/example/assets/wikimedia/Flag_of_the_United_States.svg b/third_party/packages/flutter_svg/example/assets/wikimedia/Flag_of_the_United_States.svg new file mode 100644 index 000000000000..05de0d229a7d --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/wikimedia/Flag_of_the_United_States.svg @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/third_party/packages/flutter_svg/example/assets/wikimedia/Ghostscript_Tiger.svg b/third_party/packages/flutter_svg/example/assets/wikimedia/Ghostscript_Tiger.svg new file mode 100644 index 000000000000..679edec2eb3f --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/wikimedia/Ghostscript_Tiger.svg @@ -0,0 +1,725 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/third_party/packages/flutter_svg/example/assets/wikimedia/chess_knight.svg b/third_party/packages/flutter_svg/example/assets/wikimedia/chess_knight.svg new file mode 100644 index 000000000000..72b429e0b060 --- /dev/null +++ b/third_party/packages/flutter_svg/example/assets/wikimedia/chess_knight.svg @@ -0,0 +1,23 @@ + + + + + + + + + + + + diff --git a/third_party/packages/flutter_svg/example/example.iml b/third_party/packages/flutter_svg/example/example.iml new file mode 100644 index 000000000000..e5c837191e06 --- /dev/null +++ b/third_party/packages/flutter_svg/example/example.iml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/third_party/packages/flutter_svg/example/example_android.iml b/third_party/packages/flutter_svg/example/example_android.iml new file mode 100644 index 000000000000..b050030a1b87 --- /dev/null +++ b/third_party/packages/flutter_svg/example/example_android.iml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + diff --git a/third_party/packages/flutter_svg/example/ios/.gitignore b/third_party/packages/flutter_svg/example/ios/.gitignore new file mode 100644 index 000000000000..79cc4da802e9 --- /dev/null +++ b/third_party/packages/flutter_svg/example/ios/.gitignore @@ -0,0 +1,45 @@ +.idea/ +.vagrant/ +.sconsign.dblite +.svn/ + +.DS_Store +*.swp +profile + +DerivedData/ +build/ +GeneratedPluginRegistrant.h +GeneratedPluginRegistrant.m + +.generated/ + +*.pbxuser +*.mode1v3 +*.mode2v3 +*.perspectivev3 + +!default.pbxuser +!default.mode1v3 +!default.mode2v3 +!default.perspectivev3 + +xcuserdata + +*.moved-aside + +*.pyc +*sync/ +Icon? +.tags* + +/Flutter/app.flx +/Flutter/app.zip +/Flutter/flutter_assets/ +/Flutter/App.framework +/Flutter/Flutter.framework +/Flutter/Generated.xcconfig +/ServiceDefinitions.json + +Pods/ +.symlinks/ diff --git a/third_party/packages/flutter_svg/example/ios/Flutter/AppFrameworkInfo.plist b/third_party/packages/flutter_svg/example/ios/Flutter/AppFrameworkInfo.plist new file mode 100644 index 000000000000..9367d483e44e --- /dev/null +++ b/third_party/packages/flutter_svg/example/ios/Flutter/AppFrameworkInfo.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + App + CFBundleIdentifier + io.flutter.flutter.app + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + App + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + MinimumOSVersion + 8.0 + + diff --git a/third_party/packages/flutter_svg/example/ios/Flutter/Debug.xcconfig b/third_party/packages/flutter_svg/example/ios/Flutter/Debug.xcconfig new file mode 100644 index 000000000000..592ceee85b89 --- /dev/null +++ b/third_party/packages/flutter_svg/example/ios/Flutter/Debug.xcconfig @@ -0,0 +1 @@ +#include "Generated.xcconfig" diff --git a/third_party/packages/flutter_svg/example/ios/Flutter/Release.xcconfig b/third_party/packages/flutter_svg/example/ios/Flutter/Release.xcconfig new file mode 100644 index 000000000000..592ceee85b89 --- /dev/null +++ b/third_party/packages/flutter_svg/example/ios/Flutter/Release.xcconfig @@ -0,0 +1 @@ +#include "Generated.xcconfig" diff --git a/third_party/packages/flutter_svg/example/ios/Runner.xcodeproj/project.pbxproj b/third_party/packages/flutter_svg/example/ios/Runner.xcodeproj/project.pbxproj new file mode 100644 index 000000000000..31f0eb3512c1 --- /dev/null +++ b/third_party/packages/flutter_svg/example/ios/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,493 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; + 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; + 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 9705A1C41CF9048500538489 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; + 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; + 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; + 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 97C146EB1CF9000F007C117D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 9740EEB11CF90186004384FC /* Flutter */ = { + isa = PBXGroup; + children = ( + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 9740EEB31CF90195004384FC /* Generated.xcconfig */, + ); + name = Flutter; + sourceTree = ""; + }; + 97C146E51CF9000F007C117D = { + isa = PBXGroup; + children = ( + 9740EEB11CF90186004384FC /* Flutter */, + 97C146F01CF9000F007C117D /* Runner */, + 97C146EF1CF9000F007C117D /* Products */, + ); + sourceTree = ""; + }; + 97C146EF1CF9000F007C117D /* Products */ = { + isa = PBXGroup; + children = ( + 97C146EE1CF9000F007C117D /* Runner.app */, + ); + name = Products; + sourceTree = ""; + }; + 97C146F01CF9000F007C117D /* Runner */ = { + isa = PBXGroup; + children = ( + 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */, + 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */, + 97C146FA1CF9000F007C117D /* Main.storyboard */, + 97C146FD1CF9000F007C117D /* Assets.xcassets */, + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, + 97C147021CF9000F007C117D /* Info.plist */, + 97C146F11CF9000F007C117D /* Supporting Files */, + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, + ); + path = Runner; + sourceTree = ""; + }; + 97C146F11CF9000F007C117D /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 97C146F21CF9000F007C117D /* main.m */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 97C146ED1CF9000F007C117D /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + 9740EEB61CF901F6004384FC /* Run Script */, + 97C146EA1CF9000F007C117D /* Sources */, + 97C146EB1CF9000F007C117D /* Frameworks */, + 97C146EC1CF9000F007C117D /* Resources */, + 9705A1C41CF9048500538489 /* Embed Frameworks */, + 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Runner; + productName = Runner; + productReference = 97C146EE1CF9000F007C117D /* Runner.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 97C146E61CF9000F007C117D /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0910; + ORGANIZATIONNAME = "The Chromium Authors"; + TargetAttributes = { + 97C146ED1CF9000F007C117D = { + CreatedOnToolsVersion = 7.3.1; + DevelopmentTeam = S8QB4VV633; + }; + }; + }; + buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 97C146E51CF9000F007C117D; + productRefGroup = 97C146EF1CF9000F007C117D /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 97C146ED1CF9000F007C117D /* Runner */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 97C146EC1CF9000F007C117D /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, + 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */, + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Thin Binary"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; + }; + 9740EEB61CF901F6004384FC /* Run Script */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Run Script"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 97C146EA1CF9000F007C117D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */, + 97C146F31CF9000F007C117D /* main.m in Sources */, + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 97C146FA1CF9000F007C117D /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C146FB1CF9000F007C117D /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C147001CF9000F007C117D /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 24247ED7217E8F7400BE4BD8 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Profile; + }; + 24247ED8217E8F7400BE4BD8 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + DEVELOPMENT_TEAM = S8QB4VV633; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.example; + PRODUCT_NAME = "$(TARGET_NAME)"; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Profile; + }; + 97C147031CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 97C147041CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 97C147061CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + DEVELOPMENT_TEAM = S8QB4VV633; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.example; + PRODUCT_NAME = "$(TARGET_NAME)"; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Debug; + }; + 97C147071CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + DEVELOPMENT_TEAM = S8QB4VV633; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.example; + PRODUCT_NAME = "$(TARGET_NAME)"; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147031CF9000F007C117D /* Debug */, + 97C147041CF9000F007C117D /* Release */, + 24247ED7217E8F7400BE4BD8 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147061CF9000F007C117D /* Debug */, + 97C147071CF9000F007C117D /* Release */, + 24247ED8217E8F7400BE4BD8 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 97C146E61CF9000F007C117D /* Project object */; +} diff --git a/third_party/packages/flutter_svg/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/third_party/packages/flutter_svg/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 000000000000..1d526a16ed0f --- /dev/null +++ b/third_party/packages/flutter_svg/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/third_party/packages/flutter_svg/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/third_party/packages/flutter_svg/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 000000000000..18d981003d68 --- /dev/null +++ b/third_party/packages/flutter_svg/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/third_party/packages/flutter_svg/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/third_party/packages/flutter_svg/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 000000000000..f9b0d7c5ea15 --- /dev/null +++ b/third_party/packages/flutter_svg/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/third_party/packages/flutter_svg/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/third_party/packages/flutter_svg/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 000000000000..1263ac84b105 --- /dev/null +++ b/third_party/packages/flutter_svg/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/third_party/packages/flutter_svg/example/ios/Runner.xcworkspace/contents.xcworkspacedata b/third_party/packages/flutter_svg/example/ios/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 000000000000..1d526a16ed0f --- /dev/null +++ b/third_party/packages/flutter_svg/example/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/third_party/packages/flutter_svg/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/third_party/packages/flutter_svg/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 000000000000..18d981003d68 --- /dev/null +++ b/third_party/packages/flutter_svg/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/third_party/packages/flutter_svg/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/third_party/packages/flutter_svg/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 000000000000..f9b0d7c5ea15 --- /dev/null +++ b/third_party/packages/flutter_svg/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/third_party/packages/flutter_svg/example/ios/Runner/AppDelegate.h b/third_party/packages/flutter_svg/example/ios/Runner/AppDelegate.h new file mode 100644 index 000000000000..36e21bbf9cf4 --- /dev/null +++ b/third_party/packages/flutter_svg/example/ios/Runner/AppDelegate.h @@ -0,0 +1,6 @@ +#import +#import + +@interface AppDelegate : FlutterAppDelegate + +@end diff --git a/third_party/packages/flutter_svg/example/ios/Runner/AppDelegate.m b/third_party/packages/flutter_svg/example/ios/Runner/AppDelegate.m new file mode 100644 index 000000000000..59a72e90be12 --- /dev/null +++ b/third_party/packages/flutter_svg/example/ios/Runner/AppDelegate.m @@ -0,0 +1,13 @@ +#include "AppDelegate.h" +#include "GeneratedPluginRegistrant.h" + +@implementation AppDelegate + +- (BOOL)application:(UIApplication *)application + didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + [GeneratedPluginRegistrant registerWithRegistry:self]; + // Override point for customization after application launch. + return [super application:application didFinishLaunchingWithOptions:launchOptions]; +} + +@end diff --git a/third_party/packages/flutter_svg/example/ios/Runner/AppDelegate.swift b/third_party/packages/flutter_svg/example/ios/Runner/AppDelegate.swift new file mode 100644 index 000000000000..70693e4a8c12 --- /dev/null +++ b/third_party/packages/flutter_svg/example/ios/Runner/AppDelegate.swift @@ -0,0 +1,13 @@ +import UIKit +import Flutter + +@UIApplicationMain +@objc class AppDelegate: FlutterAppDelegate { + override func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? + ) -> Bool { + GeneratedPluginRegistrant.register(with: self) + return super.application(application, didFinishLaunchingWithOptions: launchOptions) + } +} diff --git a/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 000000000000..d36b1fab2d9d --- /dev/null +++ b/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,122 @@ +{ + "images" : [ + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@3x.png", + "scale" : "3x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@3x.png", + "scale" : "3x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@3x.png", + "scale" : "3x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@2x.png", + "scale" : "2x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@3x.png", + "scale" : "3x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@1x.png", + "scale" : "1x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@1x.png", + "scale" : "1x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@1x.png", + "scale" : "1x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@2x.png", + "scale" : "2x" + }, + { + "size" : "83.5x83.5", + "idiom" : "ipad", + "filename" : "Icon-App-83.5x83.5@2x.png", + "scale" : "2x" + }, + { + "size" : "1024x1024", + "idiom" : "ios-marketing", + "filename" : "Icon-App-1024x1024@1x.png", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png new file mode 100644 index 000000000000..3d43d11e66f4 Binary files /dev/null and b/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ diff --git a/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png new file mode 100644 index 000000000000..28c6bf03016f Binary files /dev/null and b/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ diff --git a/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png new file mode 100644 index 000000000000..2ccbfd967d96 Binary files /dev/null and b/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ diff --git a/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png new file mode 100644 index 000000000000..f091b6b0bca8 Binary files /dev/null and b/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ diff --git a/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png new file mode 100644 index 000000000000..4cde12118dda Binary files /dev/null and b/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ diff --git a/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png new file mode 100644 index 000000000000..d0ef06e7edb8 Binary files /dev/null and b/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ diff --git a/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png new file mode 100644 index 000000000000..dcdc2306c285 Binary files /dev/null and b/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ diff --git a/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png new file mode 100644 index 000000000000..2ccbfd967d96 Binary files /dev/null and b/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ diff --git a/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png new file mode 100644 index 000000000000..c8f9ed8f5cee Binary files /dev/null and b/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ diff --git a/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png new file mode 100644 index 000000000000..a6d6b8609df0 Binary files /dev/null and b/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ diff --git a/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png new file mode 100644 index 000000000000..a6d6b8609df0 Binary files /dev/null and b/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ diff --git a/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png new file mode 100644 index 000000000000..75b2d164a5a9 Binary files /dev/null and b/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ diff --git a/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png new file mode 100644 index 000000000000..c4df70d39da7 Binary files /dev/null and b/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ diff --git a/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png new file mode 100644 index 000000000000..6a84f41e14e2 Binary files /dev/null and b/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ diff --git a/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png new file mode 100644 index 000000000000..d0e1f5853602 Binary files /dev/null and b/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ diff --git a/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json new file mode 100644 index 000000000000..0bedcf2fd467 --- /dev/null +++ b/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "LaunchImage.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png new file mode 100644 index 000000000000..9da19eacad3b Binary files /dev/null and b/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png differ diff --git a/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png new file mode 100644 index 000000000000..9da19eacad3b Binary files /dev/null and b/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png differ diff --git a/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png new file mode 100644 index 000000000000..9da19eacad3b Binary files /dev/null and b/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png differ diff --git a/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md new file mode 100644 index 000000000000..89c2725b70f1 --- /dev/null +++ b/third_party/packages/flutter_svg/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md @@ -0,0 +1,5 @@ +# Launch Screen Assets + +You can customize the launch screen with your own desired assets by replacing the image files in this directory. + +You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. \ No newline at end of file diff --git a/third_party/packages/flutter_svg/example/ios/Runner/Base.lproj/LaunchScreen.storyboard b/third_party/packages/flutter_svg/example/ios/Runner/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 000000000000..f2e259c7c939 --- /dev/null +++ b/third_party/packages/flutter_svg/example/ios/Runner/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/third_party/packages/flutter_svg/example/ios/Runner/Base.lproj/Main.storyboard b/third_party/packages/flutter_svg/example/ios/Runner/Base.lproj/Main.storyboard new file mode 100644 index 000000000000..f3c28516fb38 --- /dev/null +++ b/third_party/packages/flutter_svg/example/ios/Runner/Base.lproj/Main.storyboard @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/third_party/packages/flutter_svg/example/ios/Runner/Info.plist b/third_party/packages/flutter_svg/example/ios/Runner/Info.plist new file mode 100644 index 000000000000..0513117f1d0b --- /dev/null +++ b/third_party/packages/flutter_svg/example/ios/Runner/Info.plist @@ -0,0 +1,45 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + example + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleSignature + ???? + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UIViewControllerBasedStatusBarAppearance + + + diff --git a/third_party/packages/flutter_svg/example/ios/Runner/Runner-Bridging-Header.h b/third_party/packages/flutter_svg/example/ios/Runner/Runner-Bridging-Header.h new file mode 100644 index 000000000000..7335fdf9000c --- /dev/null +++ b/third_party/packages/flutter_svg/example/ios/Runner/Runner-Bridging-Header.h @@ -0,0 +1 @@ +#import "GeneratedPluginRegistrant.h" \ No newline at end of file diff --git a/third_party/packages/flutter_svg/example/ios/Runner/main.m b/third_party/packages/flutter_svg/example/ios/Runner/main.m new file mode 100644 index 000000000000..dff6597e4513 --- /dev/null +++ b/third_party/packages/flutter_svg/example/ios/Runner/main.m @@ -0,0 +1,9 @@ +#import +#import +#import "AppDelegate.h" + +int main(int argc, char* argv[]) { + @autoreleasepool { + return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); + } +} diff --git a/third_party/packages/flutter_svg/example/lib/grid.dart b/third_party/packages/flutter_svg/example/lib/grid.dart new file mode 100644 index 000000000000..26e40be51f6b --- /dev/null +++ b/third_party/packages/flutter_svg/example/lib/grid.dart @@ -0,0 +1,162 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; + +const List _assetNames = [ + // 'assets/notfound.svg', // uncomment to test an asset that doesn't exist. + 'assets/flutter_logo.svg', + 'assets/dart.svg', + 'assets/simple/clip_path_3.svg', + 'assets/simple/clip_path_2.svg', + 'assets/simple/clip_path.svg', + 'assets/simple/fill-rule-inherit.svg', + 'assets/simple/group_fill_opacity.svg', + 'assets/simple/group_opacity.svg', + 'assets/simple/text.svg', + 'assets/simple/text_2.svg', + 'assets/simple/text_5.svg', + 'assets/simple/linear_gradient.svg', + 'assets/simple/linear_gradient_2.svg', + 'assets/simple/male.svg', + 'assets/simple/radial_gradient.svg', + 'assets/simple/rect_rrect.svg', + 'assets/simple/rect_rrect_no_ry.svg', + 'assets/simple/style_attr.svg', + 'assets/w3samples/aa.svg', + 'assets/w3samples/alphachannel.svg', + 'assets/simple/ellipse.svg', + 'assets/simple/dash_path.svg', + 'assets/simple/nested_group.svg', + 'assets/simple/stroke_inherit_circles.svg', + 'assets/simple/use_circles.svg', + 'assets/simple/use_opacity_grid.svg', + 'assets/wikimedia/chess_knight.svg', + 'assets/wikimedia/Ghostscript_Tiger.svg', + 'assets/wikimedia/Firefox_Logo_2017.svg', +]; + +/// Assets treated as "icons" - using a color filter to render differently. +const List iconNames = [ + 'assets/deborah_ufw/new-action-expander.svg', + 'assets/deborah_ufw/new-camera.svg', + 'assets/deborah_ufw/new-gif-button.svg', + 'assets/deborah_ufw/new-gif.svg', + 'assets/deborah_ufw/new-image.svg', + 'assets/deborah_ufw/new-mention.svg', + 'assets/deborah_ufw/new-pause-button.svg', + 'assets/deborah_ufw/new-play-button.svg', + 'assets/deborah_ufw/new-send-circle.svg', + 'assets/deborah_ufw/numeric_25.svg', +]; + +/// Assets to test network access. +const List uriNames = [ + 'http://upload.wikimedia.org/wikipedia/commons/0/02/SVG_logo.svg', + 'https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/410.svg', + 'https://upload.wikimedia.org/wikipedia/commons/b/b4/Chess_ndd45.svg', +]; + +void main() { + runApp(_MyApp()); +} + +class _MyApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: 'Flutter Demo', + theme: ThemeData( + primarySwatch: Colors.blue, + ), + home: const _MyHomePage(title: 'Flutter SVG Demo'), + ); + } +} + +class _MyHomePage extends StatefulWidget { + const _MyHomePage({Key? key, required this.title}) : super(key: key); + final String title; + + @override + _MyHomePageState createState() => _MyHomePageState(); +} + +class _MyHomePageState extends State<_MyHomePage> { + final List _painters = []; + late double _dimension; + + @override + void initState() { + super.initState(); + _dimension = 203.0; + for (String assetName in _assetNames) { + _painters.add( + SvgPicture.asset(assetName), + ); + } + + for (int i = 0; i < iconNames.length; i++) { + _painters.add( + Directionality( + textDirection: TextDirection.ltr, + child: SvgPicture.asset( + iconNames[i], + colorFilter: ColorFilter.mode( + Colors.blueGrey[(i + 1) * 100] ?? Colors.blueGrey, + BlendMode.srcIn, + ), + matchTextDirection: true, + ), + ), + ); + } + + for (String uriName in uriNames) { + _painters.add( + SvgPicture.network( + uriName, + placeholderBuilder: (BuildContext context) => Container( + padding: const EdgeInsets.all(30.0), + child: const CircularProgressIndicator(), + ), + ), + ); + } + // Shows an example of an SVG image that will fetch a raster image from a URL. + _painters.add(SvgPicture.string(''' + +''')); + } + + @override + Widget build(BuildContext context) { + if (_dimension > MediaQuery.of(context).size.width - 10.0) { + _dimension = MediaQuery.of(context).size.width - 10.0; + } + return Scaffold( + appBar: AppBar( + title: Text(widget.title), + ), + body: Column(children: [ + Slider( + min: 5.0, + max: MediaQuery.of(context).size.width - 10.0, + value: _dimension, + onChanged: (double val) { + setState(() => _dimension = val); + }, + ), + Expanded( + child: GridView.extent( + // shrinkWrap: true, + maxCrossAxisExtent: _dimension, + padding: const EdgeInsets.all(4.0), + mainAxisSpacing: 4.0, + crossAxisSpacing: 4.0, + children: _painters.toList(), + ), + ), + ]), + ); + } +} diff --git a/third_party/packages/flutter_svg/example/lib/main.dart b/third_party/packages/flutter_svg/example/lib/main.dart new file mode 100644 index 000000000000..42ee8b0ce1e8 --- /dev/null +++ b/third_party/packages/flutter_svg/example/lib/main.dart @@ -0,0 +1,39 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; + +const String svgString = ''' + + + + + + + + + + + + + + + + + + + + +'''; + +void main() { + runApp(MaterialApp( + home: Scaffold( + body: Center( + child: SvgPicture.string( + svgString, + width: 500, + height: 500, + ), + ), + ), + )); +} diff --git a/third_party/packages/flutter_svg/example/linux/.gitignore b/third_party/packages/flutter_svg/example/linux/.gitignore new file mode 100644 index 000000000000..d3896c98444f --- /dev/null +++ b/third_party/packages/flutter_svg/example/linux/.gitignore @@ -0,0 +1 @@ +flutter/ephemeral diff --git a/third_party/packages/flutter_svg/example/linux/CMakeLists.txt b/third_party/packages/flutter_svg/example/linux/CMakeLists.txt new file mode 100644 index 000000000000..290c3e841e82 --- /dev/null +++ b/third_party/packages/flutter_svg/example/linux/CMakeLists.txt @@ -0,0 +1,106 @@ +cmake_minimum_required(VERSION 3.10) +project(runner LANGUAGES CXX) + +set(BINARY_NAME "example") +set(APPLICATION_ID "com.example.example") + +cmake_policy(SET CMP0063 NEW) + +set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") + +# Configure build options. +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + set(CMAKE_BUILD_TYPE "Debug" CACHE + STRING "Flutter build mode" FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS + "Debug" "Profile" "Release") +endif() + +# Compilation settings that should be applied to most targets. +function(APPLY_STANDARD_SETTINGS TARGET) + target_compile_features(${TARGET} PUBLIC cxx_std_14) + target_compile_options(${TARGET} PRIVATE -Wall -Werror) + target_compile_options(${TARGET} PRIVATE "$<$>:-O3>") + target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>") +endfunction() + +set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") + +# Flutter library and tool build rules. +add_subdirectory(${FLUTTER_MANAGED_DIR}) + +# System-level dependencies. +find_package(PkgConfig REQUIRED) +pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) + +add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") + +# Application build +add_executable(${BINARY_NAME} + "main.cc" + "my_application.cc" + "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" +) +apply_standard_settings(${BINARY_NAME}) +target_link_libraries(${BINARY_NAME} PRIVATE flutter) +target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) +add_dependencies(${BINARY_NAME} flutter_assemble) +# Only the install-generated bundle's copy of the executable will launch +# correctly, since the resources must in the right relative locations. To avoid +# people trying to run the unbundled copy, put it in a subdirectory instead of +# the default top-level location. +set_target_properties(${BINARY_NAME} + PROPERTIES + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" +) + +# Generated plugin build rules, which manage building the plugins and adding +# them to the application. +include(flutter/generated_plugins.cmake) + + +# === Installation === +# By default, "installing" just makes a relocatable bundle in the build +# directory. +set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) +endif() + +# Start with a clean build bundle directory every time. +install(CODE " + file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") + " COMPONENT Runtime) + +set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") +set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") + +install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" + COMPONENT Runtime) + +install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" + COMPONENT Runtime) + +install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) + +if(PLUGIN_BUNDLED_LIBRARIES) + install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) +endif() + +# Fully re-copy the assets directory on each build to avoid having stale files +# from a previous install. +set(FLUTTER_ASSET_DIR_NAME "flutter_assets") +install(CODE " + file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") + " COMPONENT Runtime) +install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" + DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) + +# Install the AOT library on non-Debug builds only. +if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") + install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) +endif() diff --git a/third_party/packages/flutter_svg/example/linux/flutter/CMakeLists.txt b/third_party/packages/flutter_svg/example/linux/flutter/CMakeLists.txt new file mode 100644 index 000000000000..a1da1b9e5320 --- /dev/null +++ b/third_party/packages/flutter_svg/example/linux/flutter/CMakeLists.txt @@ -0,0 +1,91 @@ +cmake_minimum_required(VERSION 3.10) + +set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") + +# Configuration provided via flutter tool. +include(${EPHEMERAL_DIR}/generated_config.cmake) + +# TODO: Move the rest of this into files in ephemeral. See +# https://github.com/flutter/flutter/issues/57146. + +# Serves the same purpose as list(TRANSFORM ... PREPEND ...), +# which isn't available in 3.10. +function(list_prepend LIST_NAME PREFIX) + set(NEW_LIST "") + foreach(element ${${LIST_NAME}}) + list(APPEND NEW_LIST "${PREFIX}${element}") + endforeach(element) + set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) +endfunction() + +# === Flutter Library === +# System-level dependencies. +find_package(PkgConfig REQUIRED) +pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) +pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) +pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) +pkg_check_modules(BLKID REQUIRED IMPORTED_TARGET blkid) +pkg_check_modules(LZMA REQUIRED IMPORTED_TARGET liblzma) + +set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") + +# Published to parent scope for install step. +set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) +set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) +set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) +set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) + +list(APPEND FLUTTER_LIBRARY_HEADERS + "fl_basic_message_channel.h" + "fl_binary_codec.h" + "fl_binary_messenger.h" + "fl_dart_project.h" + "fl_engine.h" + "fl_json_message_codec.h" + "fl_json_method_codec.h" + "fl_message_codec.h" + "fl_method_call.h" + "fl_method_channel.h" + "fl_method_codec.h" + "fl_method_response.h" + "fl_plugin_registrar.h" + "fl_plugin_registry.h" + "fl_standard_message_codec.h" + "fl_standard_method_codec.h" + "fl_string_codec.h" + "fl_value.h" + "fl_view.h" + "flutter_linux.h" +) +list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") +add_library(flutter INTERFACE) +target_include_directories(flutter INTERFACE + "${EPHEMERAL_DIR}" +) +target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") +target_link_libraries(flutter INTERFACE + PkgConfig::GTK + PkgConfig::GLIB + PkgConfig::GIO + PkgConfig::BLKID + PkgConfig::LZMA +) +add_dependencies(flutter flutter_assemble) + +# === Flutter tool backend === +# _phony_ is a non-existent file to force this command to run every time, +# since currently there's no way to get a full input/output list from the +# flutter tool. +add_custom_command( + OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} + ${CMAKE_CURRENT_BINARY_DIR}/_phony_ + COMMAND ${CMAKE_COMMAND} -E env + ${FLUTTER_TOOL_ENVIRONMENT} + "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" + linux-x64 ${CMAKE_BUILD_TYPE} + VERBATIM +) +add_custom_target(flutter_assemble DEPENDS + "${FLUTTER_LIBRARY}" + ${FLUTTER_LIBRARY_HEADERS} +) diff --git a/third_party/packages/flutter_svg/example/linux/flutter/generated_plugin_registrant.cc b/third_party/packages/flutter_svg/example/linux/flutter/generated_plugin_registrant.cc new file mode 100644 index 000000000000..e71a16d23d05 --- /dev/null +++ b/third_party/packages/flutter_svg/example/linux/flutter/generated_plugin_registrant.cc @@ -0,0 +1,11 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#include "generated_plugin_registrant.h" + + +void fl_register_plugins(FlPluginRegistry* registry) { +} diff --git a/third_party/packages/flutter_svg/example/linux/flutter/generated_plugin_registrant.h b/third_party/packages/flutter_svg/example/linux/flutter/generated_plugin_registrant.h new file mode 100644 index 000000000000..e0f0a47bc08f --- /dev/null +++ b/third_party/packages/flutter_svg/example/linux/flutter/generated_plugin_registrant.h @@ -0,0 +1,15 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#ifndef GENERATED_PLUGIN_REGISTRANT_ +#define GENERATED_PLUGIN_REGISTRANT_ + +#include + +// Registers Flutter plugins. +void fl_register_plugins(FlPluginRegistry* registry); + +#endif // GENERATED_PLUGIN_REGISTRANT_ diff --git a/third_party/packages/flutter_svg/example/linux/flutter/generated_plugins.cmake b/third_party/packages/flutter_svg/example/linux/flutter/generated_plugins.cmake new file mode 100644 index 000000000000..2e1de87a7eb6 --- /dev/null +++ b/third_party/packages/flutter_svg/example/linux/flutter/generated_plugins.cmake @@ -0,0 +1,23 @@ +# +# Generated file, do not edit. +# + +list(APPEND FLUTTER_PLUGIN_LIST +) + +list(APPEND FLUTTER_FFI_PLUGIN_LIST +) + +set(PLUGIN_BUNDLED_LIBRARIES) + +foreach(plugin ${FLUTTER_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) + target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) + list(APPEND PLUGIN_BUNDLED_LIBRARIES $) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) +endforeach(plugin) + +foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) +endforeach(ffi_plugin) diff --git a/third_party/packages/flutter_svg/example/linux/main.cc b/third_party/packages/flutter_svg/example/linux/main.cc new file mode 100644 index 000000000000..e7c5c5437037 --- /dev/null +++ b/third_party/packages/flutter_svg/example/linux/main.cc @@ -0,0 +1,6 @@ +#include "my_application.h" + +int main(int argc, char** argv) { + g_autoptr(MyApplication) app = my_application_new(); + return g_application_run(G_APPLICATION(app), argc, argv); +} diff --git a/third_party/packages/flutter_svg/example/linux/my_application.cc b/third_party/packages/flutter_svg/example/linux/my_application.cc new file mode 100644 index 000000000000..634f4c519339 --- /dev/null +++ b/third_party/packages/flutter_svg/example/linux/my_application.cc @@ -0,0 +1,105 @@ +#include "my_application.h" + +#include +#ifdef GDK_WINDOWING_X11 +#include +#endif + +#include "flutter/generated_plugin_registrant.h" + +struct _MyApplication { + GtkApplication parent_instance; + char** dart_entrypoint_arguments; +}; + +G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION) + +// Implements GApplication::activate. +static void my_application_activate(GApplication* application) { + MyApplication* self = MY_APPLICATION(application); + GtkWindow* window = + GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application))); + + // Use a header bar when running in GNOME as this is the common style used + // by applications and is the setup most users will be using (e.g. Ubuntu + // desktop). + // If running on X and not using GNOME then just use a traditional title bar + // in case the window manager does more exotic layout, e.g. tiling. + // If running on Wayland assume the header bar will work (may need changing + // if future cases occur). + gboolean use_header_bar = TRUE; +#ifdef GDK_WINDOWING_X11 + GdkScreen *screen = gtk_window_get_screen(window); + if (GDK_IS_X11_SCREEN(screen)) { + const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen); + if (g_strcmp0(wm_name, "GNOME Shell") != 0) { + use_header_bar = FALSE; + } + } +#endif + if (use_header_bar) { + GtkHeaderBar *header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); + gtk_widget_show(GTK_WIDGET(header_bar)); + gtk_header_bar_set_title(header_bar, "example"); + gtk_header_bar_set_show_close_button(header_bar, TRUE); + gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); + } + else { + gtk_window_set_title(window, "example"); + } + + gtk_window_set_default_size(window, 1280, 720); + gtk_widget_show(GTK_WIDGET(window)); + + g_autoptr(FlDartProject) project = fl_dart_project_new(); + fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments); + + FlView* view = fl_view_new(project); + gtk_widget_show(GTK_WIDGET(view)); + gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view)); + + fl_register_plugins(FL_PLUGIN_REGISTRY(view)); + + gtk_widget_grab_focus(GTK_WIDGET(view)); +} + +// Implements GApplication::local_command_line. +static gboolean my_application_local_command_line(GApplication* application, gchar ***arguments, int *exit_status) { + MyApplication* self = MY_APPLICATION(application); + // Strip out the first argument as it is the binary name. + self->dart_entrypoint_arguments = g_strdupv(*arguments + 1); + + g_autoptr(GError) error = nullptr; + if (!g_application_register(application, nullptr, &error)) { + g_warning("Failed to register: %s", error->message); + *exit_status = 1; + return TRUE; + } + + g_application_activate(application); + *exit_status = 0; + + return TRUE; +} + +// Implements GObject::dispose. +static void my_application_dispose(GObject *object) { + MyApplication* self = MY_APPLICATION(object); + g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev); + G_OBJECT_CLASS(my_application_parent_class)->dispose(object); +} + +static void my_application_class_init(MyApplicationClass* klass) { + G_APPLICATION_CLASS(klass)->activate = my_application_activate; + G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line; + G_OBJECT_CLASS(klass)->dispose = my_application_dispose; +} + +static void my_application_init(MyApplication* self) {} + +MyApplication* my_application_new() { + return MY_APPLICATION(g_object_new(my_application_get_type(), + "application-id", APPLICATION_ID, + "flags", G_APPLICATION_NON_UNIQUE, + nullptr)); +} diff --git a/third_party/packages/flutter_svg/example/linux/my_application.h b/third_party/packages/flutter_svg/example/linux/my_application.h new file mode 100644 index 000000000000..72271d5e4170 --- /dev/null +++ b/third_party/packages/flutter_svg/example/linux/my_application.h @@ -0,0 +1,18 @@ +#ifndef FLUTTER_MY_APPLICATION_H_ +#define FLUTTER_MY_APPLICATION_H_ + +#include + +G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, + GtkApplication) + +/** + * my_application_new: + * + * Creates a new Flutter-based application. + * + * Returns: a new #MyApplication. + */ +MyApplication* my_application_new(); + +#endif // FLUTTER_MY_APPLICATION_H_ diff --git a/third_party/packages/flutter_svg/example/macos/.gitignore b/third_party/packages/flutter_svg/example/macos/.gitignore new file mode 100644 index 000000000000..746adbb6b9e1 --- /dev/null +++ b/third_party/packages/flutter_svg/example/macos/.gitignore @@ -0,0 +1,7 @@ +# Flutter-related +**/Flutter/ephemeral/ +**/Pods/ + +# Xcode-related +**/dgph +**/xcuserdata/ diff --git a/third_party/packages/flutter_svg/example/macos/Flutter/Flutter-Debug.xcconfig b/third_party/packages/flutter_svg/example/macos/Flutter/Flutter-Debug.xcconfig new file mode 100644 index 000000000000..c2efd0b608ba --- /dev/null +++ b/third_party/packages/flutter_svg/example/macos/Flutter/Flutter-Debug.xcconfig @@ -0,0 +1 @@ +#include "ephemeral/Flutter-Generated.xcconfig" diff --git a/third_party/packages/flutter_svg/example/macos/Flutter/Flutter-Release.xcconfig b/third_party/packages/flutter_svg/example/macos/Flutter/Flutter-Release.xcconfig new file mode 100644 index 000000000000..c2efd0b608ba --- /dev/null +++ b/third_party/packages/flutter_svg/example/macos/Flutter/Flutter-Release.xcconfig @@ -0,0 +1 @@ +#include "ephemeral/Flutter-Generated.xcconfig" diff --git a/third_party/packages/flutter_svg/example/macos/Flutter/GeneratedPluginRegistrant.swift b/third_party/packages/flutter_svg/example/macos/Flutter/GeneratedPluginRegistrant.swift new file mode 100644 index 000000000000..cccf817a5220 --- /dev/null +++ b/third_party/packages/flutter_svg/example/macos/Flutter/GeneratedPluginRegistrant.swift @@ -0,0 +1,10 @@ +// +// Generated file. Do not edit. +// + +import FlutterMacOS +import Foundation + + +func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { +} diff --git a/third_party/packages/flutter_svg/example/macos/Runner.xcodeproj/project.pbxproj b/third_party/packages/flutter_svg/example/macos/Runner.xcodeproj/project.pbxproj new file mode 100644 index 000000000000..d9333e4704c4 --- /dev/null +++ b/third_party/packages/flutter_svg/example/macos/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,573 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 54; + objects = { + +/* Begin PBXAggregateTarget section */ + 33CC111A2044C6BA0003C045 /* Flutter Assemble */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */; + buildPhases = ( + 33CC111E2044C6BF0003C045 /* ShellScript */, + ); + dependencies = ( + ); + name = "Flutter Assemble"; + productName = FLX; + }; +/* End PBXAggregateTarget section */ + +/* Begin PBXBuildFile section */ + 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */; }; + 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC10F02044A3C60003C045 /* AppDelegate.swift */; }; + 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; + 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; + 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 33CC10E52044A3C60003C045 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 33CC111A2044C6BA0003C045; + remoteInfo = FLX; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 33CC110E2044A8840003C045 /* Bundle Framework */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Bundle Framework"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; + 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = ""; }; + 33CC10ED2044A3C60003C045 /* example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "example.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = ""; }; + 33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; + 33CC10F72044A3C60003C045 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = Runner/Info.plist; sourceTree = ""; }; + 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainFlutterWindow.swift; sourceTree = ""; }; + 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Debug.xcconfig"; sourceTree = ""; }; + 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Release.xcconfig"; sourceTree = ""; }; + 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "Flutter-Generated.xcconfig"; path = "ephemeral/Flutter-Generated.xcconfig"; sourceTree = ""; }; + 33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = ""; }; + 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = ""; }; + 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = ""; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 33CC10EA2044A3C60003C045 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 33BA886A226E78AF003329D5 /* Configs */ = { + isa = PBXGroup; + children = ( + 33E5194F232828860026EE4D /* AppInfo.xcconfig */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 333000ED22D3DE5D00554162 /* Warnings.xcconfig */, + ); + path = Configs; + sourceTree = ""; + }; + 33CC10E42044A3C60003C045 = { + isa = PBXGroup; + children = ( + 33FAB671232836740065AC1E /* Runner */, + 33CEB47122A05771004F2AC0 /* Flutter */, + 33CC10EE2044A3C60003C045 /* Products */, + D73912EC22F37F3D000D13A0 /* Frameworks */, + ); + sourceTree = ""; + }; + 33CC10EE2044A3C60003C045 /* Products */ = { + isa = PBXGroup; + children = ( + 33CC10ED2044A3C60003C045 /* example.app */, + ); + name = Products; + sourceTree = ""; + }; + 33CC11242044D66E0003C045 /* Resources */ = { + isa = PBXGroup; + children = ( + 33CC10F22044A3C60003C045 /* Assets.xcassets */, + 33CC10F42044A3C60003C045 /* MainMenu.xib */, + 33CC10F72044A3C60003C045 /* Info.plist */, + ); + name = Resources; + path = ..; + sourceTree = ""; + }; + 33CEB47122A05771004F2AC0 /* Flutter */ = { + isa = PBXGroup; + children = ( + 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */, + 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */, + 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */, + 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */, + ); + path = Flutter; + sourceTree = ""; + }; + 33FAB671232836740065AC1E /* Runner */ = { + isa = PBXGroup; + children = ( + 33CC10F02044A3C60003C045 /* AppDelegate.swift */, + 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */, + 33E51913231747F40026EE4D /* DebugProfile.entitlements */, + 33E51914231749380026EE4D /* Release.entitlements */, + 33CC11242044D66E0003C045 /* Resources */, + 33BA886A226E78AF003329D5 /* Configs */, + ); + path = Runner; + sourceTree = ""; + }; + D73912EC22F37F3D000D13A0 /* Frameworks */ = { + isa = PBXGroup; + children = ( + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 33CC10EC2044A3C60003C045 /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + 33CC10E92044A3C60003C045 /* Sources */, + 33CC10EA2044A3C60003C045 /* Frameworks */, + 33CC10EB2044A3C60003C045 /* Resources */, + 33CC110E2044A8840003C045 /* Bundle Framework */, + 3399D490228B24CF009A79C7 /* ShellScript */, + ); + buildRules = ( + ); + dependencies = ( + 33CC11202044C79F0003C045 /* PBXTargetDependency */, + ); + name = Runner; + productName = Runner; + productReference = 33CC10ED2044A3C60003C045 /* example.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 33CC10E52044A3C60003C045 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0920; + LastUpgradeCheck = 1300; + ORGANIZATIONNAME = ""; + TargetAttributes = { + 33CC10EC2044A3C60003C045 = { + CreatedOnToolsVersion = 9.2; + LastSwiftMigration = 1100; + ProvisioningStyle = Automatic; + SystemCapabilities = { + com.apple.Sandbox = { + enabled = 1; + }; + }; + }; + 33CC111A2044C6BA0003C045 = { + CreatedOnToolsVersion = 9.2; + ProvisioningStyle = Manual; + }; + }; + }; + buildConfigurationList = 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 33CC10E42044A3C60003C045; + productRefGroup = 33CC10EE2044A3C60003C045 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 33CC10EC2044A3C60003C045 /* Runner */, + 33CC111A2044C6BA0003C045 /* Flutter Assemble */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 33CC10EB2044A3C60003C045 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */, + 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 3399D490228B24CF009A79C7 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh embed\n"; + }; + 33CC111E2044C6BF0003C045 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + Flutter/ephemeral/FlutterInputs.xcfilelist, + ); + inputPaths = ( + Flutter/ephemeral/tripwire, + ); + outputFileListPaths = ( + Flutter/ephemeral/FlutterOutputs.xcfilelist, + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 33CC10E92044A3C60003C045 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */, + 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */, + 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 33CC11202044C79F0003C045 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 33CC111A2044C6BA0003C045 /* Flutter Assemble */; + targetProxy = 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 33CC10F42044A3C60003C045 /* MainMenu.xib */ = { + isa = PBXVariantGroup; + children = ( + 33CC10F52044A3C60003C045 /* Base */, + ); + name = MainMenu.xib; + path = Runner; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 338D0CE9231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.14; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + }; + name = Profile; + }; + 338D0CEA231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; + }; + name = Profile; + }; + 338D0CEB231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Manual; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 33CC10F92044A3C60003C045 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.14; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 33CC10FA2044A3C60003C045 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.14; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + }; + name = Release; + }; + 33CC10FC2044A3C60003C045 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + 33CC10FD2044A3C60003C045 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; + }; + name = Release; + }; + 33CC111C2044C6BA0003C045 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Manual; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 33CC111D2044C6BA0003C045 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC10F92044A3C60003C045 /* Debug */, + 33CC10FA2044A3C60003C045 /* Release */, + 338D0CE9231458BD00FA5F75 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC10FC2044A3C60003C045 /* Debug */, + 33CC10FD2044A3C60003C045 /* Release */, + 338D0CEA231458BD00FA5F75 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC111C2044C6BA0003C045 /* Debug */, + 33CC111D2044C6BA0003C045 /* Release */, + 338D0CEB231458BD00FA5F75 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 33CC10E52044A3C60003C045 /* Project object */; +} diff --git a/third_party/packages/flutter_svg/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/third_party/packages/flutter_svg/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 000000000000..18d981003d68 --- /dev/null +++ b/third_party/packages/flutter_svg/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/third_party/packages/flutter_svg/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/third_party/packages/flutter_svg/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 000000000000..fb7259e17785 --- /dev/null +++ b/third_party/packages/flutter_svg/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/third_party/packages/flutter_svg/example/macos/Runner.xcworkspace/contents.xcworkspacedata b/third_party/packages/flutter_svg/example/macos/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 000000000000..1d526a16ed0f --- /dev/null +++ b/third_party/packages/flutter_svg/example/macos/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/third_party/packages/flutter_svg/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/third_party/packages/flutter_svg/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 000000000000..18d981003d68 --- /dev/null +++ b/third_party/packages/flutter_svg/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/third_party/packages/flutter_svg/example/macos/Runner/AppDelegate.swift b/third_party/packages/flutter_svg/example/macos/Runner/AppDelegate.swift new file mode 100644 index 000000000000..d53ef6437726 --- /dev/null +++ b/third_party/packages/flutter_svg/example/macos/Runner/AppDelegate.swift @@ -0,0 +1,9 @@ +import Cocoa +import FlutterMacOS + +@NSApplicationMain +class AppDelegate: FlutterAppDelegate { + override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { + return true + } +} diff --git a/third_party/packages/flutter_svg/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/third_party/packages/flutter_svg/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 000000000000..a2ec33f19f11 --- /dev/null +++ b/third_party/packages/flutter_svg/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,68 @@ +{ + "images" : [ + { + "size" : "16x16", + "idiom" : "mac", + "filename" : "app_icon_16.png", + "scale" : "1x" + }, + { + "size" : "16x16", + "idiom" : "mac", + "filename" : "app_icon_32.png", + "scale" : "2x" + }, + { + "size" : "32x32", + "idiom" : "mac", + "filename" : "app_icon_32.png", + "scale" : "1x" + }, + { + "size" : "32x32", + "idiom" : "mac", + "filename" : "app_icon_64.png", + "scale" : "2x" + }, + { + "size" : "128x128", + "idiom" : "mac", + "filename" : "app_icon_128.png", + "scale" : "1x" + }, + { + "size" : "128x128", + "idiom" : "mac", + "filename" : "app_icon_256.png", + "scale" : "2x" + }, + { + "size" : "256x256", + "idiom" : "mac", + "filename" : "app_icon_256.png", + "scale" : "1x" + }, + { + "size" : "256x256", + "idiom" : "mac", + "filename" : "app_icon_512.png", + "scale" : "2x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "app_icon_512.png", + "scale" : "1x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "app_icon_1024.png", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/third_party/packages/flutter_svg/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png b/third_party/packages/flutter_svg/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png new file mode 100644 index 000000000000..82b6f9d9a33e Binary files /dev/null and b/third_party/packages/flutter_svg/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png differ diff --git a/third_party/packages/flutter_svg/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png b/third_party/packages/flutter_svg/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png new file mode 100644 index 000000000000..13b35eba55c6 Binary files /dev/null and b/third_party/packages/flutter_svg/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png differ diff --git a/third_party/packages/flutter_svg/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png b/third_party/packages/flutter_svg/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png new file mode 100644 index 000000000000..0a3f5fa40fb3 Binary files /dev/null and b/third_party/packages/flutter_svg/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png differ diff --git a/third_party/packages/flutter_svg/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png b/third_party/packages/flutter_svg/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png new file mode 100644 index 000000000000..bdb57226d5f2 Binary files /dev/null and b/third_party/packages/flutter_svg/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png differ diff --git a/third_party/packages/flutter_svg/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png b/third_party/packages/flutter_svg/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png new file mode 100644 index 000000000000..f083318e09ca Binary files /dev/null and b/third_party/packages/flutter_svg/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png differ diff --git a/third_party/packages/flutter_svg/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png b/third_party/packages/flutter_svg/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png new file mode 100644 index 000000000000..326c0e72c9d8 Binary files /dev/null and b/third_party/packages/flutter_svg/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png differ diff --git a/third_party/packages/flutter_svg/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png b/third_party/packages/flutter_svg/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png new file mode 100644 index 000000000000..2f1632cfddf3 Binary files /dev/null and b/third_party/packages/flutter_svg/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png differ diff --git a/third_party/packages/flutter_svg/example/macos/Runner/Base.lproj/MainMenu.xib b/third_party/packages/flutter_svg/example/macos/Runner/Base.lproj/MainMenu.xib new file mode 100644 index 000000000000..80e867a4e06b --- /dev/null +++ b/third_party/packages/flutter_svg/example/macos/Runner/Base.lproj/MainMenu.xib @@ -0,0 +1,343 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/third_party/packages/flutter_svg/example/macos/Runner/Configs/AppInfo.xcconfig b/third_party/packages/flutter_svg/example/macos/Runner/Configs/AppInfo.xcconfig new file mode 100644 index 000000000000..8b42559e8758 --- /dev/null +++ b/third_party/packages/flutter_svg/example/macos/Runner/Configs/AppInfo.xcconfig @@ -0,0 +1,14 @@ +// Application-level settings for the Runner target. +// +// This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the +// future. If not, the values below would default to using the project name when this becomes a +// 'flutter create' template. + +// The application's name. By default this is also the title of the Flutter window. +PRODUCT_NAME = example + +// The application's bundle identifier +PRODUCT_BUNDLE_IDENTIFIER = com.example.example + +// The copyright displayed in application information +PRODUCT_COPYRIGHT = Copyright © 2022 com.example. All rights reserved. diff --git a/third_party/packages/flutter_svg/example/macos/Runner/Configs/Debug.xcconfig b/third_party/packages/flutter_svg/example/macos/Runner/Configs/Debug.xcconfig new file mode 100644 index 000000000000..36b0fd9464f4 --- /dev/null +++ b/third_party/packages/flutter_svg/example/macos/Runner/Configs/Debug.xcconfig @@ -0,0 +1,2 @@ +#include "../../Flutter/Flutter-Debug.xcconfig" +#include "Warnings.xcconfig" diff --git a/third_party/packages/flutter_svg/example/macos/Runner/Configs/Release.xcconfig b/third_party/packages/flutter_svg/example/macos/Runner/Configs/Release.xcconfig new file mode 100644 index 000000000000..dff4f49561c8 --- /dev/null +++ b/third_party/packages/flutter_svg/example/macos/Runner/Configs/Release.xcconfig @@ -0,0 +1,2 @@ +#include "../../Flutter/Flutter-Release.xcconfig" +#include "Warnings.xcconfig" diff --git a/third_party/packages/flutter_svg/example/macos/Runner/Configs/Warnings.xcconfig b/third_party/packages/flutter_svg/example/macos/Runner/Configs/Warnings.xcconfig new file mode 100644 index 000000000000..42bcbf4780b1 --- /dev/null +++ b/third_party/packages/flutter_svg/example/macos/Runner/Configs/Warnings.xcconfig @@ -0,0 +1,13 @@ +WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings +GCC_WARN_UNDECLARED_SELECTOR = YES +CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES +CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE +CLANG_WARN__DUPLICATE_METHOD_MATCH = YES +CLANG_WARN_PRAGMA_PACK = YES +CLANG_WARN_STRICT_PROTOTYPES = YES +CLANG_WARN_COMMA = YES +GCC_WARN_STRICT_SELECTOR_MATCH = YES +CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES +CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES +GCC_WARN_SHADOW = YES +CLANG_WARN_UNREACHABLE_CODE = YES diff --git a/third_party/packages/flutter_svg/example/macos/Runner/DebugProfile.entitlements b/third_party/packages/flutter_svg/example/macos/Runner/DebugProfile.entitlements new file mode 100644 index 000000000000..dddb8a30c851 --- /dev/null +++ b/third_party/packages/flutter_svg/example/macos/Runner/DebugProfile.entitlements @@ -0,0 +1,12 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.cs.allow-jit + + com.apple.security.network.server + + + diff --git a/third_party/packages/flutter_svg/example/macos/Runner/Info.plist b/third_party/packages/flutter_svg/example/macos/Runner/Info.plist new file mode 100644 index 000000000000..4789daa6a443 --- /dev/null +++ b/third_party/packages/flutter_svg/example/macos/Runner/Info.plist @@ -0,0 +1,32 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIconFile + + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSMinimumSystemVersion + $(MACOSX_DEPLOYMENT_TARGET) + NSHumanReadableCopyright + $(PRODUCT_COPYRIGHT) + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/third_party/packages/flutter_svg/example/macos/Runner/MainFlutterWindow.swift b/third_party/packages/flutter_svg/example/macos/Runner/MainFlutterWindow.swift new file mode 100644 index 000000000000..2722837ec918 --- /dev/null +++ b/third_party/packages/flutter_svg/example/macos/Runner/MainFlutterWindow.swift @@ -0,0 +1,15 @@ +import Cocoa +import FlutterMacOS + +class MainFlutterWindow: NSWindow { + override func awakeFromNib() { + let flutterViewController = FlutterViewController.init() + let windowFrame = self.frame + self.contentViewController = flutterViewController + self.setFrame(windowFrame, display: true) + + RegisterGeneratedPlugins(registry: flutterViewController) + + super.awakeFromNib() + } +} diff --git a/third_party/packages/flutter_svg/example/macos/Runner/Release.entitlements b/third_party/packages/flutter_svg/example/macos/Runner/Release.entitlements new file mode 100644 index 000000000000..852fa1a4728a --- /dev/null +++ b/third_party/packages/flutter_svg/example/macos/Runner/Release.entitlements @@ -0,0 +1,8 @@ + + + + + com.apple.security.app-sandbox + + + diff --git a/third_party/packages/flutter_svg/example/pubspec.yaml b/third_party/packages/flutter_svg/example/pubspec.yaml new file mode 100644 index 000000000000..c6691b6cf1a2 --- /dev/null +++ b/third_party/packages/flutter_svg/example/pubspec.yaml @@ -0,0 +1,39 @@ +name: flutter_svg_example +description: An SVG samnple app. +homepage: https://github.com/dnfield/flutter_svg +publish_to: none + +dependencies: + flutter: + sdk: flutter + flutter_driver: + sdk: flutter + flutter_svg: + path: ../ + +dev_dependencies: + flutter_lints: ^2.0.1 + +# The following section is specific to Flutter. +flutter: + uses-material-design: true + + assets: + - assets/ + - assets/w3samples/ + - assets/deborah_ufw/ + - assets/simple/ + - assets/wikimedia/ + - assets/android_vd/ + +environment: + sdk: '>=2.17.0-0 <3.0.0' + flutter: ">=3.4.0-34.1.pre" + +# dependency_overrides: +# vector_graphics_codec: +# path: ../../../../vector_graphics/packages/vector_graphics_codec +# vector_graphics_compiler: +# path: ../../../../vector_graphics/packages/vector_graphics_compiler +# vector_graphics: +# path: ../../../../vector_graphics/packages/vector_graphics diff --git a/third_party/packages/flutter_svg/example/test_driver/bench.dart b/third_party/packages/flutter_svg/example/test_driver/bench.dart new file mode 100644 index 000000000000..7854092ac4a9 --- /dev/null +++ b/third_party/packages/flutter_svg/example/test_driver/bench.dart @@ -0,0 +1,7 @@ +import 'package:flutter_driver/driver_extension.dart'; +import 'package:flutter_svg_example/main.dart' as app; + +void main() { + enableFlutterDriverExtension(); + app.main(); +} diff --git a/third_party/packages/flutter_svg/example/test_driver/bench_test.dart b/third_party/packages/flutter_svg/example/test_driver/bench_test.dart new file mode 100644 index 000000000000..b23125b7fff9 --- /dev/null +++ b/third_party/packages/flutter_svg/example/test_driver/bench_test.dart @@ -0,0 +1,28 @@ +import 'package:flutter_driver/flutter_driver.dart'; + +Future main() async { + final SerializableFinder view = find.byType('GridView'); + + final FlutterDriver driver = await FlutterDriver.connect(); + try { + await driver.waitUntilFirstFrameRasterized(); + await Future.delayed(const Duration(milliseconds: 1000)); + await driver.forceGC(); + await driver.clearTimeline(); + await Future.delayed(const Duration(milliseconds: 1000)); + + final Timeline timeline = await driver.traceAction(() async { + await driver.scroll( + view, + 0, + -3400, + const Duration(seconds: 10), + timeout: const Duration(seconds: 15), + ); + }); + final TimelineSummary summary = TimelineSummary.summarize(timeline); + await summary.writeTimelineToFile('bench', pretty: true); + } finally { + await driver.close(); + } +} diff --git a/third_party/packages/flutter_svg/example/test_driver/repaint.dart b/third_party/packages/flutter_svg/example/test_driver/repaint.dart new file mode 100644 index 000000000000..45891f37b476 --- /dev/null +++ b/third_party/packages/flutter_svg/example/test_driver/repaint.dart @@ -0,0 +1,19 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_driver/driver_extension.dart'; +import 'package:flutter_svg/flutter_svg.dart'; + +void main() { + enableFlutterDriverExtension(); + runApp( + Directionality( + textDirection: TextDirection.ltr, + child: Stack( + alignment: Alignment.center, + children: [ + SvgPicture.asset('assets/wikimedia/Ghostscript_Tiger.svg'), + const CircularProgressIndicator(), + ], + ), + ), + ); +} diff --git a/third_party/packages/flutter_svg/example/test_driver/repaint_test.dart b/third_party/packages/flutter_svg/example/test_driver/repaint_test.dart new file mode 100644 index 000000000000..99bc518ef313 --- /dev/null +++ b/third_party/packages/flutter_svg/example/test_driver/repaint_test.dart @@ -0,0 +1,21 @@ +import 'package:flutter_driver/flutter_driver.dart'; + +Future main() async { + final FlutterDriver driver = await FlutterDriver.connect(); + try { + await driver.waitUntilFirstFrameRasterized(); + await Future.delayed(const Duration(milliseconds: 1000)); + await driver.forceGC(); + await driver.clearTimeline(); + await Future.delayed(const Duration(milliseconds: 1000)); + + final Timeline timeline = await driver.traceAction(() async { + // animate + await Future.delayed(const Duration(seconds: 10)); + }); + final TimelineSummary summary = TimelineSummary.summarize(timeline); + await summary.writeTimelineToFile('repaint', pretty: true); + } finally { + await driver.close(); + } +} diff --git a/third_party/packages/flutter_svg/example/web/favicon.png b/third_party/packages/flutter_svg/example/web/favicon.png new file mode 100644 index 000000000000..8aaa46ac1ae2 Binary files /dev/null and b/third_party/packages/flutter_svg/example/web/favicon.png differ diff --git a/third_party/packages/flutter_svg/example/web/icons/Icon-192.png b/third_party/packages/flutter_svg/example/web/icons/Icon-192.png new file mode 100644 index 000000000000..b749bfef0747 Binary files /dev/null and b/third_party/packages/flutter_svg/example/web/icons/Icon-192.png differ diff --git a/third_party/packages/flutter_svg/example/web/icons/Icon-512.png b/third_party/packages/flutter_svg/example/web/icons/Icon-512.png new file mode 100644 index 000000000000..88cfd48dff11 Binary files /dev/null and b/third_party/packages/flutter_svg/example/web/icons/Icon-512.png differ diff --git a/third_party/packages/flutter_svg/example/web/icons/Icon-maskable-192.png b/third_party/packages/flutter_svg/example/web/icons/Icon-maskable-192.png new file mode 100644 index 000000000000..eb9b4d76e525 Binary files /dev/null and b/third_party/packages/flutter_svg/example/web/icons/Icon-maskable-192.png differ diff --git a/third_party/packages/flutter_svg/example/web/icons/Icon-maskable-512.png b/third_party/packages/flutter_svg/example/web/icons/Icon-maskable-512.png new file mode 100644 index 000000000000..d69c56691fbd Binary files /dev/null and b/third_party/packages/flutter_svg/example/web/icons/Icon-maskable-512.png differ diff --git a/third_party/packages/flutter_svg/example/web/index.html b/third_party/packages/flutter_svg/example/web/index.html new file mode 100644 index 000000000000..9b7a438f823a --- /dev/null +++ b/third_party/packages/flutter_svg/example/web/index.html @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + example + + + + + + + + diff --git a/third_party/packages/flutter_svg/example/web/manifest.json b/third_party/packages/flutter_svg/example/web/manifest.json new file mode 100644 index 000000000000..c63800102369 --- /dev/null +++ b/third_party/packages/flutter_svg/example/web/manifest.json @@ -0,0 +1,23 @@ +{ + "name": "example", + "short_name": "example", + "start_url": ".", + "display": "minimal-ui", + "background_color": "#0175C2", + "theme_color": "#0175C2", + "description": "A new Flutter project.", + "orientation": "portrait-primary", + "prefer_related_applications": false, + "icons": [ + { + "src": "icons/Icon-192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "icons/Icon-512.png", + "sizes": "512x512", + "type": "image/png" + } + ] +} diff --git a/third_party/packages/flutter_svg/example/windows/.gitignore b/third_party/packages/flutter_svg/example/windows/.gitignore new file mode 100644 index 000000000000..d492d0d98c8f --- /dev/null +++ b/third_party/packages/flutter_svg/example/windows/.gitignore @@ -0,0 +1,17 @@ +flutter/ephemeral/ + +# Visual Studio user-specific files. +*.suo +*.user +*.userosscache +*.sln.docstates + +# Visual Studio build-related files. +x64/ +x86/ + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ diff --git a/third_party/packages/flutter_svg/example/windows/CMakeLists.txt b/third_party/packages/flutter_svg/example/windows/CMakeLists.txt new file mode 100644 index 000000000000..abf90408efb4 --- /dev/null +++ b/third_party/packages/flutter_svg/example/windows/CMakeLists.txt @@ -0,0 +1,95 @@ +cmake_minimum_required(VERSION 3.15) +project(example LANGUAGES CXX) + +set(BINARY_NAME "example") + +cmake_policy(SET CMP0063 NEW) + +set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") + +# Configure build options. +get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(IS_MULTICONFIG) + set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" + CACHE STRING "" FORCE) +else() + if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + set(CMAKE_BUILD_TYPE "Debug" CACHE + STRING "Flutter build mode" FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS + "Debug" "Profile" "Release") + endif() +endif() + +set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") +set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") +set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") +set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") + +# Use Unicode for all projects. +add_definitions(-DUNICODE -D_UNICODE) + +# Compilation settings that should be applied to most targets. +function(APPLY_STANDARD_SETTINGS TARGET) + target_compile_features(${TARGET} PUBLIC cxx_std_17) + target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") + target_compile_options(${TARGET} PRIVATE /EHsc) + target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") + target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") +endfunction() + +set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") + +# Flutter library and tool build rules. +add_subdirectory(${FLUTTER_MANAGED_DIR}) + +# Application build +add_subdirectory("runner") + +# Generated plugin build rules, which manage building the plugins and adding +# them to the application. +include(flutter/generated_plugins.cmake) + + +# === Installation === +# Support files are copied into place next to the executable, so that it can +# run in place. This is done instead of making a separate bundle (as on Linux) +# so that building and running from within Visual Studio will work. +set(BUILD_BUNDLE_DIR "$") +# Make the "install" step default, as it's required to run. +set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) +endif() + +set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") +set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") + +install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" + COMPONENT Runtime) + +install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" + COMPONENT Runtime) + +install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) + +if(PLUGIN_BUNDLED_LIBRARIES) + install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) +endif() + +# Fully re-copy the assets directory on each build to avoid having stale files +# from a previous install. +set(FLUTTER_ASSET_DIR_NAME "flutter_assets") +install(CODE " + file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") + " COMPONENT Runtime) +install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" + DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) + +# Install the AOT library on non-Debug builds only. +install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" + CONFIGURATIONS Profile;Release + COMPONENT Runtime) diff --git a/third_party/packages/flutter_svg/example/windows/flutter/CMakeLists.txt b/third_party/packages/flutter_svg/example/windows/flutter/CMakeLists.txt new file mode 100644 index 000000000000..b02c5485c957 --- /dev/null +++ b/third_party/packages/flutter_svg/example/windows/flutter/CMakeLists.txt @@ -0,0 +1,103 @@ +cmake_minimum_required(VERSION 3.15) + +set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") + +# Configuration provided via flutter tool. +include(${EPHEMERAL_DIR}/generated_config.cmake) + +# TODO: Move the rest of this into files in ephemeral. See +# https://github.com/flutter/flutter/issues/57146. +set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") + +# === Flutter Library === +set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") + +# Published to parent scope for install step. +set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) +set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) +set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) +set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) + +list(APPEND FLUTTER_LIBRARY_HEADERS + "flutter_export.h" + "flutter_windows.h" + "flutter_messenger.h" + "flutter_plugin_registrar.h" + "flutter_texture_registrar.h" +) +list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") +add_library(flutter INTERFACE) +target_include_directories(flutter INTERFACE + "${EPHEMERAL_DIR}" +) +target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") +add_dependencies(flutter flutter_assemble) + +# === Wrapper === +list(APPEND CPP_WRAPPER_SOURCES_CORE + "core_implementations.cc" + "standard_codec.cc" +) +list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") +list(APPEND CPP_WRAPPER_SOURCES_PLUGIN + "plugin_registrar.cc" +) +list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") +list(APPEND CPP_WRAPPER_SOURCES_APP + "flutter_engine.cc" + "flutter_view_controller.cc" +) +list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") + +# Wrapper sources needed for a plugin. +add_library(flutter_wrapper_plugin STATIC + ${CPP_WRAPPER_SOURCES_CORE} + ${CPP_WRAPPER_SOURCES_PLUGIN} +) +apply_standard_settings(flutter_wrapper_plugin) +set_target_properties(flutter_wrapper_plugin PROPERTIES + POSITION_INDEPENDENT_CODE ON) +set_target_properties(flutter_wrapper_plugin PROPERTIES + CXX_VISIBILITY_PRESET hidden) +target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) +target_include_directories(flutter_wrapper_plugin PUBLIC + "${WRAPPER_ROOT}/include" +) +add_dependencies(flutter_wrapper_plugin flutter_assemble) + +# Wrapper sources needed for the runner. +add_library(flutter_wrapper_app STATIC + ${CPP_WRAPPER_SOURCES_CORE} + ${CPP_WRAPPER_SOURCES_APP} +) +apply_standard_settings(flutter_wrapper_app) +target_link_libraries(flutter_wrapper_app PUBLIC flutter) +target_include_directories(flutter_wrapper_app PUBLIC + "${WRAPPER_ROOT}/include" +) +add_dependencies(flutter_wrapper_app flutter_assemble) + +# === Flutter tool backend === +# _phony_ is a non-existent file to force this command to run every time, +# since currently there's no way to get a full input/output list from the +# flutter tool. +set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") +set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) +add_custom_command( + OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} + ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} + ${CPP_WRAPPER_SOURCES_APP} + ${PHONY_OUTPUT} + COMMAND ${CMAKE_COMMAND} -E env + ${FLUTTER_TOOL_ENVIRONMENT} + "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" + windows-x64 $ + VERBATIM +) +add_custom_target(flutter_assemble DEPENDS + "${FLUTTER_LIBRARY}" + ${FLUTTER_LIBRARY_HEADERS} + ${CPP_WRAPPER_SOURCES_CORE} + ${CPP_WRAPPER_SOURCES_PLUGIN} + ${CPP_WRAPPER_SOURCES_APP} +) diff --git a/third_party/packages/flutter_svg/example/windows/flutter/generated_plugin_registrant.cc b/third_party/packages/flutter_svg/example/windows/flutter/generated_plugin_registrant.cc new file mode 100644 index 000000000000..8b6d4680af38 --- /dev/null +++ b/third_party/packages/flutter_svg/example/windows/flutter/generated_plugin_registrant.cc @@ -0,0 +1,11 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#include "generated_plugin_registrant.h" + + +void RegisterPlugins(flutter::PluginRegistry* registry) { +} diff --git a/third_party/packages/flutter_svg/example/windows/flutter/generated_plugin_registrant.h b/third_party/packages/flutter_svg/example/windows/flutter/generated_plugin_registrant.h new file mode 100644 index 000000000000..dc139d85a931 --- /dev/null +++ b/third_party/packages/flutter_svg/example/windows/flutter/generated_plugin_registrant.h @@ -0,0 +1,15 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#ifndef GENERATED_PLUGIN_REGISTRANT_ +#define GENERATED_PLUGIN_REGISTRANT_ + +#include + +// Registers Flutter plugins. +void RegisterPlugins(flutter::PluginRegistry* registry); + +#endif // GENERATED_PLUGIN_REGISTRANT_ diff --git a/third_party/packages/flutter_svg/example/windows/flutter/generated_plugins.cmake b/third_party/packages/flutter_svg/example/windows/flutter/generated_plugins.cmake new file mode 100644 index 000000000000..b93c4c30c167 --- /dev/null +++ b/third_party/packages/flutter_svg/example/windows/flutter/generated_plugins.cmake @@ -0,0 +1,23 @@ +# +# Generated file, do not edit. +# + +list(APPEND FLUTTER_PLUGIN_LIST +) + +list(APPEND FLUTTER_FFI_PLUGIN_LIST +) + +set(PLUGIN_BUNDLED_LIBRARIES) + +foreach(plugin ${FLUTTER_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) + target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) + list(APPEND PLUGIN_BUNDLED_LIBRARIES $) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) +endforeach(plugin) + +foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) +endforeach(ffi_plugin) diff --git a/third_party/packages/flutter_svg/example/windows/runner/CMakeLists.txt b/third_party/packages/flutter_svg/example/windows/runner/CMakeLists.txt new file mode 100644 index 000000000000..977e38b5d1d2 --- /dev/null +++ b/third_party/packages/flutter_svg/example/windows/runner/CMakeLists.txt @@ -0,0 +1,18 @@ +cmake_minimum_required(VERSION 3.15) +project(runner LANGUAGES CXX) + +add_executable(${BINARY_NAME} WIN32 + "flutter_window.cpp" + "main.cpp" + "run_loop.cpp" + "utils.cpp" + "win32_window.cpp" + "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" + "Runner.rc" + "runner.exe.manifest" +) +apply_standard_settings(${BINARY_NAME}) +target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") +target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) +target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") +add_dependencies(${BINARY_NAME} flutter_assemble) diff --git a/third_party/packages/flutter_svg/example/windows/runner/Runner.rc b/third_party/packages/flutter_svg/example/windows/runner/Runner.rc new file mode 100644 index 000000000000..51812dcd4878 --- /dev/null +++ b/third_party/packages/flutter_svg/example/windows/runner/Runner.rc @@ -0,0 +1,121 @@ +// Microsoft Visual C++ generated resource script. +// +#pragma code_page(65001) +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (United States) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_APP_ICON ICON "resources\\app_icon.ico" + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +#ifdef FLUTTER_BUILD_NUMBER +#define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER +#else +#define VERSION_AS_NUMBER 1,0,0 +#endif + +#ifdef FLUTTER_BUILD_NAME +#define VERSION_AS_STRING #FLUTTER_BUILD_NAME +#else +#define VERSION_AS_STRING "1.0.0" +#endif + +VS_VERSION_INFO VERSIONINFO + FILEVERSION VERSION_AS_NUMBER + PRODUCTVERSION VERSION_AS_NUMBER + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +#ifdef _DEBUG + FILEFLAGS VS_FF_DEBUG +#else + FILEFLAGS 0x0L +#endif + FILEOS VOS__WINDOWS32 + FILETYPE VFT_APP + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904e4" + BEGIN + VALUE "CompanyName", "com.example" "\0" + VALUE "FileDescription", "A new Flutter project." "\0" + VALUE "FileVersion", VERSION_AS_STRING "\0" + VALUE "InternalName", "example" "\0" + VALUE "LegalCopyright", "Copyright (C) 2021 com.example. All rights reserved." "\0" + VALUE "OriginalFilename", "example.exe" "\0" + VALUE "ProductName", "example" "\0" + VALUE "ProductVersion", VERSION_AS_STRING "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1252 + END +END + +#endif // English (United States) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED diff --git a/third_party/packages/flutter_svg/example/windows/runner/flutter_window.cpp b/third_party/packages/flutter_svg/example/windows/runner/flutter_window.cpp new file mode 100644 index 000000000000..c422723045ca --- /dev/null +++ b/third_party/packages/flutter_svg/example/windows/runner/flutter_window.cpp @@ -0,0 +1,64 @@ +#include "flutter_window.h" + +#include + +#include "flutter/generated_plugin_registrant.h" + +FlutterWindow::FlutterWindow(RunLoop* run_loop, + const flutter::DartProject& project) + : run_loop_(run_loop), project_(project) {} + +FlutterWindow::~FlutterWindow() {} + +bool FlutterWindow::OnCreate() { + if (!Win32Window::OnCreate()) { + return false; + } + + RECT frame = GetClientArea(); + + // The size here must match the window dimensions to avoid unnecessary surface + // creation / destruction in the startup path. + flutter_controller_ = std::make_unique( + frame.right - frame.left, frame.bottom - frame.top, project_); + // Ensure that basic setup of the controller was successful. + if (!flutter_controller_->engine() || !flutter_controller_->view()) { + return false; + } + RegisterPlugins(flutter_controller_->engine()); + run_loop_->RegisterFlutterInstance(flutter_controller_->engine()); + SetChildContent(flutter_controller_->view()->GetNativeWindow()); + return true; +} + +void FlutterWindow::OnDestroy() { + if (flutter_controller_) { + run_loop_->UnregisterFlutterInstance(flutter_controller_->engine()); + flutter_controller_ = nullptr; + } + + Win32Window::OnDestroy(); +} + +LRESULT +FlutterWindow::MessageHandler(HWND hwnd, UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept { + // Give Flutter, including plugins, an opporutunity to handle window messages. + if (flutter_controller_) { + std::optional result = + flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, + lparam); + if (result) { + return *result; + } + } + + switch (message) { + case WM_FONTCHANGE: + flutter_controller_->engine()->ReloadSystemFonts(); + break; + } + + return Win32Window::MessageHandler(hwnd, message, wparam, lparam); +} diff --git a/third_party/packages/flutter_svg/example/windows/runner/flutter_window.h b/third_party/packages/flutter_svg/example/windows/runner/flutter_window.h new file mode 100644 index 000000000000..b663ddd50125 --- /dev/null +++ b/third_party/packages/flutter_svg/example/windows/runner/flutter_window.h @@ -0,0 +1,39 @@ +#ifndef RUNNER_FLUTTER_WINDOW_H_ +#define RUNNER_FLUTTER_WINDOW_H_ + +#include +#include + +#include + +#include "run_loop.h" +#include "win32_window.h" + +// A window that does nothing but host a Flutter view. +class FlutterWindow : public Win32Window { + public: + // Creates a new FlutterWindow driven by the |run_loop|, hosting a + // Flutter view running |project|. + explicit FlutterWindow(RunLoop* run_loop, + const flutter::DartProject& project); + virtual ~FlutterWindow(); + + protected: + // Win32Window: + bool OnCreate() override; + void OnDestroy() override; + LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, + LPARAM const lparam) noexcept override; + + private: + // The run loop driving events for this window. + RunLoop* run_loop_; + + // The project to run. + flutter::DartProject project_; + + // The Flutter instance hosted by this window. + std::unique_ptr flutter_controller_; +}; + +#endif // RUNNER_FLUTTER_WINDOW_H_ diff --git a/third_party/packages/flutter_svg/example/windows/runner/main.cpp b/third_party/packages/flutter_svg/example/windows/runner/main.cpp new file mode 100644 index 000000000000..b637809bd386 --- /dev/null +++ b/third_party/packages/flutter_svg/example/windows/runner/main.cpp @@ -0,0 +1,42 @@ +#include +#include +#include + +#include "flutter_window.h" +#include "run_loop.h" +#include "utils.h" + +int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, + _In_ wchar_t *command_line, _In_ int show_command) { + // Attach to console when present (e.g., 'flutter run') or create a + // new console when running with a debugger. + if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { + CreateAndAttachConsole(); + } + + // Initialize COM, so that it is available for use in the library and/or + // plugins. + ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); + + RunLoop run_loop; + + flutter::DartProject project(L"data"); + + std::vector command_line_arguments = + GetCommandLineArguments(); + + project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); + + FlutterWindow window(&run_loop, project); + Win32Window::Point origin(10, 10); + Win32Window::Size size(1280, 720); + if (!window.CreateAndShow(L"example", origin, size)) { + return EXIT_FAILURE; + } + window.SetQuitOnClose(true); + + run_loop.Run(); + + ::CoUninitialize(); + return EXIT_SUCCESS; +} diff --git a/third_party/packages/flutter_svg/example/windows/runner/resource.h b/third_party/packages/flutter_svg/example/windows/runner/resource.h new file mode 100644 index 000000000000..66a65d1e4a79 --- /dev/null +++ b/third_party/packages/flutter_svg/example/windows/runner/resource.h @@ -0,0 +1,16 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by Runner.rc +// +#define IDI_APP_ICON 101 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 102 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/third_party/packages/flutter_svg/example/windows/runner/resources/app_icon.ico b/third_party/packages/flutter_svg/example/windows/runner/resources/app_icon.ico new file mode 100644 index 000000000000..c04e20caf637 Binary files /dev/null and b/third_party/packages/flutter_svg/example/windows/runner/resources/app_icon.ico differ diff --git a/third_party/packages/flutter_svg/example/windows/runner/run_loop.cpp b/third_party/packages/flutter_svg/example/windows/runner/run_loop.cpp new file mode 100644 index 000000000000..2d6636ab6bc6 --- /dev/null +++ b/third_party/packages/flutter_svg/example/windows/runner/run_loop.cpp @@ -0,0 +1,66 @@ +#include "run_loop.h" + +#include + +#include + +RunLoop::RunLoop() {} + +RunLoop::~RunLoop() {} + +void RunLoop::Run() { + bool keep_running = true; + TimePoint next_flutter_event_time = TimePoint::clock::now(); + while (keep_running) { + std::chrono::nanoseconds wait_duration = + std::max(std::chrono::nanoseconds(0), + next_flutter_event_time - TimePoint::clock::now()); + ::MsgWaitForMultipleObjects( + 0, nullptr, FALSE, static_cast(wait_duration.count() / 1000), + QS_ALLINPUT); + bool processed_events = false; + MSG message; + // All pending Windows messages must be processed; MsgWaitForMultipleObjects + // won't return again for items left in the queue after PeekMessage. + while (::PeekMessage(&message, nullptr, 0, 0, PM_REMOVE)) { + processed_events = true; + if (message.message == WM_QUIT) { + keep_running = false; + break; + } + ::TranslateMessage(&message); + ::DispatchMessage(&message); + // Allow Flutter to process messages each time a Windows message is + // processed, to prevent starvation. + next_flutter_event_time = + std::min(next_flutter_event_time, ProcessFlutterMessages()); + } + // If the PeekMessage loop didn't run, process Flutter messages. + if (!processed_events) { + next_flutter_event_time = + std::min(next_flutter_event_time, ProcessFlutterMessages()); + } + } +} + +void RunLoop::RegisterFlutterInstance( + flutter::FlutterEngine* flutter_instance) { + flutter_instances_.insert(flutter_instance); +} + +void RunLoop::UnregisterFlutterInstance( + flutter::FlutterEngine* flutter_instance) { + flutter_instances_.erase(flutter_instance); +} + +RunLoop::TimePoint RunLoop::ProcessFlutterMessages() { + TimePoint next_event_time = TimePoint::max(); + for (auto instance : flutter_instances_) { + std::chrono::nanoseconds wait_duration = instance->ProcessMessages(); + if (wait_duration != std::chrono::nanoseconds::max()) { + next_event_time = + std::min(next_event_time, TimePoint::clock::now() + wait_duration); + } + } + return next_event_time; +} diff --git a/third_party/packages/flutter_svg/example/windows/runner/run_loop.h b/third_party/packages/flutter_svg/example/windows/runner/run_loop.h new file mode 100644 index 000000000000..000d3624638e --- /dev/null +++ b/third_party/packages/flutter_svg/example/windows/runner/run_loop.h @@ -0,0 +1,40 @@ +#ifndef RUNNER_RUN_LOOP_H_ +#define RUNNER_RUN_LOOP_H_ + +#include + +#include +#include + +// A runloop that will service events for Flutter instances as well +// as native messages. +class RunLoop { + public: + RunLoop(); + ~RunLoop(); + + // Prevent copying + RunLoop(RunLoop const&) = delete; + RunLoop& operator=(RunLoop const&) = delete; + + // Runs the run loop until the application quits. + void Run(); + + // Registers the given Flutter instance for event servicing. + void RegisterFlutterInstance( + flutter::FlutterEngine* flutter_instance); + + // Unregisters the given Flutter instance from event servicing. + void UnregisterFlutterInstance( + flutter::FlutterEngine* flutter_instance); + + private: + using TimePoint = std::chrono::steady_clock::time_point; + + // Processes all currently pending messages for registered Flutter instances. + TimePoint ProcessFlutterMessages(); + + std::set flutter_instances_; +}; + +#endif // RUNNER_RUN_LOOP_H_ diff --git a/third_party/packages/flutter_svg/example/windows/runner/runner.exe.manifest b/third_party/packages/flutter_svg/example/windows/runner/runner.exe.manifest new file mode 100644 index 000000000000..c977c4a42589 --- /dev/null +++ b/third_party/packages/flutter_svg/example/windows/runner/runner.exe.manifest @@ -0,0 +1,20 @@ + + + + + PerMonitorV2 + + + + + + + + + + + + + + + diff --git a/third_party/packages/flutter_svg/example/windows/runner/utils.cpp b/third_party/packages/flutter_svg/example/windows/runner/utils.cpp new file mode 100644 index 000000000000..d19bdbbcc322 --- /dev/null +++ b/third_party/packages/flutter_svg/example/windows/runner/utils.cpp @@ -0,0 +1,64 @@ +#include "utils.h" + +#include +#include +#include +#include + +#include + +void CreateAndAttachConsole() { + if (::AllocConsole()) { + FILE *unused; + if (freopen_s(&unused, "CONOUT$", "w", stdout)) { + _dup2(_fileno(stdout), 1); + } + if (freopen_s(&unused, "CONOUT$", "w", stderr)) { + _dup2(_fileno(stdout), 2); + } + std::ios::sync_with_stdio(); + FlutterDesktopResyncOutputStreams(); + } +} + +std::vector GetCommandLineArguments() { + // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. + int argc; + wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); + if (argv == nullptr) { + return std::vector(); + } + + std::vector command_line_arguments; + + // Skip the first argument as it's the binary name. + for (int i = 1; i < argc; i++) { + command_line_arguments.push_back(Utf8FromUtf16(argv[i])); + } + + ::LocalFree(argv); + + return command_line_arguments; +} + +std::string Utf8FromUtf16(const wchar_t* utf16_string) { + if (utf16_string == nullptr) { + return std::string(); + } + int target_length = ::WideCharToMultiByte( + CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, + -1, nullptr, 0, nullptr, nullptr); + if (target_length == 0) { + return std::string(); + } + std::string utf8_string; + utf8_string.resize(target_length); + int converted_length = ::WideCharToMultiByte( + CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, + -1, utf8_string.data(), + target_length, nullptr, nullptr); + if (converted_length == 0) { + return std::string(); + } + return utf8_string; +} diff --git a/third_party/packages/flutter_svg/example/windows/runner/utils.h b/third_party/packages/flutter_svg/example/windows/runner/utils.h new file mode 100644 index 000000000000..3879d5475579 --- /dev/null +++ b/third_party/packages/flutter_svg/example/windows/runner/utils.h @@ -0,0 +1,19 @@ +#ifndef RUNNER_UTILS_H_ +#define RUNNER_UTILS_H_ + +#include +#include + +// Creates a console for the process, and redirects stdout and stderr to +// it for both the runner and the Flutter library. +void CreateAndAttachConsole(); + +// Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string +// encoded in UTF-8. Returns an empty std::string on failure. +std::string Utf8FromUtf16(const wchar_t* utf16_string); + +// Gets the command line arguments passed in as a std::vector, +// encoded in UTF-8. Returns an empty std::vector on failure. +std::vector GetCommandLineArguments(); + +#endif // RUNNER_UTILS_H_ diff --git a/third_party/packages/flutter_svg/example/windows/runner/win32_window.cpp b/third_party/packages/flutter_svg/example/windows/runner/win32_window.cpp new file mode 100644 index 000000000000..c10f08dc7da6 --- /dev/null +++ b/third_party/packages/flutter_svg/example/windows/runner/win32_window.cpp @@ -0,0 +1,245 @@ +#include "win32_window.h" + +#include + +#include "resource.h" + +namespace { + +constexpr const wchar_t kWindowClassName[] = L"FLUTTER_RUNNER_WIN32_WINDOW"; + +// The number of Win32Window objects that currently exist. +static int g_active_window_count = 0; + +using EnableNonClientDpiScaling = BOOL __stdcall(HWND hwnd); + +// Scale helper to convert logical scaler values to physical using passed in +// scale factor +int Scale(int source, double scale_factor) { + return static_cast(source * scale_factor); +} + +// Dynamically loads the |EnableNonClientDpiScaling| from the User32 module. +// This API is only needed for PerMonitor V1 awareness mode. +void EnableFullDpiSupportIfAvailable(HWND hwnd) { + HMODULE user32_module = LoadLibraryA("User32.dll"); + if (!user32_module) { + return; + } + auto enable_non_client_dpi_scaling = + reinterpret_cast( + GetProcAddress(user32_module, "EnableNonClientDpiScaling")); + if (enable_non_client_dpi_scaling != nullptr) { + enable_non_client_dpi_scaling(hwnd); + FreeLibrary(user32_module); + } +} + +} // namespace + +// Manages the Win32Window's window class registration. +class WindowClassRegistrar { + public: + ~WindowClassRegistrar() = default; + + // Returns the singleton registar instance. + static WindowClassRegistrar* GetInstance() { + if (!instance_) { + instance_ = new WindowClassRegistrar(); + } + return instance_; + } + + // Returns the name of the window class, registering the class if it hasn't + // previously been registered. + const wchar_t* GetWindowClass(); + + // Unregisters the window class. Should only be called if there are no + // instances of the window. + void UnregisterWindowClass(); + + private: + WindowClassRegistrar() = default; + + static WindowClassRegistrar* instance_; + + bool class_registered_ = false; +}; + +WindowClassRegistrar* WindowClassRegistrar::instance_ = nullptr; + +const wchar_t* WindowClassRegistrar::GetWindowClass() { + if (!class_registered_) { + WNDCLASS window_class{}; + window_class.hCursor = LoadCursor(nullptr, IDC_ARROW); + window_class.lpszClassName = kWindowClassName; + window_class.style = CS_HREDRAW | CS_VREDRAW; + window_class.cbClsExtra = 0; + window_class.cbWndExtra = 0; + window_class.hInstance = GetModuleHandle(nullptr); + window_class.hIcon = + LoadIcon(window_class.hInstance, MAKEINTRESOURCE(IDI_APP_ICON)); + window_class.hbrBackground = 0; + window_class.lpszMenuName = nullptr; + window_class.lpfnWndProc = Win32Window::WndProc; + RegisterClass(&window_class); + class_registered_ = true; + } + return kWindowClassName; +} + +void WindowClassRegistrar::UnregisterWindowClass() { + UnregisterClass(kWindowClassName, nullptr); + class_registered_ = false; +} + +Win32Window::Win32Window() { + ++g_active_window_count; +} + +Win32Window::~Win32Window() { + --g_active_window_count; + Destroy(); +} + +bool Win32Window::CreateAndShow(const std::wstring& title, + const Point& origin, + const Size& size) { + Destroy(); + + const wchar_t* window_class = + WindowClassRegistrar::GetInstance()->GetWindowClass(); + + const POINT target_point = {static_cast(origin.x), + static_cast(origin.y)}; + HMONITOR monitor = MonitorFromPoint(target_point, MONITOR_DEFAULTTONEAREST); + UINT dpi = FlutterDesktopGetDpiForMonitor(monitor); + double scale_factor = dpi / 96.0; + + HWND window = CreateWindow( + window_class, title.c_str(), WS_OVERLAPPEDWINDOW | WS_VISIBLE, + Scale(origin.x, scale_factor), Scale(origin.y, scale_factor), + Scale(size.width, scale_factor), Scale(size.height, scale_factor), + nullptr, nullptr, GetModuleHandle(nullptr), this); + + if (!window) { + return false; + } + + return OnCreate(); +} + +// static +LRESULT CALLBACK Win32Window::WndProc(HWND const window, + UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept { + if (message == WM_NCCREATE) { + auto window_struct = reinterpret_cast(lparam); + SetWindowLongPtr(window, GWLP_USERDATA, + reinterpret_cast(window_struct->lpCreateParams)); + + auto that = static_cast(window_struct->lpCreateParams); + EnableFullDpiSupportIfAvailable(window); + that->window_handle_ = window; + } else if (Win32Window* that = GetThisFromHandle(window)) { + return that->MessageHandler(window, message, wparam, lparam); + } + + return DefWindowProc(window, message, wparam, lparam); +} + +LRESULT +Win32Window::MessageHandler(HWND hwnd, + UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept { + switch (message) { + case WM_DESTROY: + window_handle_ = nullptr; + Destroy(); + if (quit_on_close_) { + PostQuitMessage(0); + } + return 0; + + case WM_DPICHANGED: { + auto newRectSize = reinterpret_cast(lparam); + LONG newWidth = newRectSize->right - newRectSize->left; + LONG newHeight = newRectSize->bottom - newRectSize->top; + + SetWindowPos(hwnd, nullptr, newRectSize->left, newRectSize->top, newWidth, + newHeight, SWP_NOZORDER | SWP_NOACTIVATE); + + return 0; + } + case WM_SIZE: { + RECT rect = GetClientArea(); + if (child_content_ != nullptr) { + // Size and position the child window. + MoveWindow(child_content_, rect.left, rect.top, rect.right - rect.left, + rect.bottom - rect.top, TRUE); + } + return 0; + } + + case WM_ACTIVATE: + if (child_content_ != nullptr) { + SetFocus(child_content_); + } + return 0; + } + + return DefWindowProc(window_handle_, message, wparam, lparam); +} + +void Win32Window::Destroy() { + OnDestroy(); + + if (window_handle_) { + DestroyWindow(window_handle_); + window_handle_ = nullptr; + } + if (g_active_window_count == 0) { + WindowClassRegistrar::GetInstance()->UnregisterWindowClass(); + } +} + +Win32Window* Win32Window::GetThisFromHandle(HWND const window) noexcept { + return reinterpret_cast( + GetWindowLongPtr(window, GWLP_USERDATA)); +} + +void Win32Window::SetChildContent(HWND content) { + child_content_ = content; + SetParent(content, window_handle_); + RECT frame = GetClientArea(); + + MoveWindow(content, frame.left, frame.top, frame.right - frame.left, + frame.bottom - frame.top, true); + + SetFocus(child_content_); +} + +RECT Win32Window::GetClientArea() { + RECT frame; + GetClientRect(window_handle_, &frame); + return frame; +} + +HWND Win32Window::GetHandle() { + return window_handle_; +} + +void Win32Window::SetQuitOnClose(bool quit_on_close) { + quit_on_close_ = quit_on_close; +} + +bool Win32Window::OnCreate() { + // No-op; provided for subclasses. + return true; +} + +void Win32Window::OnDestroy() { + // No-op; provided for subclasses. +} diff --git a/third_party/packages/flutter_svg/example/windows/runner/win32_window.h b/third_party/packages/flutter_svg/example/windows/runner/win32_window.h new file mode 100644 index 000000000000..17ba431125b4 --- /dev/null +++ b/third_party/packages/flutter_svg/example/windows/runner/win32_window.h @@ -0,0 +1,98 @@ +#ifndef RUNNER_WIN32_WINDOW_H_ +#define RUNNER_WIN32_WINDOW_H_ + +#include + +#include +#include +#include + +// A class abstraction for a high DPI-aware Win32 Window. Intended to be +// inherited from by classes that wish to specialize with custom +// rendering and input handling +class Win32Window { + public: + struct Point { + unsigned int x; + unsigned int y; + Point(unsigned int x, unsigned int y) : x(x), y(y) {} + }; + + struct Size { + unsigned int width; + unsigned int height; + Size(unsigned int width, unsigned int height) + : width(width), height(height) {} + }; + + Win32Window(); + virtual ~Win32Window(); + + // Creates and shows a win32 window with |title| and position and size using + // |origin| and |size|. New windows are created on the default monitor. Window + // sizes are specified to the OS in physical pixels, hence to ensure a + // consistent size to will treat the width height passed in to this function + // as logical pixels and scale to appropriate for the default monitor. Returns + // true if the window was created successfully. + bool CreateAndShow(const std::wstring& title, + const Point& origin, + const Size& size); + + // Release OS resources associated with window. + void Destroy(); + + // Inserts |content| into the window tree. + void SetChildContent(HWND content); + + // Returns the backing Window handle to enable clients to set icon and other + // window properties. Returns nullptr if the window has been destroyed. + HWND GetHandle(); + + // If true, closing this window will quit the application. + void SetQuitOnClose(bool quit_on_close); + + // Return a RECT representing the bounds of the current client area. + RECT GetClientArea(); + + protected: + // Processes and route salient window messages for mouse handling, + // size change and DPI. Delegates handling of these to member overloads that + // inheriting classes can handle. + virtual LRESULT MessageHandler(HWND window, + UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept; + + // Called when CreateAndShow is called, allowing subclass window-related + // setup. Subclasses should return false if setup fails. + virtual bool OnCreate(); + + // Called when Destroy is called. + virtual void OnDestroy(); + + private: + friend class WindowClassRegistrar; + + // OS callback called by message pump. Handles the WM_NCCREATE message which + // is passed when the non-client area is being created and enables automatic + // non-client DPI scaling so that the non-client area automatically + // responsponds to changes in DPI. All other messages are handled by + // MessageHandler. + static LRESULT CALLBACK WndProc(HWND const window, + UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept; + + // Retrieves a class instance pointer for |window| + static Win32Window* GetThisFromHandle(HWND const window) noexcept; + + bool quit_on_close_ = false; + + // window handle for top level window. + HWND window_handle_ = nullptr; + + // window handle for hosted content. + HWND child_content_ = nullptr; +}; + +#endif // RUNNER_WIN32_WINDOW_H_ diff --git a/third_party/packages/flutter_svg/flutter_svg.iml b/third_party/packages/flutter_svg/flutter_svg.iml new file mode 100644 index 000000000000..e5c837191e06 --- /dev/null +++ b/third_party/packages/flutter_svg/flutter_svg.iml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/third_party/packages/flutter_svg/flutter_svg_android.iml b/third_party/packages/flutter_svg/flutter_svg_android.iml new file mode 100644 index 000000000000..57406edb174c --- /dev/null +++ b/third_party/packages/flutter_svg/flutter_svg_android.iml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/third_party/packages/flutter_svg/lib/flutter_svg.dart b/third_party/packages/flutter_svg/lib/flutter_svg.dart new file mode 100644 index 000000000000..eb6d4b5ab9e8 --- /dev/null +++ b/third_party/packages/flutter_svg/lib/flutter_svg.dart @@ -0,0 +1 @@ +export 'svg.dart'; diff --git a/third_party/packages/flutter_svg/lib/src/cache.dart b/third_party/packages/flutter_svg/lib/src/cache.dart new file mode 100644 index 000000000000..adfd9bb23f22 --- /dev/null +++ b/third_party/packages/flutter_svg/lib/src/cache.dart @@ -0,0 +1,113 @@ +import 'package:flutter/foundation.dart'; +import 'package:vector_graphics_compiler/vector_graphics_compiler.dart'; + +/// The cache for decoded SVGs. +class Cache { + final Map> _pending = >{}; + final Map _cache = {}; + + /// Maximum number of entries to store in the cache. + /// + /// Once this many entries have been cached, the least-recently-used entry is + /// evicted when adding a new entry. + int get maximumSize => _maximumSize; + int _maximumSize = 100; + + /// Changes the maximum cache size. + /// + /// If the new size is smaller than the current number of elements, the + /// extraneous elements are evicted immediately. Setting this to zero and then + /// returning it to its original value will therefore immediately clear the + /// cache. + set maximumSize(int value) { + assert(value != null); // ignore: unnecessary_null_comparison + assert(value >= 0); + if (value == maximumSize) { + return; + } + _maximumSize = value; + if (maximumSize == 0) { + clear(); + } else { + while (_cache.length > maximumSize) { + _cache.remove(_cache.keys.first); + } + } + } + + /// Evicts all entries from the cache. + /// + /// This is useful if, for instance, the root asset bundle has been updated + /// and therefore new images must be obtained. + void clear() { + _cache.clear(); + } + + /// Evicts a single entry from the cache, returning true if successful. + bool evict(Object key) { + return _cache.remove(key) != null; + } + + /// Evicts a single entry from the cache if the `oldData` and `newData` are + /// incompatible. + /// + /// For example, if the theme has changed the current color and the picture + /// uses current color, [evict] will be called. + bool maybeEvict(Object key, SvgTheme oldData, SvgTheme newData) { + return evict(key); + } + + /// Returns the previously cached [PictureStream] for the given key, if available; + /// if not, calls the given callback to obtain it first. In either case, the + /// key is moved to the "most recently used" position. + /// + /// The arguments must not be null. The `loader` cannot return null. + Future putIfAbsent( + Object key, + Future loader(), + ) { + assert(key != null); // ignore: unnecessary_null_comparison + assert(loader != null); // ignore: unnecessary_null_comparison + Future? pendingResult = _pending[key]; + if (pendingResult != null) { + return pendingResult; + } + + ByteData? result = _cache[key]; + if (result != null) { + // Remove the provider from the list so that we can put it back in below + // and thus move it to the end of the list. + _cache.remove(key); + } else { + pendingResult = loader(); + _pending[key] = pendingResult; + pendingResult.then((ByteData data) { + _pending.remove(key); + _add(key, data); + result = data; // in case it was a synchronous future. + }); + } + if (result != null) { + _add(key, result!); + return SynchronousFuture(result!); + } + assert(_cache.length <= maximumSize); + return pendingResult!; + } + + void _add(Object key, ByteData result) { + if (maximumSize > 0) { + if (_cache.containsKey(key)) { + _cache.remove(key); // update LRU. + } else if (_cache.length == maximumSize && maximumSize > 0) { + _cache.remove(_cache.keys.first); + } + assert(_cache.length < maximumSize); + _cache[key] = result; + } + assert(_cache.length <= maximumSize); + } + + /// The number of entries in the cache. + int get count => _cache.length; +} diff --git a/third_party/packages/flutter_svg/lib/src/default_theme.dart b/third_party/packages/flutter_svg/lib/src/default_theme.dart new file mode 100644 index 000000000000..a44a981d6669 --- /dev/null +++ b/third_party/packages/flutter_svg/lib/src/default_theme.dart @@ -0,0 +1,42 @@ +import 'package:flutter/widgets.dart'; + +import 'loaders.dart'; + +/// The SVG theme to apply to descendant [SvgPicture] widgets +/// which don't have explicit theme values. +class DefaultSvgTheme extends InheritedTheme { + /// Creates a default SVG theme for the given subtree + /// using the provided [theme]. + const DefaultSvgTheme({ + Key? key, + required Widget child, + required this.theme, + }) : super(key: key, child: child); + + /// The SVG theme to apply. + final SvgTheme theme; + + /// The closest instance of this class that encloses the given context. + /// + /// Typical usage is as follows: + /// + /// ```dart + /// DefaultSvgTheme theme = DefaultSvgTheme.of(context); + /// ``` + static DefaultSvgTheme? of(BuildContext context) { + return context.dependOnInheritedWidgetOfExactType(); + } + + @override + bool updateShouldNotify(DefaultSvgTheme oldWidget) { + return theme != oldWidget.theme; + } + + @override + Widget wrap(BuildContext context, Widget child) { + return DefaultSvgTheme( + theme: theme, + child: child, + ); + } +} diff --git a/third_party/packages/flutter_svg/lib/src/loaders.dart b/third_party/packages/flutter_svg/lib/src/loaders.dart new file mode 100644 index 000000000000..2996cc11f64f --- /dev/null +++ b/third_party/packages/flutter_svg/lib/src/loaders.dart @@ -0,0 +1,462 @@ +import 'dart:convert' show utf8; + +import 'package:flutter/foundation.dart' hide compute; +import 'package:flutter/services.dart'; +import 'package:flutter/widgets.dart'; +import 'package:http/http.dart' as http; +import 'package:vector_graphics/vector_graphics.dart'; +import 'package:vector_graphics_compiler/vector_graphics_compiler.dart' as vg; + +import '../svg.dart' show svg; +import 'default_theme.dart'; +import 'utilities/compute.dart'; +import 'utilities/file.dart'; + +/// A theme used when decoding an SVG picture. +@immutable +class SvgTheme { + /// Instantiates an SVG theme with the [currentColor] + /// and [fontSize]. + /// + /// Defaults the [fontSize] to 14. + // WARNING WARNING WARNING + // If this codebase ever decides to default the font size to something off the + // BuildContext, caching logic will have to be updated. The font size can + // temporarily and unexpectedly change during route transitions in common + // patterns used in `MaterialApp`. This busts caching and destroys + // performance. + const SvgTheme({ + this.currentColor = const Color(0xFF000000), + this.fontSize = 14, + double? xHeight, + }) : xHeight = xHeight ?? fontSize / 2; + + /// The default color applied to SVG elements that inherit the color property. + /// See: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#currentcolor_keyword + final Color currentColor; + + /// The font size used when calculating em units of SVG elements. + /// See: https://www.w3.org/TR/SVG11/coords.html#Units + final double fontSize; + + /// The x-height (corpus size) of the font used when calculating ex units of SVG elements. + /// Defaults to [fontSize] / 2 if not provided. + /// See: https://www.w3.org/TR/SVG11/coords.html#Units, https://en.wikipedia.org/wiki/X-height + final double xHeight; + + /// Creates a [vg.SvgTheme] from this. + vg.SvgTheme toVgTheme() { + return vg.SvgTheme( + currentColor: vg.Color(currentColor.value), + fontSize: fontSize, + xHeight: xHeight, + ); + } + + @override + bool operator ==(Object other) { + if (other.runtimeType != runtimeType) { + return false; + } + + return other is SvgTheme && + currentColor == other.currentColor && + fontSize == other.fontSize && + xHeight == other.xHeight; + } + + @override + int get hashCode => Object.hash(currentColor, fontSize, xHeight); + + @override + String toString() => + 'SvgTheme(currentColor: $currentColor, fontSize: $fontSize, xHeight: $xHeight)'; +} + +/// A class that transforms from one color to another during SVG parsing. +/// +/// This object must be immutable so that it is suitable for use in the +/// [svg.cache]. +@immutable +abstract class ColorMapper { + /// Allows const constructors on subclasses. + const ColorMapper(); + + /// Returns a new color to use in place of [color] during SVG parsing. + /// + /// The SVG parser will call this method every time it parses a color + Color substitute( + String? id, + String elementName, + String attributeName, + Color color, + ); +} + +class _DelegateVgColorMapper extends vg.ColorMapper { + _DelegateVgColorMapper(this.colorMapper); + + final ColorMapper colorMapper; + + @override + vg.Color substitute( + String? id, String elementName, String attributeName, vg.Color color) { + final Color substituteColor = colorMapper.substitute( + id, elementName, attributeName, Color(color.value)); + return vg.Color(substituteColor.value); + } +} + +/// A [BytesLoader] that parses a SVG data in an isolate and creates a +/// vector_graphics binary representation. +@immutable +abstract class SvgLoader extends BytesLoader { + /// See class doc. + const SvgLoader({ + this.theme, + this.colorMapper, + }); + + /// The theme to determine currentColor and font sizing attributes. + final SvgTheme? theme; + + /// The [ColorMapper] used to transform colors from the SVG, if any. + final ColorMapper? colorMapper; + + /// Will be called in [compute] with the result of [prepareMessage]. + @protected + String provideSvg(T? message); + + /// Will be called + @protected + Future prepareMessage(BuildContext? context) => + SynchronousFuture(null); + + /// Returns the svg theme. + @visibleForTesting + @protected + SvgTheme getTheme(BuildContext? context) { + if (theme != null) { + return theme!; + } + if (context != null) { + final SvgTheme? defaultTheme = DefaultSvgTheme.of(context)?.theme; + if (defaultTheme != null) { + return defaultTheme; + } + } + return const SvgTheme(); + } + + Future _load(BuildContext? context) { + final SvgTheme theme = getTheme(context); + return prepareMessage(context).then((T? message) { + return compute((T? message) { + return vg + .encodeSvg( + xml: provideSvg(message), + theme: theme.toVgTheme(), + colorMapper: colorMapper == null + ? null + : _DelegateVgColorMapper(colorMapper!), + debugName: 'Svg loader', + enableClippingOptimizer: false, + enableMaskingOptimizer: false, + enableOverdrawOptimizer: false, + ) + .buffer + .asByteData(); + }, message, debugLabel: 'Load Bytes'); + }); + } + + /// This method intentionally avoids using `await` to avoid unnecessary event + /// loop turns. This is meant to to help tests in particular. + @override + Future loadBytes(BuildContext? context) { + return svg.cache.putIfAbsent(cacheKey(context), () => _load(context)); + } + + @override + SvgCacheKey cacheKey(BuildContext? context) { + final SvgTheme theme = getTheme(context); + return SvgCacheKey(keyData: this, theme: theme, colorMapper: colorMapper); + } +} + +/// A [SvgTheme] aware cache key. +/// +/// The theme must be part of the cache key to ensure that otherwise similar +/// SVGs get cached separately. +@immutable +class SvgCacheKey { + /// See [SvgCacheKey]. + const SvgCacheKey({ + required this.keyData, + required this.colorMapper, + this.theme, + }); + + /// The theme for this cached SVG. + final SvgTheme? theme; + + /// The other key data for the SVG. + /// + /// For most loaders, using the loader object itself is suitable. + final Object keyData; + + /// The color mapper for the SVG, if any. + final ColorMapper? colorMapper; + + @override + int get hashCode => Object.hash(theme, keyData, colorMapper); + + @override + bool operator ==(Object other) { + return other is SvgCacheKey && + other.theme == theme && + other.keyData == keyData && + other.colorMapper == colorMapper; + } +} + +/// A [BytesLoader] that parses an SVG string in an isolate and creates a +/// vector_graphics binary representation. +class SvgStringLoader extends SvgLoader { + /// See class doc. + const SvgStringLoader( + this._svg, { + super.theme, + super.colorMapper, + }); + + final String _svg; + + @override + String provideSvg(void message) { + return _svg; + } + + @override + int get hashCode => Object.hash(_svg, theme, colorMapper); + + @override + bool operator ==(Object other) { + return other is SvgStringLoader && + other._svg == _svg && + other.theme == theme && + other.colorMapper == colorMapper; + } +} + +/// A [BytesLoader] that decodes and parses a UTF-8 encoded SVG string from a +/// [Uint8List] in an isolate and creates a vector_graphics binary +/// representation. +class SvgBytesLoader extends SvgLoader { + /// See class doc. + const SvgBytesLoader( + this.bytes, { + super.theme, + super.colorMapper, + }); + + /// The UTF-8 encoded XML bytes. + final Uint8List bytes; + + @override + String provideSvg(void message) => utf8.decode(bytes, allowMalformed: true); + + @override + int get hashCode => Object.hash(bytes, theme, colorMapper); + + @override + bool operator ==(Object other) { + return other is SvgBytesLoader && + other.bytes == bytes && + other.theme == theme && + other.colorMapper == colorMapper; + } +} + +/// A [BytesLoader] that decodes SVG data from a file in an isolate and creates +/// a vector_graphics binary representation. +class SvgFileLoader extends SvgLoader { + /// See class doc. + const SvgFileLoader( + this.file, { + super.theme, + super.colorMapper, + }); + + /// The file containing the SVG data to decode and render. + final File file; + + @override + String provideSvg(void message) { + final Uint8List bytes = file.readAsBytesSync(); + return utf8.decode(bytes, allowMalformed: true); + } + + @override + int get hashCode => Object.hash(file, theme, colorMapper); + + @override + bool operator ==(Object other) { + return other is SvgFileLoader && + other.file == file && + other.theme == theme && + other.colorMapper == colorMapper; + } +} + +// Replaces the cache key for [AssetBytesLoader] to account for the fact that +// different widgets may select a different asset bundle based on the return +// value of `DefaultAssetBundle.of(context)`. +@immutable +class _AssetByteLoaderCacheKey { + const _AssetByteLoaderCacheKey( + this.assetName, + this.packageName, + this.assetBundle, + ); + + final String assetName; + final String? packageName; + + final AssetBundle assetBundle; + + @override + int get hashCode => Object.hash(assetName, packageName, assetBundle); + + @override + bool operator ==(Object other) { + return other is _AssetByteLoaderCacheKey && + other.assetName == assetName && + other.assetBundle == assetBundle && + other.packageName == packageName; + } + + @override + String toString() => + 'VectorGraphicAsset(${packageName != null ? '$packageName/' : ''}$assetName)'; +} + +/// A [BytesLoader] that decodes and parses an SVG asset in an isolate and +/// creates a vector_graphics binary representation. +class SvgAssetLoader extends SvgLoader { + /// See class doc. + const SvgAssetLoader( + this.assetName, { + this.packageName, + this.assetBundle, + super.theme, + super.colorMapper, + }); + + /// The name of the asset, e.g. foo.svg. + final String assetName; + + /// The package containing the asset. + final String? packageName; + + /// The asset bundle to use, or [DefaultAssetBundle] if null. + final AssetBundle? assetBundle; + + AssetBundle _resolveBundle(BuildContext? context) { + if (assetBundle != null) { + return assetBundle!; + } + if (context != null) { + return DefaultAssetBundle.of(context); + } + return rootBundle; + } + + @override + Future prepareMessage(BuildContext? context) { + return _resolveBundle(context).load( + packageName == null ? assetName : 'packages/$packageName/$assetName', + ); + } + + @override + String provideSvg(ByteData? message) => + utf8.decode(message!.buffer.asUint8List(), allowMalformed: true); + + @override + SvgCacheKey cacheKey(BuildContext? context) { + final SvgTheme theme = getTheme(context); + return SvgCacheKey( + theme: theme, + colorMapper: colorMapper, + keyData: _AssetByteLoaderCacheKey( + assetName, + packageName, + _resolveBundle(context), + ), + ); + } + + @override + int get hashCode => + Object.hash(assetName, packageName, assetBundle, theme, colorMapper); + + @override + bool operator ==(Object other) { + return other is SvgAssetLoader && + other.assetName == assetName && + other.packageName == packageName && + other.assetBundle == assetBundle && + other.theme == theme && + other.colorMapper == colorMapper; + } + + @override + String toString() => 'SvgAssetLoader($assetName)'; +} + +/// A [BytesLoader] that decodes and parses a UTF-8 encoded SVG string the +/// network in an isolate and creates a vector_graphics binary representation. +class SvgNetworkLoader extends SvgLoader { + /// See class doc. + const SvgNetworkLoader( + this.url, { + this.headers, + super.theme, + super.colorMapper, + http.Client? httpClient, + }) : _httpClient = httpClient; + + /// The [Uri] encoded resource address. + final String url; + + /// Optional HTTP headers to send as part of the request. + final Map? headers; + + final http.Client? _httpClient; + + @override + Future prepareMessage(BuildContext? context) async { + final http.Client client = _httpClient ?? http.Client(); + return (await client.get(Uri.parse(url), headers: headers)).bodyBytes; + } + + @override + String provideSvg(Uint8List? message) => + utf8.decode(message!, allowMalformed: true); + + @override + int get hashCode => Object.hash(url, headers, theme, colorMapper); + + @override + bool operator ==(Object other) { + return other is SvgNetworkLoader && + other.url == url && + other.headers == headers && + other.theme == theme && + other.colorMapper == colorMapper; + } + + @override + String toString() => 'SvgNetworkLoader($url)'; +} diff --git a/third_party/packages/flutter_svg/lib/src/utilities/_file_io.dart b/third_party/packages/flutter_svg/lib/src/utilities/_file_io.dart new file mode 100644 index 000000000000..3da0f6adbf79 --- /dev/null +++ b/third_party/packages/flutter_svg/lib/src/utilities/_file_io.dart @@ -0,0 +1 @@ +export 'dart:io' show File; diff --git a/third_party/packages/flutter_svg/lib/src/utilities/_file_none.dart b/third_party/packages/flutter_svg/lib/src/utilities/_file_none.dart new file mode 100644 index 000000000000..6f6fcf5cd636 --- /dev/null +++ b/third_party/packages/flutter_svg/lib/src/utilities/_file_none.dart @@ -0,0 +1,16 @@ +import 'dart:typed_data'; + +/// Fake File for Web +abstract class File { + /// Get the path of the file. + String get path; + + /// Reads the entire file contents as a list of bytes. + /// + /// Returns a `Future` that completes with the list of bytes that + /// is the contents of the file. + Future readAsBytes(); + + /// Reads the entire file contents as a list of bytes synchronously. + Uint8List readAsBytesSync(); +} diff --git a/third_party/packages/flutter_svg/lib/src/utilities/compute.dart b/third_party/packages/flutter_svg/lib/src/utilities/compute.dart new file mode 100644 index 000000000000..7b8eab69d0f6 --- /dev/null +++ b/third_party/packages/flutter_svg/lib/src/utilities/compute.dart @@ -0,0 +1,23 @@ +import 'dart:async'; + +import 'package:flutter/foundation.dart' as foundation; + +Future _testCompute( + foundation.ComputeCallback callback, Q message, + {String? debugLabel}) { + if (foundation.kDebugMode) { + final Type? bindingType = foundation.BindingBase.debugBindingType(); + if (bindingType.toString() == 'AutomatedTestWidgetsFlutterBinding') {} + } + final FutureOr result = callback(message); + if (result is Future) { + return result; + } + return foundation.SynchronousFuture(result); +} + +/// A compute implementation that does not spawn isolates in tests. +const foundation.ComputeImpl compute = + (foundation.kDebugMode || foundation.kIsWeb) + ? _testCompute + : foundation.compute; diff --git a/third_party/packages/flutter_svg/lib/src/utilities/file.dart b/third_party/packages/flutter_svg/lib/src/utilities/file.dart new file mode 100644 index 000000000000..e469e274b0e9 --- /dev/null +++ b/third_party/packages/flutter_svg/lib/src/utilities/file.dart @@ -0,0 +1 @@ +export '_file_io.dart' if (dart.library.html) '_file_none.dart'; diff --git a/third_party/packages/flutter_svg/lib/src/utilities/numbers.dart b/third_party/packages/flutter_svg/lib/src/utilities/numbers.dart new file mode 100644 index 000000000000..23e2b4061242 --- /dev/null +++ b/third_party/packages/flutter_svg/lib/src/utilities/numbers.dart @@ -0,0 +1,25 @@ +/// Parses a [rawDouble] `String` to a `double`. +/// +/// The [rawDouble] might include a unit (`px`, `em` or `ex`) +/// which is stripped off when parsed to a `double`. +/// +/// Passing `null` will return `null`. +double? parseDouble(String? rawDouble, {bool tryParse = false}) { + assert(tryParse != null); // ignore: unnecessary_null_comparison + if (rawDouble == null) { + return null; + } + + rawDouble = rawDouble + .replaceFirst('rem', '') + .replaceFirst('em', '') + .replaceFirst('ex', '') + .replaceFirst('px', '') + .replaceFirst('pt', '') + .trim(); + + if (tryParse) { + return double.tryParse(rawDouble); + } + return double.parse(rawDouble); +} diff --git a/third_party/packages/flutter_svg/lib/svg.dart b/third_party/packages/flutter_svg/lib/svg.dart new file mode 100644 index 000000000000..d39e47badfcb --- /dev/null +++ b/third_party/packages/flutter_svg/lib/svg.dart @@ -0,0 +1,569 @@ +import 'dart:ui' as ui; + +import 'package:flutter/foundation.dart'; +import 'package:flutter/widgets.dart'; +import 'package:http/http.dart' as http; +import 'package:vector_graphics/vector_graphics_compat.dart'; + +import 'src/cache.dart'; +import 'src/loaders.dart'; +import 'src/utilities/file.dart'; + +export 'package:vector_graphics/vector_graphics.dart' + show BytesLoader, vg, VectorGraphicUtilities, PictureInfo; + +export 'src/cache.dart'; +export 'src/default_theme.dart'; +export 'src/loaders.dart'; + +/// Instance for [Svg]'s utility methods, which can produce a [DrawableRoot] +/// or [PictureInfo] from [String] or [Uint8List]. +final Svg svg = Svg._(); + +/// A utility class for decoding SVG data to a [DrawableRoot] or a [PictureInfo]. +/// +/// These methods are used by [SvgPicture], but can also be directly used e.g. +/// to create a [DrawableRoot] you manipulate or render to your own [Canvas]. +/// Access to this class is provided by the exported [svg] member. +class Svg { + Svg._(); + + /// A global override flag for [SvgPicture.cacheColorFilter]. + /// + /// If this is null, the value in [SvgPicture.cacheColorFilter] is used. If it + /// is not null, it will override that value. + @Deprecated('This no longer does anything.') + bool? cacheColorFilterOverride; + + /// The cache instance for decoded SVGs. + final Cache cache = Cache(); +} + +// ignore: avoid_classes_with_only_static_members +/// Deprecated class, will be removed, does not do anything. +@Deprecated('This feature does not do anything anymore.') +class PictureProvider { + /// Deprecated, use [svg.cache] instead. + @Deprecated('Use svg.cache instead.') + static Cache get cache => svg.cache; +} + +/// A widget that will parse SVG data for rendering on screen. +class SvgPicture extends StatelessWidget { + /// Instantiates a widget that renders an SVG picture using the `pictureProvider`. + /// + /// Either the [width] and [height] arguments should be specified, or the + /// widget should be placed in a context that sets tight layout constraints. + /// Otherwise, the image dimensions will change as the image is loaded, which + /// will result in ugly layout changes. + /// + /// If `matchTextDirection` is set to true, the picture will be flipped + /// horizontally in [TextDirection.rtl] contexts. + /// + /// The `allowDrawingOutsideOfViewBox` parameter should be used with caution - + /// if set to true, it will not clip the canvas used internally to the view box, + /// meaning the picture may draw beyond the intended area and lead to undefined + /// behavior or additional memory overhead. + /// + /// A custom `placeholderBuilder` can be specified for cases where decoding or + /// acquiring data may take a noticeably long time, e.g. for a network picture. + /// + /// The `semanticsLabel` can be used to identify the purpose of this picture for + /// screen reading software. + /// + /// If [excludeFromSemantics] is true, then [semanticsLabel] will be ignored. + const SvgPicture( + this.bytesLoader, { + Key? key, + this.width, + this.height, + this.fit = BoxFit.contain, + this.alignment = Alignment.center, + this.matchTextDirection = false, + this.allowDrawingOutsideViewBox = false, + this.placeholderBuilder, + this.colorFilter, + this.semanticsLabel, + this.excludeFromSemantics = false, + this.clipBehavior = Clip.hardEdge, + @Deprecated( + 'No code should use this parameter. It never was implemented properly. ' + 'The SVG theme must be set on the bytesLoader.') + SvgTheme? theme, + @deprecated bool cacheColorFilter = false, + }) : super(key: key); + + /// Instantiates a widget that renders an SVG picture from an [AssetBundle]. + /// + /// The key will be derived from the `assetName`, `package`, and `bundle` + /// arguments. The `package` argument must be non-null when displaying an SVG + /// from a package and null otherwise. See the `Assets in packages` section for + /// details. + /// + /// Either the [width] and [height] arguments should be specified, or the + /// widget should be placed in a context that sets tight layout constraints. + /// Otherwise, the image dimensions will change as the image is loaded, which + /// will result in ugly layout changes. + /// + /// If `matchTextDirection` is set to true, the picture will be flipped + /// horizontally in [TextDirection.rtl] contexts. + /// + /// The `allowDrawingOutsideOfViewBox` parameter should be used with caution - + /// if set to true, it will not clip the canvas used internally to the view box, + /// meaning the picture may draw beyond the intended area and lead to undefined + /// behavior or additional memory overhead. + /// + /// A custom `placeholderBuilder` can be specified for cases where decoding or + /// acquiring data may take a noticeably long time. + /// + /// The `color` and `colorBlendMode` arguments, if specified, will be used to set a + /// [ColorFilter] on any [Paint]s created for this drawing. + /// + /// The `theme` argument, if provided, will override the default theme + /// used when parsing SVG elements. + /// + /// ## Assets in packages + /// + /// To create the widget with an asset from a package, the [package] argument + /// must be provided. For instance, suppose a package called `my_icons` has + /// `icons/heart.svg` . + /// + /// Then to display the image, use: + /// + /// ```dart + /// SvgPicture.asset('icons/heart.svg', package: 'my_icons') + /// ``` + /// + /// Assets used by the package itself should also be displayed using the + /// [package] argument as above. + /// + /// If the desired asset is specified in the `pubspec.yaml` of the package, it + /// is bundled automatically with the app. In particular, assets used by the + /// package itself must be specified in its `pubspec.yaml`. + /// + /// A package can also choose to have assets in its 'lib/' folder that are not + /// specified in its `pubspec.yaml`. In this case for those images to be + /// bundled, the app has to specify which ones to include. For instance a + /// package named `fancy_backgrounds` could have: + /// + /// ``` + /// lib/backgrounds/background1.svg + /// lib/backgrounds/background2.svg + /// lib/backgrounds/background3.svg + ///``` + /// + /// To include, say the first image, the `pubspec.yaml` of the app should + /// specify it in the assets section: + /// + /// ```yaml + /// assets: + /// - packages/fancy_backgrounds/backgrounds/background1.svg + /// ``` + /// + /// The `lib/` is implied, so it should not be included in the asset path. + /// + /// + /// See also: + /// + /// * , an introduction to assets in + /// Flutter. + /// + /// If [excludeFromSemantics] is true, then [semanticsLabel] will be ignored. + SvgPicture.asset( + String assetName, { + Key? key, + this.matchTextDirection = false, + AssetBundle? bundle, + String? package, + this.width, + this.height, + this.fit = BoxFit.contain, + this.alignment = Alignment.center, + this.allowDrawingOutsideViewBox = false, + this.placeholderBuilder, + this.semanticsLabel, + this.excludeFromSemantics = false, + this.clipBehavior = Clip.hardEdge, + SvgTheme? theme, + ui.ColorFilter? colorFilter, + @deprecated ui.Color? color, + @deprecated ui.BlendMode colorBlendMode = ui.BlendMode.srcIn, + @deprecated bool cacheColorFilter = false, + }) : bytesLoader = SvgAssetLoader( + assetName, + packageName: package, + assetBundle: bundle, + theme: theme, + ), + colorFilter = colorFilter ?? _getColorFilter(color, colorBlendMode), + super(key: key); + + /// Creates a widget that displays an SVG obtained from the network. + /// + /// The [url] argument must not be null. + /// + /// Either the [width] and [height] arguments should be specified, or the + /// widget should be placed in a context that sets tight layout constraints. + /// Otherwise, the image dimensions will change as the image is loaded, which + /// will result in ugly layout changes. + /// + /// If `matchTextDirection` is set to true, the picture will be flipped + /// horizontally in [TextDirection.rtl] contexts. + /// + /// The `allowDrawingOutsideOfViewBox` parameter should be used with caution - + /// if set to true, it will not clip the canvas used internally to the view box, + /// meaning the picture may draw beyond the intended area and lead to undefined + /// behavior or additional memory overhead. + /// + /// A custom `placeholderBuilder` can be specified for cases where decoding or + /// acquiring data may take a noticeably long time, such as high latency scenarios. + /// + /// The `color` and `colorBlendMode` arguments, if specified, will be used to set a + /// [ColorFilter] on any [Paint]s created for this drawing. + /// + /// The `theme` argument, if provided, will override the default theme + /// used when parsing SVG elements. + /// + /// All network images are cached regardless of HTTP headers. + /// + /// An optional `headers` argument can be used to send custom HTTP headers + /// with the image request. + /// + /// If [excludeFromSemantics] is true, then [semanticsLabel] will be ignored. + SvgPicture.network( + String url, { + Key? key, + Map? headers, + this.width, + this.height, + this.fit = BoxFit.contain, + this.alignment = Alignment.center, + this.matchTextDirection = false, + this.allowDrawingOutsideViewBox = false, + this.placeholderBuilder, + ui.ColorFilter? colorFilter, + @deprecated ui.Color? color, + @deprecated ui.BlendMode colorBlendMode = ui.BlendMode.srcIn, + this.semanticsLabel, + this.excludeFromSemantics = false, + this.clipBehavior = Clip.hardEdge, + @deprecated bool cacheColorFilter = false, + SvgTheme? theme, + http.Client? httpClient, + }) : bytesLoader = SvgNetworkLoader( + url, + headers: headers, + theme: theme, + httpClient: httpClient, + ), + colorFilter = colorFilter ?? _getColorFilter(color, colorBlendMode), + super(key: key); + + /// Creates a widget that displays an SVG obtained from a [File]. + /// + /// The [file] argument must not be null. + /// + /// Either the [width] and [height] arguments should be specified, or the + /// widget should be placed in a context that sets tight layout constraints. + /// Otherwise, the image dimensions will change as the image is loaded, which + /// will result in ugly layout changes. + /// + /// If `matchTextDirection` is set to true, the picture will be flipped + /// horizontally in [TextDirection.rtl] contexts. + /// + /// The `allowDrawingOutsideOfViewBox` parameter should be used with caution - + /// if set to true, it will not clip the canvas used internally to the view box, + /// meaning the picture may draw beyond the intended area and lead to undefined + /// behavior or additional memory overhead. + /// + /// A custom `placeholderBuilder` can be specified for cases where decoding or + /// acquiring data may take a noticeably long time. + /// + /// The `color` and `colorBlendMode` arguments, if specified, will be used to set a + /// [ColorFilter] on any [Paint]s created for this drawing. + /// + /// The `theme` argument, if provided, will override the default theme + /// used when parsing SVG elements. + /// + /// On Android, this may require the + /// `android.permission.READ_EXTERNAL_STORAGE` permission. + /// + /// If [excludeFromSemantics] is true, then [semanticsLabel] will be ignored. + SvgPicture.file( + File file, { + Key? key, + this.width, + this.height, + this.fit = BoxFit.contain, + this.alignment = Alignment.center, + this.matchTextDirection = false, + this.allowDrawingOutsideViewBox = false, + this.placeholderBuilder, + ui.ColorFilter? colorFilter, + @deprecated ui.Color? color, + @deprecated ui.BlendMode colorBlendMode = ui.BlendMode.srcIn, + this.semanticsLabel, + this.excludeFromSemantics = false, + this.clipBehavior = Clip.hardEdge, + SvgTheme? theme, + @deprecated bool cacheColorFilter = false, + }) : bytesLoader = SvgFileLoader(file, theme: theme), + colorFilter = colorFilter ?? _getColorFilter(color, colorBlendMode), + super(key: key); + + /// Creates a widget that displays an SVG obtained from a [Uint8List]. + /// + /// The [bytes] argument must not be null. + /// + /// Either the [width] and [height] arguments should be specified, or the + /// widget should be placed in a context that sets tight layout constraints. + /// Otherwise, the image dimensions will change as the image is loaded, which + /// will result in ugly layout changes. + /// + /// If `matchTextDirection` is set to true, the picture will be flipped + /// horizontally in [TextDirection.rtl] contexts. + /// + /// The `allowDrawingOutsideOfViewBox` parameter should be used with caution - + /// if set to true, it will not clip the canvas used internally to the view box, + /// meaning the picture may draw beyond the intended area and lead to undefined + /// behavior or additional memory overhead. + /// + /// A custom `placeholderBuilder` can be specified for cases where decoding or + /// acquiring data may take a noticeably long time. + /// + /// The `color` and `colorBlendMode` arguments, if specified, will be used to set a + /// [ColorFilter] on any [Paint]s created for this drawing. + /// + /// The `theme` argument, if provided, will override the default theme + /// used when parsing SVG elements. + /// + /// If [excludeFromSemantics] is true, then [semanticsLabel] will be ignored. + SvgPicture.memory( + Uint8List bytes, { + Key? key, + this.width, + this.height, + this.fit = BoxFit.contain, + this.alignment = Alignment.center, + this.matchTextDirection = false, + this.allowDrawingOutsideViewBox = false, + this.placeholderBuilder, + ui.ColorFilter? colorFilter, + @deprecated ui.Color? color, + @deprecated ui.BlendMode colorBlendMode = ui.BlendMode.srcIn, + this.semanticsLabel, + this.excludeFromSemantics = false, + this.clipBehavior = Clip.hardEdge, + SvgTheme? theme, + @deprecated bool cacheColorFilter = false, + }) : bytesLoader = SvgBytesLoader(bytes, theme: theme), + colorFilter = colorFilter ?? _getColorFilter(color, colorBlendMode), + super(key: key); + + /// Creates a widget that displays an SVG obtained from a [String]. + /// + /// The [string] argument must not be null. + /// + /// Either the [width] and [height] arguments should be specified, or the + /// widget should be placed in a context that sets tight layout constraints. + /// Otherwise, the image dimensions will change as the image is loaded, which + /// will result in ugly layout changes. + /// + /// If `matchTextDirection` is set to true, the picture will be flipped + /// horizontally in [TextDirection.rtl] contexts. + /// + /// The `allowDrawingOutsideOfViewBox` parameter should be used with caution - + /// if set to true, it will not clip the canvas used internally to the view box, + /// meaning the picture may draw beyond the intended area and lead to undefined + /// behavior or additional memory overhead. + /// + /// A custom `placeholderBuilder` can be specified for cases where decoding or + /// acquiring data may take a noticeably long time. + /// + /// The `color` and `colorBlendMode` arguments, if specified, will be used to set a + /// [ColorFilter] on any [Paint]s created for this drawing. + /// + /// The `theme` argument, if provided, will override the default theme + /// used when parsing SVG elements. + /// + /// If [excludeFromSemantics] is true, then [semanticsLabel] will be ignored. + SvgPicture.string( + String string, { + Key? key, + this.width, + this.height, + this.fit = BoxFit.contain, + this.alignment = Alignment.center, + this.matchTextDirection = false, + this.allowDrawingOutsideViewBox = false, + this.placeholderBuilder, + ui.ColorFilter? colorFilter, + @deprecated ui.Color? color, + @deprecated ui.BlendMode colorBlendMode = ui.BlendMode.srcIn, + this.semanticsLabel, + this.excludeFromSemantics = false, + this.clipBehavior = Clip.hardEdge, + SvgTheme? theme, + @deprecated bool cacheColorFilter = false, + }) : bytesLoader = SvgStringLoader(string, theme: theme), + colorFilter = colorFilter ?? _getColorFilter(color, colorBlendMode), + super(key: key); + + static ColorFilter? _getColorFilter( + ui.Color? color, ui.BlendMode colorBlendMode) => + color == null ? null : ui.ColorFilter.mode(color, colorBlendMode); + + /// The default placeholder for a SVG that may take time to parse or + /// retrieve, e.g. from a network location. + static WidgetBuilder defaultPlaceholderBuilder = + (BuildContext ctx) => const LimitedBox(); + + /// If specified, the width to use for the SVG. If unspecified, the SVG + /// will take the width of its parent. + final double? width; + + /// If specified, the height to use for the SVG. If unspecified, the SVG + /// will take the height of its parent. + final double? height; + + /// How to inscribe the picture into the space allocated during layout. + /// The default is [BoxFit.contain]. + final BoxFit fit; + + /// How to align the picture within its parent widget. + /// + /// The alignment aligns the given position in the picture to the given position + /// in the layout bounds. For example, an [Alignment] alignment of (-1.0, + /// -1.0) aligns the image to the top-left corner of its layout bounds, while a + /// [Alignment] alignment of (1.0, 1.0) aligns the bottom right of the + /// picture with the bottom right corner of its layout bounds. Similarly, an + /// alignment of (0.0, 1.0) aligns the bottom middle of the image with the + /// middle of the bottom edge of its layout bounds. + /// + /// If the [alignment] is [TextDirection]-dependent (i.e. if it is a + /// [AlignmentDirectional]), then a [TextDirection] must be available + /// when the picture is painted. + /// + /// Defaults to [Alignment.center]. + /// + /// See also: + /// + /// * [Alignment], a class with convenient constants typically used to + /// specify an [AlignmentGeometry]. + /// * [AlignmentDirectional], like [Alignment] for specifying alignments + /// relative to text direction. + final AlignmentGeometry alignment; + + /// The [BytesLoader] used to resolve the SVG. + final BytesLoader bytesLoader; + + /// The placeholder to use while fetching, decoding, and parsing the SVG data. + final WidgetBuilder? placeholderBuilder; + + /// If true, will horizontally flip the picture in [TextDirection.rtl] contexts. + final bool matchTextDirection; + + /// If true, will allow the SVG to be drawn outside of the clip boundary of its + /// viewBox. + final bool allowDrawingOutsideViewBox; + + /// The [Semantics.label] for this picture. + /// + /// The value indicates the purpose of the picture, and will be + /// read out by screen readers. + final String? semanticsLabel; + + /// Whether to exclude this picture from semantics. + /// + /// Useful for pictures which do not contribute meaningful information to an + /// application. + final bool excludeFromSemantics; + + /// The content will be clipped (or not) according to this option. + /// + /// See the enum [Clip] for details of all possible options and their common + /// use cases. + /// + /// Defaults to [Clip.hardEdge], and must not be null. + final Clip clipBehavior; + + /// The color filter, if any, to apply to this widget. + final ColorFilter? colorFilter; + + @override + Widget build(BuildContext context) { + return createCompatVectorGraphic( + loader: bytesLoader, + width: width, + height: height, + fit: fit, + alignment: alignment, + semanticsLabel: semanticsLabel, + excludeFromSemantics: excludeFromSemantics, + clipBehavior: clipBehavior, + colorFilter: colorFilter, + placeholderBuilder: placeholderBuilder, + clipViewbox: !allowDrawingOutsideViewBox, + matchTextDirection: matchTextDirection, + ); + } + + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + + properties + ..add(StringProperty( + 'bytesLoader', + bytesLoader.toString(), + showName: false, + )) + ..add(DoubleProperty('width', width, defaultValue: null)) + ..add(DoubleProperty('height', height, defaultValue: null)) + ..add(DiagnosticsProperty( + 'alignment', + alignment, + defaultValue: Alignment.center, + )) + ..add(DiagnosticsProperty( + 'allowDrawingOutsideViewBox', + allowDrawingOutsideViewBox, + defaultValue: false, + )) + ..add(EnumProperty( + 'clipBehavior', + clipBehavior, + defaultValue: BoxFit.contain, + )) + ..add(StringProperty( + 'colorFilter', + colorFilter.toString(), + defaultValue: null, + )) + ..add(EnumProperty( + 'fit', + fit, + defaultValue: BoxFit.contain, + )) + ..add(DiagnosticsProperty( + 'placeholderBuilder', + placeholderBuilder, + defaultValue: null, + )) + ..add(DiagnosticsProperty( + 'matchTextDirection', + matchTextDirection, + defaultValue: false, + )) + ..add(DiagnosticsProperty( + 'excludeFromSemantics', + excludeFromSemantics, + defaultValue: false, + )) + ..add(StringProperty( + 'semanticsLabel', + semanticsLabel, + defaultValue: null, + )); + } +} diff --git a/third_party/packages/flutter_svg/pubspec.yaml b/third_party/packages/flutter_svg/pubspec.yaml new file mode 100644 index 000000000000..a30078b678db --- /dev/null +++ b/third_party/packages/flutter_svg/pubspec.yaml @@ -0,0 +1,29 @@ +name: flutter_svg +description: An SVG rendering and widget library for Flutter, which allows painting and displaying Scalable Vector Graphics 1.1 files. +repository: https://github.com/dnfield/flutter_svg/tree/master/packages/flutter_svg +issue_tracker: https://github.com/dnfield/flutter_svg/issues +version: 2.0.10+1 + +dependencies: + flutter: + sdk: flutter + http: ^1.0.0 + vector_graphics: ^1.1.11 + vector_graphics_codec: ^1.1.11 + vector_graphics_compiler: ^1.1.11 + +dev_dependencies: + flutter_test: + sdk: flutter + +environment: + sdk: '>=2.19.0-0 <4.0.0' + flutter: ">=3.7.0-0" + +# dependency_overrides: +# vector_graphics: +# path: ../vector_graphics/packages/vector_graphics +# vector_graphics_codec: +# path: ../vector_graphics/packages/vector_graphics_codec +# vector_graphics_compiler: +# path: ../vector_graphics/packages/vector_graphics_compiler diff --git a/third_party/packages/flutter_svg/test/cache_test.dart b/third_party/packages/flutter_svg/test/cache_test.dart new file mode 100644 index 000000000000..1a049107c8b5 --- /dev/null +++ b/third_party/packages/flutter_svg/test/cache_test.dart @@ -0,0 +1,136 @@ +import 'dart:async'; + +import 'package:flutter/foundation.dart'; +import 'package:flutter_svg/src/cache.dart'; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + test('Sanity', () async { + final Cache cache = Cache(); + expect(cache.maximumSize, 100); + expect(cache.count, 0); + final Completer completer = Completer(); + final Future put = cache.putIfAbsent(1, () => completer.future); + expect(put, completer.future); + expect(cache.count, 0); + completer.complete(ByteData(1)); + expect(cache.count, 0); + await null; + expect(cache.count, 1); + cache.clear(); + expect(cache.count, 0); + // Not bothering to check result since it's from the same completer. + cache.putIfAbsent(1, () => completer.future); + expect(cache.count, 0); + await null; + expect(cache.count, 1); + expect(cache.evict(1), true); + expect(cache.count, 0); + expect(cache.evict(1), false); + }); + + test('LRU', () async { + final Cache cache = Cache(); + cache.maximumSize = 2; + final Completer completerA = Completer() + ..complete(ByteData(1)); + final Completer completerB = Completer() + ..complete(ByteData(2)); + final Completer completerC = Completer() + ..complete(ByteData(3)); + + expect(cache.count, 0); + + cache.putIfAbsent(1, () => completerA.future); + await null; + expect(cache.count, 1); + + cache.putIfAbsent(2, () => completerB.future); + await null; + expect(cache.count, 2); + + cache.putIfAbsent(3, () => completerC.future); + await null; + expect(cache.count, 2); + + expect(cache.evict(1), false); + expect(cache.evict(2), true); + expect(cache.evict(3), true); + + cache.putIfAbsent(1, () => completerA.future); + await null; + expect(cache.count, 1); + + cache.putIfAbsent(2, () => completerB.future); + await null; + expect(cache.count, 2); + + cache.putIfAbsent(1, () => completerA.future); + await null; + expect(cache.count, 2); + + cache.putIfAbsent(3, () => completerC.future); + await null; + expect(cache.count, 2); + + expect(cache.evict(1), true); + expect(cache.evict(2), false); + expect(cache.evict(3), true); + }); + + test('Adding beyond max with synchronous futures', () async { + final Cache cache = Cache(); + cache.maximumSize = 2; + final Future completerA = + SynchronousFuture(ByteData(1)); + final Future completerB = + SynchronousFuture(ByteData(2)); + final Future completerC = + SynchronousFuture(ByteData(3)); + + expect(cache.count, 0); + + cache.putIfAbsent(1, () => completerA); + expect(cache.count, 1); + + cache.putIfAbsent(2, () => completerB); + expect(cache.count, 2); + + cache.putIfAbsent(2, () => completerB); + expect(cache.count, 2); + + cache.putIfAbsent(3, () => completerC); + expect(cache.count, 2); + + cache.putIfAbsent(2, () => completerB); + expect(cache.count, 2); + }); + + test('Futures completing late/together', () async { + final Cache cache = Cache(); + cache.maximumSize = 2; + final Completer completerA = Completer(); + final Completer completerB = Completer(); + final Completer completerC = Completer(); + + expect(cache.count, 0); + + cache.putIfAbsent(1, () => completerA.future); + cache.putIfAbsent(2, () => completerB.future); + completerA.complete(ByteData(1)); + completerB.complete(ByteData(1)); + + expect(cache.count, 0); + await null; + expect(cache.count, 2); + + cache.putIfAbsent(3, () => completerC.future); + expect(cache.count, 2); + + completerC.complete(ByteData(1)); + expect(cache.count, 2); + + await null; + expect(cache.count, 2); + }); +} diff --git a/third_party/packages/flutter_svg/test/default_theme_test.dart b/third_party/packages/flutter_svg/test/default_theme_test.dart new file mode 100644 index 000000000000..1078ae498036 --- /dev/null +++ b/third_party/packages/flutter_svg/test/default_theme_test.dart @@ -0,0 +1,195 @@ +import 'package:flutter/widgets.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + group('DefaultSvgTheme', () { + testWidgets('changes propagate to SvgPicture', (WidgetTester tester) async { + const SvgTheme svgTheme = SvgTheme( + currentColor: Color(0xFF733821), + fontSize: 14.0, + xHeight: 6.0, + ); + + final SvgPicture svgPictureWidget = SvgPicture.string(''' + + +'''); + + await tester.pumpWidget(DefaultSvgTheme( + theme: svgTheme, + child: svgPictureWidget, + )); + + SvgPicture svgPicture = tester.firstWidget(find.byType(SvgPicture)); + expect(svgPicture, isNotNull); + BuildContext context = tester.element(find.byType(SvgPicture)); + expect( + (svgPicture.bytesLoader as SvgStringLoader).getTheme(context), + equals(svgTheme), + ); + + const SvgTheme anotherSvgTheme = SvgTheme( + currentColor: Color(0xFF05290E), + fontSize: 12.0, + xHeight: 7.0, + ); + + await tester.pumpWidget(DefaultSvgTheme( + theme: anotherSvgTheme, + child: svgPictureWidget, + )); + context = tester.element(find.byType(SvgPicture)); + + svgPicture = tester.firstWidget(find.byType(SvgPicture)); + expect(svgPicture, isNotNull); + expect( + (svgPicture.bytesLoader as SvgStringLoader).getTheme(context), + equals(anotherSvgTheme), + ); + }); + + testWidgets( + 'currentColor from the widget\'s theme takes precedence over ' + 'the theme from DefaultSvgTheme', (WidgetTester tester) async { + const SvgTheme svgTheme = SvgTheme( + currentColor: Color(0xFF733821), + fontSize: 14.0, + ); + + final SvgPicture svgPictureWidget = SvgPicture.string( + ''' + + +''', + theme: const SvgTheme( + currentColor: Color(0xFF05290E), + fontSize: 14.0, + ), + ); + + await tester.pumpWidget(DefaultSvgTheme( + theme: svgTheme, + child: svgPictureWidget, + )); + final BuildContext context = tester.element(find.byType(SvgPicture)); + final SvgPicture svgPicture = tester.firstWidget(find.byType(SvgPicture)); + expect(svgPicture, isNotNull); + expect( + (svgPicture.bytesLoader as SvgStringLoader) + .getTheme(context) + .currentColor, + equals(const Color(0xFF05290E)), + ); + }); + + testWidgets( + 'fontSize from the widget\'s theme takes precedence over ' + 'the theme from DefaultSvgTheme', (WidgetTester tester) async { + const SvgTheme svgTheme = SvgTheme( + fontSize: 14.0, + ); + + final SvgPicture svgPictureWidget = SvgPicture.string( + ''' + + +''', + theme: const SvgTheme( + fontSize: 12.0, + ), + ); + + await tester.pumpWidget(DefaultSvgTheme( + theme: svgTheme, + child: svgPictureWidget, + )); + + final SvgPicture svgPicture = tester.firstWidget(find.byType(SvgPicture)); + final BuildContext context = tester.element(find.byType(SvgPicture)); + + expect(svgPicture, isNotNull); + expect( + (svgPicture.bytesLoader as SvgStringLoader).getTheme(context).fontSize, + equals(12.0), + ); + }); + + testWidgets( + 'fontSize defaults to 14 ' + 'if no widget\'s theme, DefaultSvgTheme or DefaultTextStyle is provided', + (WidgetTester tester) async { + final SvgPicture svgPictureWidget = SvgPicture.string( + ''' + + +''', + ); + + await tester.pumpWidget(svgPictureWidget); + + final SvgPicture svgPicture = tester.firstWidget(find.byType(SvgPicture)); + final BuildContext context = tester.element(find.byType(SvgPicture)); + expect(svgPicture, isNotNull); + expect( + (svgPicture.bytesLoader as SvgStringLoader).getTheme(context).fontSize, + equals(14.0), + ); + }); + + testWidgets( + 'xHeight from the widget\'s theme takes precedence over ' + 'the theme from DefaultSvgTheme', (WidgetTester tester) async { + const SvgTheme svgTheme = SvgTheme( + fontSize: 14.0, + xHeight: 6.5, + ); + + final SvgPicture svgPictureWidget = SvgPicture.string( + ''' + + +''', + theme: const SvgTheme( + fontSize: 12.0, + xHeight: 7.0, + ), + ); + + await tester.pumpWidget(DefaultSvgTheme( + theme: svgTheme, + child: svgPictureWidget, + )); + + final SvgPicture svgPicture = tester.firstWidget(find.byType(SvgPicture)); + final BuildContext context = tester.element(find.byType(SvgPicture)); + expect(svgPicture, isNotNull); + expect( + (svgPicture.bytesLoader as SvgStringLoader).getTheme(context).xHeight, + equals(7.0), + ); + }); + + testWidgets( + 'xHeight defaults to the font size divided by 2 (7.0) ' + 'if no widget\'s theme or DefaultSvgTheme is provided', + (WidgetTester tester) async { + final SvgPicture svgPictureWidget = SvgPicture.string( + ''' + + +''', + ); + + await tester.pumpWidget(svgPictureWidget); + + final SvgPicture svgPicture = tester.firstWidget(find.byType(SvgPicture)); + final BuildContext context = tester.element(find.byType(SvgPicture)); + expect(svgPicture, isNotNull); + expect( + (svgPicture.bytesLoader as SvgStringLoader).getTheme(context).xHeight, + equals(7.0), + ); + }); + }); +} diff --git a/third_party/packages/flutter_svg/test/golden_widget/circle.em_ex.png b/third_party/packages/flutter_svg/test/golden_widget/circle.em_ex.png new file mode 100644 index 000000000000..9c72bdcbea28 Binary files /dev/null and b/third_party/packages/flutter_svg/test/golden_widget/circle.em_ex.png differ diff --git a/third_party/packages/flutter_svg/test/golden_widget/circle.em_ex2.png b/third_party/packages/flutter_svg/test/golden_widget/circle.em_ex2.png new file mode 100644 index 000000000000..9c72bdcbea28 Binary files /dev/null and b/third_party/packages/flutter_svg/test/golden_widget/circle.em_ex2.png differ diff --git a/third_party/packages/flutter_svg/test/golden_widget/columns_and_rows.png b/third_party/packages/flutter_svg/test/golden_widget/columns_and_rows.png new file mode 100644 index 000000000000..105dbecb5468 Binary files /dev/null and b/third_party/packages/flutter_svg/test/golden_widget/columns_and_rows.png differ diff --git a/third_party/packages/flutter_svg/test/golden_widget/ellipse.em_ex.png b/third_party/packages/flutter_svg/test/golden_widget/ellipse.em_ex.png new file mode 100644 index 000000000000..3244264aae23 Binary files /dev/null and b/third_party/packages/flutter_svg/test/golden_widget/ellipse.em_ex.png differ diff --git a/third_party/packages/flutter_svg/test/golden_widget/ellipse.em_ex2.png b/third_party/packages/flutter_svg/test/golden_widget/ellipse.em_ex2.png new file mode 100644 index 000000000000..3244264aae23 Binary files /dev/null and b/third_party/packages/flutter_svg/test/golden_widget/ellipse.em_ex2.png differ diff --git a/third_party/packages/flutter_svg/test/golden_widget/flutter_logo.asset.png b/third_party/packages/flutter_svg/test/golden_widget/flutter_logo.asset.png new file mode 100644 index 000000000000..c73024a3e846 Binary files /dev/null and b/third_party/packages/flutter_svg/test/golden_widget/flutter_logo.asset.png differ diff --git a/third_party/packages/flutter_svg/test/golden_widget/flutter_logo.memory.png b/third_party/packages/flutter_svg/test/golden_widget/flutter_logo.memory.png new file mode 100644 index 000000000000..c73024a3e846 Binary files /dev/null and b/third_party/packages/flutter_svg/test/golden_widget/flutter_logo.memory.png differ diff --git a/third_party/packages/flutter_svg/test/golden_widget/flutter_logo.natural.png b/third_party/packages/flutter_svg/test/golden_widget/flutter_logo.natural.png new file mode 100644 index 000000000000..510026df7d61 Binary files /dev/null and b/third_party/packages/flutter_svg/test/golden_widget/flutter_logo.natural.png differ diff --git a/third_party/packages/flutter_svg/test/golden_widget/flutter_logo.network.png b/third_party/packages/flutter_svg/test/golden_widget/flutter_logo.network.png new file mode 100644 index 000000000000..c73024a3e846 Binary files /dev/null and b/third_party/packages/flutter_svg/test/golden_widget/flutter_logo.network.png differ diff --git a/third_party/packages/flutter_svg/test/golden_widget/flutter_logo.string.color_filter.blendmode_color.png b/third_party/packages/flutter_svg/test/golden_widget/flutter_logo.string.color_filter.blendmode_color.png new file mode 100644 index 000000000000..d8219b1ed22c Binary files /dev/null and b/third_party/packages/flutter_svg/test/golden_widget/flutter_logo.string.color_filter.blendmode_color.png differ diff --git a/third_party/packages/flutter_svg/test/golden_widget/flutter_logo.string.color_filter.png b/third_party/packages/flutter_svg/test/golden_widget/flutter_logo.string.color_filter.png new file mode 100644 index 000000000000..3138a2bce82d Binary files /dev/null and b/third_party/packages/flutter_svg/test/golden_widget/flutter_logo.string.color_filter.png differ diff --git a/third_party/packages/flutter_svg/test/golden_widget/flutter_logo.string.ltr.png b/third_party/packages/flutter_svg/test/golden_widget/flutter_logo.string.ltr.png new file mode 100644 index 000000000000..13f1aa453c9e Binary files /dev/null and b/third_party/packages/flutter_svg/test/golden_widget/flutter_logo.string.ltr.png differ diff --git a/third_party/packages/flutter_svg/test/golden_widget/flutter_logo.string.png b/third_party/packages/flutter_svg/test/golden_widget/flutter_logo.string.png new file mode 100644 index 000000000000..c73024a3e846 Binary files /dev/null and b/third_party/packages/flutter_svg/test/golden_widget/flutter_logo.string.png differ diff --git a/third_party/packages/flutter_svg/test/golden_widget/flutter_logo.string.rtl.png b/third_party/packages/flutter_svg/test/golden_widget/flutter_logo.string.rtl.png new file mode 100644 index 000000000000..626ffb7fd585 Binary files /dev/null and b/third_party/packages/flutter_svg/test/golden_widget/flutter_logo.string.rtl.png differ diff --git a/third_party/packages/flutter_svg/test/golden_widget/image_blue.png b/third_party/packages/flutter_svg/test/golden_widget/image_blue.png new file mode 100644 index 000000000000..1561f73cf184 Binary files /dev/null and b/third_party/packages/flutter_svg/test/golden_widget/image_blue.png differ diff --git a/third_party/packages/flutter_svg/test/golden_widget/image_red.png b/third_party/packages/flutter_svg/test/golden_widget/image_red.png new file mode 100644 index 000000000000..83e239b7a8ac Binary files /dev/null and b/third_party/packages/flutter_svg/test/golden_widget/image_red.png differ diff --git a/third_party/packages/flutter_svg/test/golden_widget/line.em_ex.png b/third_party/packages/flutter_svg/test/golden_widget/line.em_ex.png new file mode 100644 index 000000000000..38147f6bcf70 Binary files /dev/null and b/third_party/packages/flutter_svg/test/golden_widget/line.em_ex.png differ diff --git a/third_party/packages/flutter_svg/test/golden_widget/line.em_ex2.png b/third_party/packages/flutter_svg/test/golden_widget/line.em_ex2.png new file mode 100644 index 000000000000..38147f6bcf70 Binary files /dev/null and b/third_party/packages/flutter_svg/test/golden_widget/line.em_ex2.png differ diff --git a/third_party/packages/flutter_svg/test/golden_widget/rect.em_ex.png b/third_party/packages/flutter_svg/test/golden_widget/rect.em_ex.png new file mode 100644 index 000000000000..03519b9cd0df Binary files /dev/null and b/third_party/packages/flutter_svg/test/golden_widget/rect.em_ex.png differ diff --git a/third_party/packages/flutter_svg/test/golden_widget/rect.em_ex2.png b/third_party/packages/flutter_svg/test/golden_widget/rect.em_ex2.png new file mode 100644 index 000000000000..03519b9cd0df Binary files /dev/null and b/third_party/packages/flutter_svg/test/golden_widget/rect.em_ex2.png differ diff --git a/third_party/packages/flutter_svg/test/golden_widget/stick_figure.withclipping.png b/third_party/packages/flutter_svg/test/golden_widget/stick_figure.withclipping.png new file mode 100644 index 000000000000..e6039db89e74 Binary files /dev/null and b/third_party/packages/flutter_svg/test/golden_widget/stick_figure.withclipping.png differ diff --git a/third_party/packages/flutter_svg/test/golden_widget/text_color_filter.png b/third_party/packages/flutter_svg/test/golden_widget/text_color_filter.png new file mode 100644 index 000000000000..f7f4360c7c53 Binary files /dev/null and b/third_party/packages/flutter_svg/test/golden_widget/text_color_filter.png differ diff --git a/third_party/packages/flutter_svg/test/golden_widget/two_of_same.png b/third_party/packages/flutter_svg/test/golden_widget/two_of_same.png new file mode 100644 index 000000000000..e2d6c13fdf38 Binary files /dev/null and b/third_party/packages/flutter_svg/test/golden_widget/two_of_same.png differ diff --git a/third_party/packages/flutter_svg/test/loaders_test.dart b/third_party/packages/flutter_svg/test/loaders_test.dart new file mode 100644 index 000000000000..591b3b01e708 --- /dev/null +++ b/third_party/packages/flutter_svg/test/loaders_test.dart @@ -0,0 +1,98 @@ +import 'package:flutter/services.dart'; +import 'package:flutter/widgets.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + setUp(() { + svg.cache.clear(); + svg.cache.maximumSize = 100; + }); + + test('ColorMapper updates the cache', () async { + const TestLoader loaderA = TestLoader(); + const TestLoader loaderB = TestLoader(colorMapper: _TestColorMapper()); + final ByteData bytesA = await loaderA.loadBytes(null); + final ByteData bytesB = await loaderB.loadBytes(null); + expect(identical(bytesA, bytesB), false); + expect(svg.cache.count, 2); + }); + + test('SvgTheme updates the cache', () async { + const TestLoader loaderA = + TestLoader(theme: SvgTheme(currentColor: Color(0xFFABCDEF))); + const TestLoader loaderB = + TestLoader(theme: SvgTheme(currentColor: Color(0xFFFEDCBA))); + final ByteData bytesA = await loaderA.loadBytes(null); + final ByteData bytesB = await loaderB.loadBytes(null); + expect(identical(bytesA, bytesB), false); + expect(svg.cache.count, 2); + }); + + test('Uses the cache', () async { + const TestLoader loader = TestLoader(); + final ByteData bytes = await loader.loadBytes(null); + final ByteData bytes2 = await loader.loadBytes(null); + expect(identical(bytes, bytes2), true); + expect(svg.cache.count, 1); + }); + + test('Empty cache', () async { + svg.cache.maximumSize = 0; + const TestLoader loader = TestLoader(); + final ByteData bytes = await loader.loadBytes(null); + final ByteData bytes2 = await loader.loadBytes(null); + expect(identical(bytes, bytes2), false); + svg.cache.maximumSize = 100; + }); + + test('AssetLoader respects packages', () async { + final TestBundle bundle = TestBundle({ + 'foo': Uint8List(0).buffer.asByteData(), + 'packages/packageName/foo': Uint8List(1).buffer.asByteData(), + }); + final SvgAssetLoader loader = SvgAssetLoader('foo', assetBundle: bundle); + final SvgAssetLoader packageLoader = + SvgAssetLoader('foo', assetBundle: bundle, packageName: 'packageName'); + expect((await loader.prepareMessage(null))!.lengthInBytes, 0); + expect((await packageLoader.prepareMessage(null))!.lengthInBytes, 1); + }); +} + +class TestBundle extends Fake implements AssetBundle { + TestBundle(this.map); + + final Map map; + + @override + Future load(String key) async { + return map[key]!; + } +} + +class TestLoader extends SvgLoader { + const TestLoader({this.keyName = 'A', super.theme, super.colorMapper}); + + final String keyName; + + @override + String provideSvg(void message) { + return ''; + } + + @override + SvgCacheKey cacheKey(BuildContext? context) { + return SvgCacheKey( + theme: theme, colorMapper: colorMapper, keyData: keyName); + } +} + +class _TestColorMapper extends ColorMapper { + const _TestColorMapper(); + + @override + Color substitute( + String? id, String elementName, String attributeName, Color color) { + return color; + } +} diff --git a/third_party/packages/flutter_svg/test/no_width_height_test.dart b/third_party/packages/flutter_svg/test/no_width_height_test.dart new file mode 100644 index 000000000000..5c0955eb870f --- /dev/null +++ b/third_party/packages/flutter_svg/test/no_width_height_test.dart @@ -0,0 +1,107 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; + +import 'package:flutter_test/flutter_test.dart'; + +void main() { + testWidgets('Spacing without width or height', (WidgetTester tester) async { + await tester.pumpWidget( + const Directionality( + textDirection: TextDirection.ltr, + child: RepaintBoundary( + child: ColumnsAndRows(), + ), + ), + ); + await tester.pumpAndSettle(); + + await expectLater( + find.byType(RepaintBoundary), + matchesGoldenFile('golden_widget/columns_and_rows.png'), + skip: 'This golden needs updating', + ); + }, skip: !isLinux); +} + +class ColumnsAndRows extends StatelessWidget { + const ColumnsAndRows({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return const Column( + children: [ + Row(children: [ + ImageWithText(), + ]), + Row( + children: [ + ImageWithText(), + ImageWithText(), + ], + ), + Row( + children: [ + ImageWithText(), + ImageWithText(), + ImageWithText(), + ImageWithText(), + ], + ), + Row( + children: [ + ImageWithText(), + ImageWithText(), + ImageWithText(), + ImageWithText(), + ImageWithText(), + ImageWithText(), + ], + ), + Row( + children: [ + ImageWithText(), + ImageWithText(), + ImageWithText(), + ImageWithText(), + ImageWithText(), + ImageWithText(), + ImageWithText(), + ImageWithText(), + ], + ), + ], + ); + } +} + +class ImageWithText extends StatelessWidget { + const ImageWithText({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + final Widget image = SvgPicture.string(circleSvg); + final Widget imageContainer = Container( + child: image, + color: Colors.amber, + ); + const Widget text = Text('Hello'); + final Widget column = Column( + children: [ + imageContainer, + text, + ], + ); + return Expanded( + child: column, + ); + } +} + +const String circleSvg = ''' + + + + + + +'''; diff --git a/third_party/packages/flutter_svg/test/widget_svg_test.dart b/third_party/packages/flutter_svg/test/widget_svg_test.dart new file mode 100644 index 000000000000..49dfe8ed1064 --- /dev/null +++ b/third_party/packages/flutter_svg/test/widget_svg_test.dart @@ -0,0 +1,850 @@ +import 'dart:convert'; + +import 'package:flutter/foundation.dart'; +import 'package:flutter/widgets.dart'; +import 'package:flutter_svg/flutter_svg.dart'; + +import 'package:flutter_test/flutter_test.dart'; +import 'package:http/http.dart' as http; + +class _TolerantComparator extends LocalFileComparator { + _TolerantComparator(Uri testFile) : super(testFile); + + @override + Future compare(Uint8List imageBytes, Uri golden) async { + final ComparisonResult result = await GoldenFileComparator.compareLists( + imageBytes, + await getGoldenBytes(golden), + ); + if (!result.passed) { + final String error = await generateFailureOutput(result, golden, basedir); + if (result.diffPercent >= .06) { + throw FlutterError(error); + } else { + print( + 'Warning - golden differed less than .06% (${result.diffPercent}%), ' + 'ignoring failure but producing output'); + print(error); + } + } + return true; + } +} + +Future _checkWidgetAndGolden(Key key, String filename) async { + final Finder widgetFinder = find.byKey(key); + expect(widgetFinder, findsOneWidget); + await expectLater(widgetFinder, matchesGoldenFile('golden_widget/$filename')); +} + +void main() { + final MediaQueryData mediaQueryData = + MediaQueryData.fromView(PlatformDispatcher.instance.implicitView!); + + setUpAll(() { + final LocalFileComparator oldComparator = + goldenFileComparator as LocalFileComparator; + final _TolerantComparator newComparator = _TolerantComparator( + Uri.parse(oldComparator.basedir.toString() + 'test')); + expect(oldComparator.basedir, newComparator.basedir); + goldenFileComparator = newComparator; + }); + + testWidgets( + 'SvgPicture does not use a color filtering widget when no color specified', + (WidgetTester tester) async { + await tester.pumpWidget( + SvgPicture.string( + svgStr, + width: 100.0, + height: 100.0, + ), + ); + await tester.pumpAndSettle(); + + expect(find.byType(ColorFiltered), findsNothing); + }); + + testWidgets('SvgPicture can work with a FittedBox', + (WidgetTester tester) async { + final GlobalKey key = GlobalKey(); + await tester.pumpWidget( + MediaQuery( + data: const MediaQueryData(size: Size(100, 100)), + child: Row( + key: key, + textDirection: TextDirection.ltr, + children: [ + Flexible( + child: FittedBox( + fit: BoxFit.fitWidth, + child: SvgPicture.string( + svgStr, + width: 20.0, + height: 14.0, + ), + ), + ), + ], + ), + ), + ); + await tester.pumpAndSettle(); + final Finder widgetFinder = find.byKey(key); + expect(widgetFinder, findsOneWidget); + }); + + testWidgets('SvgPicture.string', (WidgetTester tester) async { + final GlobalKey key = GlobalKey(); + await tester.pumpWidget( + MediaQuery( + data: mediaQueryData, + child: RepaintBoundary( + key: key, + child: SvgPicture.string( + svgStr, + width: 100.0, + height: 100.0, + ), + ), + ), + ); + + await tester.pumpAndSettle(); + await _checkWidgetAndGolden(key, 'flutter_logo.string.png'); + }); + + testWidgets('SvgPicture natural size', (WidgetTester tester) async { + final GlobalKey key = GlobalKey(); + await tester.pumpWidget( + MediaQuery( + data: mediaQueryData, + child: Center( + key: key, + child: SvgPicture.string( + svgStr, + ), + ), + ), + ); + + await tester.pumpAndSettle(); + await _checkWidgetAndGolden(key, 'flutter_logo.natural.png'); + }); + + testWidgets('SvgPicture clipped', (WidgetTester tester) async { + final GlobalKey key = GlobalKey(); + await tester.pumpWidget( + MediaQuery( + data: mediaQueryData, + child: Center( + key: key, + child: SvgPicture.string( + stickFigureSvgStr, + ), + ), + ), + ); + + await tester.pumpAndSettle(); + await _checkWidgetAndGolden(key, 'stick_figure.withclipping.png'); + }); + + testWidgets('SvgPicture.string ltr', (WidgetTester tester) async { + final GlobalKey key = GlobalKey(); + await tester.pumpWidget( + MediaQuery( + data: mediaQueryData, + child: RepaintBoundary( + key: key, + child: Directionality( + textDirection: TextDirection.ltr, + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Expanded( + child: Container( + color: const Color(0xFF0D47A1), + height: 100.0, + ), + ), + SvgPicture.string( + svgStr, + matchTextDirection: true, + height: 100.0, + width: 100.0, + ), + Expanded( + child: Container( + color: const Color(0xFF42A5F5), + height: 100.0, + ), + ), + ], + ), + ), + ), + ), + ); + + await tester.pumpAndSettle(); + await _checkWidgetAndGolden(key, 'flutter_logo.string.ltr.png'); + }); + + testWidgets('SvgPicture.string rtl', (WidgetTester tester) async { + final GlobalKey key = GlobalKey(); + await tester.pumpWidget( + MediaQuery( + data: mediaQueryData, + child: RepaintBoundary( + key: key, + child: Directionality( + textDirection: TextDirection.rtl, + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Expanded( + child: Container( + color: const Color(0xFF0D47A1), + height: 100.0, + ), + ), + SvgPicture.string( + svgStr, + matchTextDirection: true, + height: 100.0, + width: 100.0, + ), + Expanded( + child: Container( + color: const Color(0xFF42A5F5), + height: 100.0, + ), + ), + ], + ), + ), + ), + ), + ); + + await tester.pumpAndSettle(); + await _checkWidgetAndGolden(key, 'flutter_logo.string.rtl.png'); + }); + + testWidgets('SvgPicture.memory', (WidgetTester tester) async { + final GlobalKey key = GlobalKey(); + await tester.pumpWidget( + MediaQuery( + data: mediaQueryData, + child: RepaintBoundary( + key: key, + child: SvgPicture.memory( + svgBytes, + ), + ), + ), + ); + await tester.pumpAndSettle(); + + await _checkWidgetAndGolden(key, 'flutter_logo.memory.png'); + }); + + testWidgets('SvgPicture.asset', (WidgetTester tester) async { + final FakeAssetBundle fakeAsset = FakeAssetBundle(); + final GlobalKey key = GlobalKey(); + await tester.pumpWidget( + MediaQuery( + data: mediaQueryData, + child: RepaintBoundary( + key: key, + child: SvgPicture.asset( + 'test.svg', + bundle: fakeAsset, + ), + ), + ), + ); + await tester.pumpAndSettle(); + await _checkWidgetAndGolden(key, 'flutter_logo.asset.png'); + }); + + testWidgets('SvgPicture.asset DefaultAssetBundle', + (WidgetTester tester) async { + final FakeAssetBundle fakeAsset = FakeAssetBundle(); + final GlobalKey key = GlobalKey(); + await tester.pumpWidget( + Directionality( + textDirection: TextDirection.ltr, + child: MediaQuery( + data: mediaQueryData, + child: DefaultAssetBundle( + bundle: fakeAsset, + child: RepaintBoundary( + key: key, + child: SvgPicture.asset( + 'test.svg', + semanticsLabel: 'Test SVG', + ), + ), + ), + ), + ), + ); + await tester.pumpAndSettle(); + await _checkWidgetAndGolden(key, 'flutter_logo.asset.png'); + }); + + testWidgets('SvgPicture.network', (WidgetTester tester) async { + final GlobalKey key = GlobalKey(); + await tester.pumpWidget( + MediaQuery( + data: mediaQueryData, + child: RepaintBoundary( + key: key, + child: SvgPicture.network( + 'test.svg', + httpClient: FakeHttpClient(), + ), + ), + ), + ); + await tester.pumpAndSettle(); + await _checkWidgetAndGolden(key, 'flutter_logo.network.png'); + }); + + testWidgets('SvgPicture.network with headers', (WidgetTester tester) async { + final GlobalKey key = GlobalKey(); + final FakeHttpClient client = FakeHttpClient(); + await tester.pumpWidget( + MediaQuery( + data: mediaQueryData, + child: RepaintBoundary( + key: key, + child: SvgPicture.network( + 'test.svg', + headers: const {'a': 'b'}, + httpClient: client, + ), + ), + ), + ); + await tester.pumpAndSettle(); + expect(client.headers['a'], 'b'); + }); + + testWidgets('SvgPicture can be created without a MediaQuery', + (WidgetTester tester) async { + final GlobalKey key = GlobalKey(); + await tester.pumpWidget( + RepaintBoundary( + key: key, + child: SvgPicture.string( + svgStr, + width: 100.0, + height: 100.0, + ), + ), + ); + + await tester.pumpAndSettle(); + await _checkWidgetAndGolden(key, 'flutter_logo.string.png'); + }); + + testWidgets('SvgPicture.network HTTP exception', (WidgetTester tester) async { + expect(() async { + final http.Client client = FakeHttpClient(400); + await tester.pumpWidget( + MediaQuery( + data: mediaQueryData, + child: SvgPicture.network( + 'notFound.svg', + httpClient: client, + ), + ), + ); + }, isNotNull); + }); + + testWidgets('SvgPicture semantics', (WidgetTester tester) async { + await tester.pumpWidget( + Directionality( + textDirection: TextDirection.ltr, + child: RepaintBoundary( + child: SvgPicture.string( + svgStr, + semanticsLabel: 'Flutter Logo', + width: 100.0, + height: 100.0, + ), + ), + ), + ); + + await tester.pumpAndSettle(); + + expect(find.byType(Semantics), findsOneWidget); + expect(find.bySemanticsLabel('Flutter Logo'), findsOneWidget); + }, semanticsEnabled: true); + + testWidgets('SvgPicture semantics - no label', (WidgetTester tester) async { + await tester.pumpWidget( + Directionality( + textDirection: TextDirection.ltr, + child: RepaintBoundary( + child: SvgPicture.string( + svgStr, + width: 100.0, + height: 100.0, + ), + ), + ), + ); + + await tester.pumpAndSettle(); + + expect(find.byType(Semantics), findsOneWidget); + }, semanticsEnabled: true); + + testWidgets('SvgPicture semantics - exclude', (WidgetTester tester) async { + await tester.pumpWidget( + Directionality( + textDirection: TextDirection.ltr, + child: RepaintBoundary( + child: SvgPicture.string( + svgStr, + excludeFromSemantics: true, + width: 100.0, + height: 100.0, + ), + ), + ), + ); + + await tester.pumpAndSettle(); + + expect(find.byType(Semantics), findsNothing); + }, semanticsEnabled: true); + + testWidgets('SvgPicture colorFilter - flutter logo', + (WidgetTester tester) async { + final GlobalKey key = GlobalKey(); + await tester.pumpWidget( + RepaintBoundary( + key: key, + child: SvgPicture.string( + svgStr, + width: 100.0, + height: 100.0, + colorFilter: const ColorFilter.mode( + Color(0xFF990000), + BlendMode.srcIn, + ), + ), + ), + ); + + await tester.pumpAndSettle(); + await _checkWidgetAndGolden(key, 'flutter_logo.string.color_filter.png'); + }); + + testWidgets('SvgPicture colorFilter with text', (WidgetTester tester) async { + const String svgData = + ''' + + + + + + 2 + + + 1 + + +'''; + final GlobalKey key = GlobalKey(); + await tester.pumpWidget( + RepaintBoundary( + key: key, + child: SvgPicture.string( + svgData, + width: 100.0, + height: 100.0, + colorFilter: const ColorFilter.mode( + Color(0xFF990000), + BlendMode.srcIn, + ), + ), + ), + ); + + await tester.pumpAndSettle(); + await _checkWidgetAndGolden(key, 'text_color_filter.png'); + }); + + testWidgets('Can take AlignmentDirectional', (WidgetTester tester) async { + await tester.pumpWidget(Directionality( + textDirection: TextDirection.ltr, + child: SvgPicture.string( + svgStr, + alignment: AlignmentDirectional.bottomEnd, + ), + )); + expect(find.byType(SvgPicture), findsOneWidget); + }); + + group('SvgPicture respects em units', () { + testWidgets('circle (cx, cy, r)', (WidgetTester tester) async { + final GlobalKey key = GlobalKey(); + + const String svgStr = ''' + + + +'''; + + await tester.pumpWidget( + RepaintBoundary( + key: key, + child: SvgPicture.string( + svgStr, + theme: const SvgTheme(fontSize: 600), + ), + ), + ); + + await tester.pumpAndSettle(); + await _checkWidgetAndGolden(key, 'circle.em_ex.png'); + }); + + testWidgets('rect (x, y, width, height, rx, ry)', + (WidgetTester tester) async { + final GlobalKey key = GlobalKey(); + + const String svgStr = ''' + + + +'''; + + await tester.pumpWidget( + RepaintBoundary( + key: key, + child: SvgPicture.string( + svgStr, + theme: const SvgTheme(fontSize: 100), + ), + ), + ); + + await tester.pumpAndSettle(); + await _checkWidgetAndGolden(key, 'rect.em_ex.png'); + }); + + testWidgets('ellipse (cx, cy, rx, ry)', (WidgetTester tester) async { + final GlobalKey key = GlobalKey(); + + const String svgStr = ''' + + + +'''; + + await tester.pumpWidget( + RepaintBoundary( + key: key, + child: SvgPicture.string( + svgStr, + theme: const SvgTheme(fontSize: 100), + ), + ), + ); + + await tester.pumpAndSettle(); + await _checkWidgetAndGolden(key, 'ellipse.em_ex.png'); + }); + + testWidgets('line (x1, y1, x2, y2)', (WidgetTester tester) async { + final GlobalKey key = GlobalKey(); + + const String svgStr = ''' + + + + +'''; + + await tester.pumpWidget( + RepaintBoundary( + key: key, + child: SvgPicture.string( + svgStr, + theme: const SvgTheme(fontSize: 100), + ), + ), + ); + + await tester.pumpAndSettle(); + await _checkWidgetAndGolden(key, 'line.em_ex.png'); + }); + }); + + group('SvgPicture respects ex units', () { + testWidgets('circle (cx, cy, r)', (WidgetTester tester) async { + final GlobalKey key = GlobalKey(); + + const String svgStr = ''' + + + +'''; + + await tester.pumpWidget( + RepaintBoundary( + key: key, + child: SvgPicture.string( + svgStr, + theme: const SvgTheme( + fontSize: 1500, + xHeight: 600, + ), + ), + ), + ); + + await tester.pumpAndSettle(); + await _checkWidgetAndGolden(key, 'circle.em_ex2.png'); + }); + + testWidgets('rect (x, y, width, height, rx, ry)', + (WidgetTester tester) async { + final GlobalKey key = GlobalKey(); + + const String svgStr = ''' + + + +'''; + + await tester.pumpWidget( + RepaintBoundary( + key: key, + child: SvgPicture.string( + svgStr, + theme: const SvgTheme( + fontSize: 300, + xHeight: 100, + ), + ), + ), + ); + + await tester.pumpAndSettle(); + await _checkWidgetAndGolden(key, 'rect.em_ex2.png'); + }); + + testWidgets('ellipse (cx, cy, rx, ry)', (WidgetTester tester) async { + final GlobalKey key = GlobalKey(); + + const String svgStr = ''' + + + +'''; + + await tester.pumpWidget( + RepaintBoundary( + key: key, + child: SvgPicture.string( + svgStr, + theme: const SvgTheme( + fontSize: 300, + xHeight: 100, + ), + ), + ), + ); + + await tester.pumpAndSettle(); + await _checkWidgetAndGolden(key, 'ellipse.em_ex2.png'); + }); + + testWidgets('line (x1, y1, x2, y2)', (WidgetTester tester) async { + final GlobalKey key = GlobalKey(); + + const String svgStr = ''' + + + + +'''; + + await tester.pumpWidget( + RepaintBoundary( + key: key, + child: SvgPicture.string( + svgStr, + theme: const SvgTheme( + fontSize: 300, + xHeight: 100, + ), + ), + ), + ); + + await tester.pumpAndSettle(); + await _checkWidgetAndGolden(key, 'line.em_ex2.png'); + }); + }); + + testWidgets('SvgPicture - two of the same', (WidgetTester tester) async { + // Regression test to make sure the same SVG can render twice in the same + // view. If layers are incorrectly reused, this will fail. + await tester.pumpWidget(RepaintBoundary( + child: Directionality( + textDirection: TextDirection.ltr, + child: Row( + children: [ + SvgPicture.string(simpleSvg), + SvgPicture.string(simpleSvg), + ], + ), + ))); + await tester.pumpAndSettle(); + + await expectLater( + find.byType(RepaintBoundary), + matchesGoldenFile('golden_widget/two_of_same.png'), + ); + }); + + // This tests https://github.com/dnfield/flutter_svg/issues/990 + // Where embedded images were being incorrectly cached. + testWidgets('SvgPicture - with cached images', (WidgetTester tester) async { + // Simple red and blue 10x10 squares. + // Borrowed from https://gist.github.com/ondrek/7413434?permalink_comment_id=4674255#gistcomment-4674255 + final Map images = { + 'red': + 'iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAFUlEQVR42mP8z8BQz0AEYBxVSF+FABJADveWkH6oAAAAAElFTkSuQmCC', + 'blue': + 'iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAFUlEQVR42mNkYPhfz0AEYBxVSF+FAP5FDvcfRYWgAAAAAElFTkSuQmCC', + }; + + // We keep pumping widgets into the same tester, to ensure the same cache + // is used on each iteration. + for (final String key in images.keys) { + final String image = images[key]!; + final String svgStr = ''' + + '''; + + // First try with SvgPicture.string + await tester.pumpWidget(RepaintBoundary( + child: SvgPicture.string(svgStr), + )); + await tester.runAsync(() => vg.waitForPendingDecodes()); + await tester.pumpAndSettle(); + + Finder widgetFinder = find.byType(SvgPicture); + expect(widgetFinder, findsOneWidget); + await expectLater( + widgetFinder, matchesGoldenFile('golden_widget/image_$key.png')); + + // Then with SvgPicture.memory + await tester.pumpWidget(RepaintBoundary( + // ignore: unnecessary_cast + child: SvgPicture.memory(utf8.encode(svgStr) as Uint8List), + )); + await tester.runAsync(() => vg.waitForPendingDecodes()); + await tester.pumpAndSettle(); + + widgetFinder = find.byType(SvgPicture); + expect(widgetFinder, findsOneWidget); + await expectLater( + widgetFinder, matchesGoldenFile('golden_widget/image_$key.png')); + } + }); +} + +class FakeAssetBundle extends Fake implements AssetBundle { + @override + Future loadString(String key, {bool cache = true}) async { + return svgStr; + } + + @override + Future load(String key) async { + return Uint8List.fromList(utf8.encode(svgStr)).buffer.asByteData(); + } +} + +class FakeHttpClient extends Fake implements http.Client { + FakeHttpClient([this.statusCode = 200]); + + final int statusCode; + + final Map headers = {}; + + @override + Future get(Uri url, {Map? headers}) async { + if (headers != null) { + this.headers.addAll(headers); + } + return http.Response(svgStr, statusCode); + } +} + +const String simpleSvg = ''' + + + +'''; + +const String svgStr = ''' + + + + + + + + + + + + + + + + + + + + +'''; + +const String stickFigureSvgStr = ''' + + + + svg/stick_figure + Created with Sketch. + + + + + + + + + + + + + +'''; + +final Uint8List svgBytes = Uint8List.fromList(utf8.encode(svgStr)); diff --git a/third_party/packages/flutter_svg_test/LICENSE b/third_party/packages/flutter_svg_test/LICENSE new file mode 100644 index 000000000000..89a79eb0214e --- /dev/null +++ b/third_party/packages/flutter_svg_test/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2018 Dan Field + +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. \ No newline at end of file diff --git a/third_party/packages/flutter_svg_test/README.md b/third_party/packages/flutter_svg_test/README.md new file mode 100644 index 000000000000..3a1e3e2dd91e --- /dev/null +++ b/third_party/packages/flutter_svg_test/README.md @@ -0,0 +1,44 @@ +# flutter_svg_test + +### Testing + +This package provides a set of functions to find images generated by +[**flutter_svg** ](https://github.com/dnfield/flutter_svg/tree/master/packages/flutter_svg) +in widget tests. + +The methods find elements with the `SvgPicture` type and compare either the `BytesLoader` or the +configuration of the `BytesLoader` with the giving test attribute. + +### Example + +#### Find by BytesLoader + +The following example shows how you can find svgs with the matching `SvgAssetLoader`. + + ```dart +testWidgets('Finds svg', (WidgetTester widgetTester) async { + + final SvgPicture asset = SvgPicture.asset('/test/path/my.svg'); + + await widgetTester.pumpWidget(asset); + + expect(find.svg(asset.bytesLoader), findsOneWidget); +}); +``` + +#### Find by svg path + +Sometimes it is more convenient instead of instantiate the whole `BytesLoader` to +compare only specific attributes. + +The following example shows how you can find svgs with the specified attribute. + + ```dart +testWidgets('asset svg with path', (WidgetTester widgetTester) async { + const String svgPath = 'test/flutter_logo.svg'; + + await widgetTester.pumpWidget(SvgPicture.asset(svgPath)); + + expect(find.svgAssetWithPath(svgPath), findsOneWidget); +}); + ``` diff --git a/third_party/packages/flutter_svg_test/lib/flutter_svg_test.dart b/third_party/packages/flutter_svg_test/lib/flutter_svg_test.dart new file mode 100644 index 000000000000..a2200ef51114 --- /dev/null +++ b/third_party/packages/flutter_svg_test/lib/flutter_svg_test.dart @@ -0,0 +1,170 @@ +import 'dart:typed_data'; + +import 'package:flutter/widgets.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:flutter_test/flutter_test.dart'; + +/// Extension on common finder to have native feeling +extension CommonFinderExt on CommonFinders { + /// Finds [SvgPicture] widgets containing `svg` equal to the `svg` argument. + /// + /// ## Sample code + /// ```dart + /// expect(find.svg(SvgPicture.asset('assets/asset_name.svg')), findsOneWidget); + /// ``` + /// + /// If the `skipOffstage` argument is true (the default), then this skips + /// nodes that are [Offstage] or that are from inactive [Route]s. + Finder svg(BytesLoader svg, {bool skipOffstage = true}) { + return _SvgFinder(svg, skipOffstage: skipOffstage); + } + + /// Finds widgets created by [SvgPicture.asset] with the [path] argument. + /// ## Sample code + /// ```dart + /// expect(svgAssetWithPath('assets/asset_name.svg'), findsOneWidget); + /// ``` + /// This will match [SvgPicture.asset] with the [path] 'assets/asset_name.svg'. + /// If the `skipOffstage` argument is true (the default), then this skips + /// nodes that are [Offstage] or that are from inactive [Route]s. + Finder svgAssetWithPath(String path, {bool skipOffstage = true}) { + return _SvgAssetWithPathFinder(svgPath: path, skipOffstage: skipOffstage); + } + + /// Finds widgets created by [SvgPicture.network] with the [url] argument. + /// ## Sample code + /// ```dart + /// expect(find.svgNetworkWithUrl('https://svg.dart'), findsOneWidget); + /// ``` + /// This will match [SvgPicture.network] with the [url] https://svg.dart'. + /// If the `skipOffstage` argument is true (the default), then this skips + /// nodes that are [Offstage] or that are from inactive [Route]s. + Finder svgNetworkWithUrl(String url, {bool skipOffstage = true}) { + return _SvgNetworkWithUrlFinder(url: url, skipOffstage: skipOffstage); + } + + /// Finds widgets created by [SvgPicture.memory] with the [bytes] argument. + /// ## Sample code + /// ```dart + /// const Uint8List svgBytes = [1, 2, 3, 4]; + /// expect(find.svgMemoryWithBytes(svgBytes), findsOneWidget); + /// ``` + /// This will match [SvgPicture.memory] with the [bytes] [1,2,3,4]. + /// If the `skipOffstage` argument is true (the default), then this skips + /// nodes that are [Offstage] or that are from inactive [Route]s. + Finder svgMemoryWithBytes(Uint8List bytes, {bool skipOffstage = true}) { + return _SvgMemoryWithBytesFinder(bytes: bytes, skipOffstage: skipOffstage); + } + + /// Finds widgets created by [SvgPicture.file] with the [path] argument. + /// ## Sample code + /// ```dart + /// expect(find.svgFileWithPath('test/flutter_logo.svg'), findsOneWidget); + /// ``` + /// This will match [SvgPicture.file] with the [path] 'test/flutter_logo.svg'. + /// If the `skipOffstage` argument is true (the default), then this skips + /// nodes that are [Offstage] or that are from inactive [Route]s. + Finder svgFileWithPath(String path, {bool skipOffstage = true}) { + return _SvgFileWithPathFinder(path: path, skipOffstage: skipOffstage); + } +} + +class _SvgFinder extends MatchFinder { + _SvgFinder(this._svg, {super.skipOffstage}); + + final BytesLoader _svg; + + @override + String get description => "svg: '$_svg'"; + + @override + bool matches(Element candidate) { + return _getBytesLoader( + candidate, + (BytesLoader loader) => loader == _svg, + ); + } +} + +class _SvgAssetWithPathFinder extends MatchFinder { + _SvgAssetWithPathFinder({required String svgPath, super.skipOffstage}) + : _svgPath = svgPath; + final String _svgPath; + + @override + String get description => "Path: '$_svgPath' and created by SvgPicture.asset"; + + @override + bool matches(Element candidate) { + return _getBytesLoader( + candidate, + (SvgAssetLoader loader) => loader.assetName == _svgPath, + ); + } +} + +class _SvgNetworkWithUrlFinder extends MatchFinder { + _SvgNetworkWithUrlFinder({required String url, super.skipOffstage}) + : _url = url; + final String _url; + + @override + String get description => "Url: '$_url' and created by SvgPicture.network"; + + @override + bool matches(Element candidate) { + return _getBytesLoader( + candidate, + (SvgNetworkLoader loader) => loader.url == _url, + ); + } +} + +class _SvgFileWithPathFinder extends MatchFinder { + _SvgFileWithPathFinder({required String path, super.skipOffstage}) + : _path = path; + final String _path; + + @override + String get description => "Path: '$_path' and created by SvgPicture.file"; + + @override + bool matches(Element candidate) { + return _getBytesLoader( + candidate, + (SvgFileLoader loader) => loader.file.path == _path, + ); + } +} + +class _SvgMemoryWithBytesFinder extends MatchFinder { + _SvgMemoryWithBytesFinder({required Uint8List bytes, super.skipOffstage}) + : _bytes = bytes; + final Uint8List _bytes; + + @override + String get description => "Bytes: '$_bytes' and created by SvgPicture.memory"; + + @override + bool matches(Element candidate) { + return _getBytesLoader( + candidate, + (SvgBytesLoader loader) => loader.bytes == _bytes, + ); + } +} + +bool _getBytesLoader( + Element candidate, + bool Function(T loader) matcher, +) { + bool result = false; + final Widget widget = candidate.widget; + if (widget is SvgPicture) { + final BytesLoader bytesLoader = widget.bytesLoader; + if (bytesLoader is T) { + result = matcher(bytesLoader as T); + } + } + return result; +} diff --git a/third_party/packages/flutter_svg_test/pubspec.yaml b/third_party/packages/flutter_svg_test/pubspec.yaml new file mode 100644 index 000000000000..54a1a4265076 --- /dev/null +++ b/third_party/packages/flutter_svg_test/pubspec.yaml @@ -0,0 +1,21 @@ +name: flutter_svg_test +description: A testing library which makes it easy to test flutter svg . Built to be used with the flutter svg package. +repository: https://github.com/dnfield/flutter_svg/tree/master/packages/flutter_svg_test +issue_tracker: https://github.com/dnfield/flutter_svg/issues +version: 1.0.1 + +dependencies: + flutter: + sdk: flutter + flutter_svg: ^2.0.10 + flutter_test: + sdk: flutter + +dev_dependencies: + http: ^1.0.0 + +environment: + sdk: '>=2.19.0-0 <4.0.0' + flutter: ">=3.7.0-0" + + diff --git a/third_party/packages/flutter_svg_test/test/flutter_logo.svg b/third_party/packages/flutter_svg_test/test/flutter_logo.svg new file mode 100644 index 000000000000..ec3d9144f352 --- /dev/null +++ b/third_party/packages/flutter_svg_test/test/flutter_logo.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/third_party/packages/flutter_svg_test/test/flutter_svg_test_test.dart b/third_party/packages/flutter_svg_test/test/flutter_svg_test_test.dart new file mode 100644 index 000000000000..d00ce7a4d508 --- /dev/null +++ b/third_party/packages/flutter_svg_test/test/flutter_svg_test_test.dart @@ -0,0 +1,123 @@ +import 'dart:convert'; +import 'dart:io'; +import 'dart:typed_data'; + +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:flutter_svg_test/flutter_svg_test.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:http/http.dart' as http; + +void main() { + group('finds', () { + group('with bytesLoader', () { + testWidgets('asset svg', (WidgetTester widgetTester) async { + final SvgPicture asset = SvgPicture.asset('test/flutter_logo.svg'); + await widgetTester.pumpWidget( + DefaultAssetBundle( + bundle: _FakeAssetBundle(), + child: asset, + ), + ); + + expect(find.svg(asset.bytesLoader), findsOneWidget); + }); + + testWidgets('network svg', (WidgetTester widgetTester) async { + final http.Client fakeClient = _FakeHttpClient(); + final SvgPicture asset = SvgPicture.network( + 'svg.dart', + httpClient: fakeClient, + ); + await widgetTester.pumpWidget(asset); + + expect(find.svg(asset.bytesLoader), findsOneWidget); + }); + + testWidgets('string svg', (WidgetTester widgetTester) async { + final SvgPicture asset = SvgPicture.string(_svgStr); + await widgetTester.pumpWidget(asset); + + expect(find.svg(asset.bytesLoader), findsOneWidget); + }); + + testWidgets('file svg', (WidgetTester widgetTester) async { + final File file = File('test/flutter_logo.svg'); + final SvgPicture asset = SvgPicture.file(file); + await widgetTester.pumpWidget(asset); + + expect(find.svg(asset.bytesLoader), findsOneWidget); + }); + + testWidgets('memory svg', (WidgetTester widgetTester) async { + final SvgPicture asset = SvgPicture.memory(_svgBytes); + await widgetTester.pumpWidget(asset); + + expect(find.svg(asset.bytesLoader), findsOneWidget); + }); + }); + + testWidgets('asset svg with path', (WidgetTester widgetTester) async { + const String svgPath = 'test/flutter_logo.svg'; + await widgetTester.pumpWidget( + DefaultAssetBundle( + bundle: _FakeAssetBundle(), + child: SvgPicture.asset(svgPath), + ), + ); + + expect(find.svgAssetWithPath(svgPath), findsOneWidget); + }); + + testWidgets('network svg with url', (WidgetTester widgetTester) async { + const String svgUri = 'svg.dart'; + await widgetTester.pumpWidget(SvgPicture.network(svgUri)); + + expect(find.svgNetworkWithUrl(svgUri), findsOneWidget); + }); + + testWidgets('file svg wit path', (WidgetTester widgetTester) async { + const String svgPath = 'test/flutter_logo.svg'; + + await widgetTester.pumpWidget(SvgPicture.file(File(svgPath))); + + expect(find.svgFileWithPath(svgPath), findsOneWidget); + }); + + testWidgets('memory svg with bytes', (WidgetTester widgetTester) async { + final Uint8List svgBytes = _svgBytes; + await widgetTester.pumpWidget(SvgPicture.memory(svgBytes)); + + expect(find.svgMemoryWithBytes(svgBytes), findsOneWidget); + }); + }); +} + +class _FakeAssetBundle extends Fake implements AssetBundle { + @override + Future loadString(String key, {bool cache = true}) async { + return _svgStr; + } + + @override + Future load(String key) async { + return Uint8List.fromList(utf8.encode(_svgStr)).buffer.asByteData(); + } +} + +class _FakeHttpClient extends Fake implements http.Client { + @override + Future get(Uri url, {Map? headers}) async { + return http.Response(_svgStr, 200); + } +} + +// Ignore this because the minimum flutter sdk needs this cast. +// ignore: unnecessary_cast +final Uint8List _svgBytes = utf8.encode(_svgStr) as Uint8List; + +const String _svgStr = ''' + + + +''';