Created
June 6, 2022 19:16
-
-
Save X-Wei/a39eeefa873b62f63e4f3516c2d04b09 to your computer and use it in GitHub Desktop.
ImageFilter.compose crash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://github.com/X-Wei/flutter_catalog/issues/131 | |
import 'dart:ui'; | |
import 'package:flutter/material.dart'; | |
const Color darkBlue = Color.fromARGB(255, 18, 32, 47); | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
theme: ThemeData.dark().copyWith( | |
scaffoldBackgroundColor: darkBlue, | |
), | |
debugShowCheckedModeBanner: false, | |
home: Scaffold( | |
body: Center( | |
child: MyWidget(), | |
), | |
), | |
); | |
} | |
} | |
class MyWidget extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return ImageFiltered( | |
// ❌️❌️ blur then rotate - CRASH?? (console says "script error") ❌️❌️ | |
imageFilter: ImageFilter.compose( | |
outer: ImageFilter.matrix(Matrix4.rotationZ(0.1).storage), | |
inner: ImageFilter.blur(sigmaX: 2, sigmaY: 3), | |
), | |
// ✅️ only rotation - OK | |
// imageFilter: ImageFilter.matrix(Matrix4.rotationZ(0.1).storage), | |
// ✅️ only blur - OK | |
// imageFilter: ImageFilter.blur(sigmaX: 2, sigmaY: 3), | |
child:Text( | |
'Hello, World!', | |
style: Theme.of(context).textTheme.headline4, | |
),); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment