Flutter - Blurred Decoration Image
Last Updated :
28 Apr, 2025
In this article, we will implement how to Blur an image in flutter. A sample image is given below to get an idea about what we are going to do in this article.
Step By Step Implementation
Step 1: Create a New Project in Android Studio
To set up Flutter Development on Android Studio please refer to Android Studio Setup for Flutter Development, and then create a new project in Android Studio please refer to Creating a Simple Application in Flutter. Or you can simply run this command in your project directory.
flutter create projectname
This command creates the Flutter project for you, Now you can run it.
Step 2: Add the material package that gives us the important methods and then call the runApp method in the main function that will call our application.
import 'package:flutter/material.dart';
void main() {
runApp(RunMyApp());
}
Step 3: Now we have to make a stateless widget RunMyApp Because our application does not go to change its state and then return the MaterialApp widget which allows us the set the title and theme and many more.
class RunMyApp extends StatelessWidget {
const RunMyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(home:);
}
}
Step 4: Give the home property and there can be a scaffold widget with the property of AppBar and body. AppBar allows us to give the title of AppBar, color, leading, and trailing icon. Body contains the Container and has height , width, and decoration parameters, Again we can decorate the container using the BoxDecoration, Box decoration have the image of the asset and fit the cover.
Container(
height: double.maxFinite,
width: double.maxFinite,
decoration: BoxDecoration(
image: DecorationImage(
image: ExactAssetImage("assets/img.png"),
fit: BoxFit.cover,
),
),
child:
Step 5: Now we can use the filter to blur this image.
child: ClipRRect(
// make sure we apply clip it properly
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10),
child: Container(
alignment: Alignment.center,
color: Colors.grey.withOpacity(0.1),
child: Text(
"GFG COURSES",
style: TextStyle(fontSize: 28, fontWeight: FontWeight.bold),
),
),
),
),
Final Code:
Dart
import 'dart:ui';
import 'package:flutter/material.dart';
void main() {
runApp(RunMyApp());
}
class RunMyApp extends StatelessWidget {
const RunMyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeData(primarySwatch: Colors.green),
home: Scaffold(
appBar: AppBar(
title: Text('Blur Image'),
),
body: Container(
height: double.maxFinite,
width: double.maxFinite,
decoration: BoxDecoration(
image: DecorationImage(
image: ExactAssetImage("assets/img.png"),
fit: BoxFit.cover,
),
),
child: ClipRRect(
// make sure we apply clip it properly
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10),
child: Container(
alignment: Alignment.center,
color: Colors.grey.withOpacity(0.1),
child: Text(
"GFG COURSES",
style: TextStyle(fontSize: 28, fontWeight: FontWeight.bold),
),
),
),
),
),
),
);
}
}
Output:
Similar Reads
Flutter - BoxDecoration Widget BoxDecoration is a build-in widget in flutter API. At a bare basic level, it describes how a box should be painted on the screen. The shape of the box needs not to be just a rectangle or a square it can circle also. It comes with a ton of properties we can add an image inside, add a radius to the bo
3 min read
Mask Detection App in Flutter Nowadays in the situation of Covid, it is very important to wear a Mask and protect yourself and others. So this App helps to detect whether the person has worn the Mask or Not. In this Application, the Mask detection is done with the help of TensorFlow Lite. Follow the steps to implement Mask Detec
7 min read
Flutter - Build an Image Compressor App Many applications accept images of small size, to reduce image size we use different online applications to compress images while maintaining their quality. In this article, we will create an image compressor app in Flutter that compresses images with the help of available libraries in Flutter. Step
8 min read
Flutter - Build an Image Compressor App Many applications accept images of small size, to reduce image size we use different online applications to compress images while maintaining their quality. In this article, we will create an image compressor app in Flutter that compresses images with the help of available libraries in Flutter. Step
8 min read
Flutter - Expansion Tile Card The Expansion Tile Card works similarly to that of the Flutter SDK's standard expansion tile. But it uses the style used by Google itself in its products to raise a tile. It can be called a better version of the Flutter's ExpansionTileCard. In this article, we will look into the process of implement
3 min read
Flutter - Asset Image Flutter is an open-source, cross-platform UI development kit developed by Google. It is gaining popularity these days, as the app made in Flutter can run on various devices regardless of their platform. It is majorly used to develop applications for Android and iOS, as a single app made in Flutter c
2 min read