Last active
July 10, 2020 19:11
-
-
Save flar/a238a7c64d144ae4653faa7cc6d2ac4d to your computer and use it in GitHub Desktop.
Using ImageFiltered instead of BackdropFilter to blur text
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
import 'dart:ui'; | |
import 'package:flutter/material.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
builder: (_, __) => Scaffold( | |
body: Column( | |
mainAxisAlignment: MainAxisAlignment.center, | |
children: <Widget> [ | |
Opacity( | |
opacity: 0.9, | |
child: Stack( | |
children: <Widget>[ | |
Center(child: Text('BackdropFilter', textScaleFactor: 4.0)), | |
BackdropFilter( | |
filter: ImageFilter.blur(sigmaX: 3.0, sigmaY: 3.0), | |
child: Container(color: Colors.black.withOpacity(0.0)), | |
), | |
], | |
), | |
), | |
Opacity( | |
opacity: 0.9, | |
child: Stack( | |
children: <Widget>[ | |
Center(child: Container(color: Colors.white, width: 500, height: 75)), | |
Center(child: Text('BackdropFilter w/ bg', textScaleFactor: 4.0)), | |
BackdropFilter( | |
filter: ImageFilter.blur(sigmaX: 3.0, sigmaY: 3.0), | |
child: Container(color: Colors.black.withOpacity(0.0)), | |
), | |
], | |
), | |
), | |
Opacity( | |
opacity: 0.9, | |
child: ImageFiltered( | |
imageFilter: ImageFilter.blur(sigmaX: 3.0, sigmaY: 3.0), | |
child: Center(child: Text('Imagefiltered', textScaleFactor: 4.0)), | |
), | |
), | |
], | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment