-
-
Notifications
You must be signed in to change notification settings - Fork 201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lottie not working in web since 3.1.2 #353
Comments
@konsultaner can you show how you configure the lottie widget? Do you use the |
@xvrh sorry, totally rushed that issue. This is my file including the lottie asset. import 'dart:math';
import 'package:flutter/material.dart';
import 'package:lottie/lottie.dart';
class QRCodeLoginNoScan extends StatelessWidget {
const QRCodeLoginNoScan({super.key});
@override
Widget build(BuildContext context) {
var lottieDelegates = [
if (Theme.of(context).brightness == Brightness.dark)
ValueDelegate.colorFilter(
const [ '**'],
value: ColorFilter.mode(Theme.of(context).colorScheme.onSurface, BlendMode.src),
),
if (Theme.of(context).brightness == Brightness.light)
ValueDelegate.colorFilter(
const [ '**', 'scan', '**'],
value: ColorFilter.mode(Theme.of(context).primaryColor, BlendMode.src),
),
if (Theme.of(context).brightness == Brightness.light)
ValueDelegate.colorFilter(
const [ '**', 'phone', 'Group 1', '**'],
value: ColorFilter.mode(Theme.of(context).primaryColor, BlendMode.src),
)
];
return Padding(
padding: const EdgeInsets.symmetric(vertical: 200, horizontal: 20),
child: Center(
child: FittedBox(
fit: BoxFit.contain,
child: Lottie.asset(
width: max(MediaQuery.of(context).size.width,MediaQuery.of(context).size.height),
height: max(MediaQuery.of(context).size.width,MediaQuery.of(context).size.height),
fit: BoxFit.contain,
'assets/lottie/qr_code_animation.json',
renderCache: RenderCache.raster,
delegates: LottieDelegates(values: lottieDelegates),
),
),
),
);
}
} |
I think you should drop the Alternatively, you can also try the canvaskit renderer. |
Maybe the package should add a debug warning and have a |
I think it works with the canvaskit renderer so Furthermore it's likely that the html-renderer will go away: flutter/flutter#145954 |
I changed my code to: import 'dart:math';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:lottie/lottie.dart';
class QRCodeLoginNoScan extends StatelessWidget {
const QRCodeLoginNoScan({super.key});
@override
Widget build(BuildContext context) {
var lottieDelegates = [
if (Theme.of(context).brightness == Brightness.dark)
ValueDelegate.colorFilter(
const [ '**'],
value: ColorFilter.mode(Theme.of(context).colorScheme.onSurface, BlendMode.src),
),
if (Theme.of(context).brightness == Brightness.light)
ValueDelegate.colorFilter(
const [ '**', 'scan', '**'],
value: ColorFilter.mode(Theme.of(context).primaryColor, BlendMode.src),
),
if (Theme.of(context).brightness == Brightness.light)
ValueDelegate.colorFilter(
const [ '**', 'phone', 'Group 1', '**'],
value: ColorFilter.mode(Theme.of(context).primaryColor, BlendMode.src),
)
];
return Padding(
padding: const EdgeInsets.symmetric(vertical: 200, horizontal: 20),
child: Center(
child: Lottie.asset(
width: max(MediaQuery.of(context).size.width,MediaQuery.of(context).size.height),
height: max(MediaQuery.of(context).size.width,MediaQuery.of(context).size.height),
//fit: BoxFit.contain,
'assets/lottie/qr_code_animation.json',
renderCache: kIsWeb ? null : RenderCache.raster,
delegates: LottieDelegates(values: lottieDelegates),
),
),
);
}
} on first load eveything works great but on hot-reload I get this error:
Is that lottie related? Never seen anything like this. |
After updating from 3.1.1 to 3.1.2 I cannot use it in my web view anymore I get the following error:
The text was updated successfully, but these errors were encountered: