Skip to content

Commit

Permalink
Merge pull request #731 from nextcloud/feature/precompile-all-svgs
Browse files Browse the repository at this point in the history
Feature/precompile all svgs
  • Loading branch information
provokateurin authored Sep 8, 2023
2 parents 9b965c0 + 2afc323 commit ccff1a3
Show file tree
Hide file tree
Showing 24 changed files with 135 additions and 147 deletions.
1 change: 0 additions & 1 deletion packages/app/assets/logo.svg

This file was deleted.

Binary file added packages/app/assets/logo.svg.vec
Binary file not shown.
12 changes: 7 additions & 5 deletions packages/app/lib/branding.dart
Original file line number Diff line number Diff line change
@@ -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',
);
Expand Down
4 changes: 2 additions & 2 deletions packages/app/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ packages:
source: hosted
version: "2.0.16"
flutter_svg:
dependency: "direct main"
dependency: transitive
description:
name: flutter_svg
sha256: "8c5d68a82add3ca76d792f058b186a0599414f279f00ece4830b9b231b570338"
Expand Down Expand Up @@ -1232,7 +1232,7 @@ packages:
source: hosted
version: "3.0.7"
vector_graphics:
dependency: transitive
dependency: "direct main"
description:
name: vector_graphics
sha256: "670f6e07aca990b4a2bcdc08a784193c4ccdd1932620244c3a86bb72a0eac67f"
Expand Down
2 changes: 1 addition & 1 deletion packages/app/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ environment:
dependencies:
flutter:
sdk: flutter
flutter_svg: ^2.0.7
neon:
git:
url: https://github.com/nextcloud/neon
Expand All @@ -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
Expand Down
77 changes: 0 additions & 77 deletions packages/neon/neon/assets/logo_nextcloud.svg

This file was deleted.

Binary file added packages/neon/neon/assets/logo_nextcloud.svg.vec
Binary file not shown.
16 changes: 9 additions & 7 deletions packages/neon/neon/lib/src/models/app_implementation.dart
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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<T extends Bloc, R extends NextcloudAppOptions> {
Expand Down Expand Up @@ -95,13 +95,15 @@ abstract class AppImplementation<T extends Bloc, R extends NextcloudAppOptions>
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,
),
);

Expand Down
10 changes: 6 additions & 4 deletions packages/neon/neon/lib/src/widgets/nextcloud_logo.dart
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
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({
super.key,
});

@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,
);
}
1 change: 0 additions & 1 deletion packages/neon/neon_files/assets/app.svg

This file was deleted.

Binary file added packages/neon/neon_files/assets/app.svg.vec
Binary file not shown.
1 change: 1 addition & 0 deletions packages/neon/neon_files/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions packages/neon/neon_news/assets/app.svg

This file was deleted.

Binary file added packages/neon/neon_news/assets/app.svg.vec
Binary file not shown.
1 change: 1 addition & 0 deletions packages/neon/neon_news/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion packages/neon/neon_notes/assets/app.svg

This file was deleted.

Binary file added packages/neon/neon_notes/assets/app.svg.vec
Binary file not shown.
1 change: 1 addition & 0 deletions packages/neon/neon_notes/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion packages/neon/neon_notifications/assets/app.svg

This file was deleted.

Binary file added packages/neon/neon_notifications/assets/app.svg.vec
Binary file not shown.
1 change: 1 addition & 0 deletions packages/neon/neon_notifications/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
40 changes: 0 additions & 40 deletions tool/generate-app.sh

This file was deleted.

Loading

0 comments on commit ccff1a3

Please sign in to comment.