diff --git a/packages/app/assets/logo.svg b/packages/app/assets/logo.svg deleted file mode 120000 index 4228c635..00000000 --- a/packages/app/assets/logo.svg +++ /dev/null @@ -1 +0,0 @@ -../../../assets/logo.svg \ No newline at end of file diff --git a/packages/app/assets/logo.svg.vec b/packages/app/assets/logo.svg.vec new file mode 100644 index 00000000..081aa566 Binary files /dev/null and b/packages/app/assets/logo.svg.vec differ diff --git a/packages/app/lib/branding.dart b/packages/app/lib/branding.dart index 13382f2f..0a13a7cd 100644 --- a/packages/app/lib/branding.dart +++ b/packages/app/lib/branding.dart @@ -1,19 +1,21 @@ import 'dart:ui'; -import 'package:flutter_svg/flutter_svg.dart'; import 'package:neon/theme.dart'; +import 'package:vector_graphics/vector_graphics.dart'; -final neonTheme = NeonTheme( +const neonTheme = NeonTheme( branding: branding, colorScheme: colorScheme, ); -final branding = Branding( +const branding = Branding( name: 'Nextcloud Neon', - logo: SvgPicture.asset( - 'assets/logo.svg', + logo: VectorGraphic( width: 100, height: 100, + loader: AssetBytesLoader( + 'assets/logo.svg.vec', + ), ), legalese: 'Copyright © 2023, provokateurin\nUnder GPLv3 license', ); diff --git a/packages/app/pubspec.lock b/packages/app/pubspec.lock index 9a9d68c7..bb604b6c 100644 --- a/packages/app/pubspec.lock +++ b/packages/app/pubspec.lock @@ -367,7 +367,7 @@ packages: source: hosted version: "2.0.16" flutter_svg: - dependency: "direct main" + dependency: transitive description: name: flutter_svg sha256: "8c5d68a82add3ca76d792f058b186a0599414f279f00ece4830b9b231b570338" @@ -1232,7 +1232,7 @@ packages: source: hosted version: "3.0.7" vector_graphics: - dependency: transitive + dependency: "direct main" description: name: vector_graphics sha256: "670f6e07aca990b4a2bcdc08a784193c4ccdd1932620244c3a86bb72a0eac67f" diff --git a/packages/app/pubspec.yaml b/packages/app/pubspec.yaml index 6de39d11..14bfa9d1 100644 --- a/packages/app/pubspec.yaml +++ b/packages/app/pubspec.yaml @@ -9,7 +9,6 @@ environment: dependencies: flutter: sdk: flutter - flutter_svg: ^2.0.7 neon: git: url: https://github.com/nextcloud/neon @@ -30,6 +29,7 @@ dependencies: git: url: https://github.com/nextcloud/neon path: packages/neon/neon_notifications + vector_graphics: ^1.1.7 dev_dependencies: flutter_material_design_icons: ^1.1.7296 diff --git a/packages/neon/neon/assets/logo_nextcloud.svg b/packages/neon/neon/assets/logo_nextcloud.svg deleted file mode 100644 index 7910fc00..00000000 --- a/packages/neon/neon/assets/logo_nextcloud.svg +++ /dev/null @@ -1,77 +0,0 @@ - - - -image/svg+xml \ No newline at end of file diff --git a/packages/neon/neon/assets/logo_nextcloud.svg.vec b/packages/neon/neon/assets/logo_nextcloud.svg.vec new file mode 100644 index 00000000..af812c82 Binary files /dev/null and b/packages/neon/neon/assets/logo_nextcloud.svg.vec differ diff --git a/packages/neon/neon/lib/src/models/app_implementation.dart b/packages/neon/neon/lib/src/models/app_implementation.dart index 5051d0e6..7b0c628d 100644 --- a/packages/neon/neon/lib/src/models/app_implementation.dart +++ b/packages/neon/neon/lib/src/models/app_implementation.dart @@ -1,6 +1,5 @@ import 'package:collection/collection.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_svg/flutter_svg.dart'; import 'package:go_router/go_router.dart'; import 'package:meta/meta.dart'; import 'package:neon/l10n/localizations.dart'; @@ -12,6 +11,7 @@ import 'package:neon/src/settings/models/storage.dart'; import 'package:neon/src/widgets/drawer_destination.dart'; import 'package:provider/provider.dart'; import 'package:rxdart/rxdart.dart'; +import 'package:vector_graphics/vector_graphics.dart'; @immutable abstract class AppImplementation { @@ -95,13 +95,15 @@ abstract class AppImplementation final Color? color, }) => Builder( - builder: (final context) => SizedBox.fromSize( - size: size, - child: SvgPicture.asset( - 'assets/app.svg', - package: 'neon_$id', - colorFilter: ColorFilter.mode(color ?? Theme.of(context).colorScheme.primary, BlendMode.srcIn), + builder: (final context) => VectorGraphic( + width: size.width, + height: size.height, + colorFilter: ColorFilter.mode(color ?? Theme.of(context).colorScheme.primary, BlendMode.srcIn), + loader: AssetBytesLoader( + 'assets/app.svg.vec', + packageName: 'neon_$id', ), + semanticsLabel: AppLocalizations.of(context).nextcloudLogo, ), ); diff --git a/packages/neon/neon/lib/src/widgets/nextcloud_logo.dart b/packages/neon/neon/lib/src/widgets/nextcloud_logo.dart index bd11a90f..c6324ca3 100644 --- a/packages/neon/neon/lib/src/widgets/nextcloud_logo.dart +++ b/packages/neon/neon/lib/src/widgets/nextcloud_logo.dart @@ -1,6 +1,6 @@ import 'package:flutter/widgets.dart'; -import 'package:flutter_svg/flutter_svg.dart'; import 'package:neon/l10n/localizations.dart'; +import 'package:vector_graphics/vector_graphics.dart'; class NextcloudLogo extends StatelessWidget { const NextcloudLogo({ @@ -8,11 +8,13 @@ class NextcloudLogo extends StatelessWidget { }); @override - Widget build(final BuildContext context) => SvgPicture.asset( - 'assets/logo_nextcloud.svg', - package: 'neon', + Widget build(final BuildContext context) => VectorGraphic( width: 100, height: 100, + loader: const AssetBytesLoader( + 'assets/logo_nextcloud.svg.vec', + packageName: 'neon', + ), semanticsLabel: AppLocalizations.of(context).nextcloudLogo, ); } diff --git a/packages/neon/neon_files/assets/app.svg b/packages/neon/neon_files/assets/app.svg deleted file mode 100644 index 7f84d1de..00000000 --- a/packages/neon/neon_files/assets/app.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/neon/neon_files/assets/app.svg.vec b/packages/neon/neon_files/assets/app.svg.vec new file mode 100644 index 00000000..51f4d00d Binary files /dev/null and b/packages/neon/neon_files/assets/app.svg.vec differ diff --git a/packages/neon/neon_files/pubspec.yaml b/packages/neon/neon_files/pubspec.yaml index bf4dce86..4a3a0465 100644 --- a/packages/neon/neon_files/pubspec.yaml +++ b/packages/neon/neon_files/pubspec.yaml @@ -39,6 +39,7 @@ dev_dependencies: git: url: https://github.com/nextcloud/neon path: packages/neon_lints + vector_graphics_compiler: ^1.1.7 flutter: uses-material-design: true diff --git a/packages/neon/neon_news/assets/app.svg b/packages/neon/neon_news/assets/app.svg deleted file mode 100644 index c27cae23..00000000 --- a/packages/neon/neon_news/assets/app.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/packages/neon/neon_news/assets/app.svg.vec b/packages/neon/neon_news/assets/app.svg.vec new file mode 100644 index 00000000..b63e37c1 Binary files /dev/null and b/packages/neon/neon_news/assets/app.svg.vec differ diff --git a/packages/neon/neon_news/pubspec.yaml b/packages/neon/neon_news/pubspec.yaml index 288afaf7..330cb2b9 100644 --- a/packages/neon/neon_news/pubspec.yaml +++ b/packages/neon/neon_news/pubspec.yaml @@ -31,6 +31,7 @@ dev_dependencies: git: url: https://github.com/nextcloud/neon path: packages/neon_lints + vector_graphics_compiler: ^1.1.7 flutter: uses-material-design: true diff --git a/packages/neon/neon_notes/assets/app.svg b/packages/neon/neon_notes/assets/app.svg deleted file mode 100644 index a7a15434..00000000 --- a/packages/neon/neon_notes/assets/app.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/neon/neon_notes/assets/app.svg.vec b/packages/neon/neon_notes/assets/app.svg.vec new file mode 100644 index 00000000..d9dd7244 Binary files /dev/null and b/packages/neon/neon_notes/assets/app.svg.vec differ diff --git a/packages/neon/neon_notes/pubspec.yaml b/packages/neon/neon_notes/pubspec.yaml index 0fbee667..09fc269e 100644 --- a/packages/neon/neon_notes/pubspec.yaml +++ b/packages/neon/neon_notes/pubspec.yaml @@ -31,6 +31,7 @@ dev_dependencies: git: url: https://github.com/nextcloud/neon path: packages/neon_lints + vector_graphics_compiler: ^1.1.7 flutter: uses-material-design: true diff --git a/packages/neon/neon_notifications/assets/app.svg b/packages/neon/neon_notifications/assets/app.svg deleted file mode 100644 index 51507f36..00000000 --- a/packages/neon/neon_notifications/assets/app.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/neon/neon_notifications/assets/app.svg.vec b/packages/neon/neon_notifications/assets/app.svg.vec new file mode 100644 index 00000000..5bf96834 Binary files /dev/null and b/packages/neon/neon_notifications/assets/app.svg.vec differ diff --git a/packages/neon/neon_notifications/pubspec.yaml b/packages/neon/neon_notifications/pubspec.yaml index 09ece783..486b9df9 100644 --- a/packages/neon/neon_notifications/pubspec.yaml +++ b/packages/neon/neon_notifications/pubspec.yaml @@ -25,6 +25,7 @@ dev_dependencies: git: url: https://github.com/nextcloud/neon path: packages/neon_lints + vector_graphics_compiler: ^1.1.7 flutter: uses-material-design: true diff --git a/tool/generate-assets.sh b/tool/generate-assets.sh index 6a8ebd28..07d72075 100755 --- a/tool/generate-assets.sh +++ b/tool/generate-assets.sh @@ -41,6 +41,11 @@ function export_mipmap_icon_all() { wait } +function precompile_assets() { + fvm dart run vector_graphics_compiler --input-dir assets/ + find assets/ -name "*.svg" -exec rm {} \; +} + wget https://raw.githubusercontent.com/Templarian/MaterialDesign/master/svg/cable-data.svg -O assets/logo.svg sed -i "s/