Skip to content

Instantly share code, notes, and snippets.

@flar
Last active July 10, 2020 19:11
Show Gist options
  • Save flar/a238a7c64d144ae4653faa7cc6d2ac4d to your computer and use it in GitHub Desktop.
Save flar/a238a7c64d144ae4653faa7cc6d2ac4d to your computer and use it in GitHub Desktop.
Using ImageFiltered instead of BackdropFilter to blur text
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