Skip to content
Related Articles

Related Articles

ClipRRect Widget in Flutter

View Discussion
Improve Article
Save Article
Like Article
  • Difficulty Level : Medium
  • Last Updated : 02 Dec, 2020

The ClipRRect widget in flutter is used to clips its child using a rounded rectangle.  It associates with the Clippers family. The main use of clippers is to clip out any portion of the widget as required. It behaves similar to that of ClipRect and is used to Clip a Rectangle portion of the child widget but with rounded corners


{Key key,
BorderRadius borderRadius:,
CustomClipper<RRect> clipper, 
Clip clipBehavior: Clip.antiAlias, 
Widget child})


  • children: The widgets below this widget in the tree.
  • hashCode: The hash code for this object.
  • key: Controls how one widget replaces another widget in the tree.
  • runtimeType: A representation of the runtime type of the object.
  • clipBehaviour: Controls how to clip.
  • clipper: If non-null, determines which clip to use.
  • borderRadius: The border radius of the rounded corners


  • createRenderObject (BuildContext context): This function takes in RenderClipRect as the object. RndereObjectWidget gives configuration instructions to create RenderObject class.
RenderClipRect createRenderObject (
BuildContext context
  • debugFillProperties (DiagnosticPropertiesBuilder properties):  This function takes void as the object to allocate an additional property associated with the node.
void debugFillProperties (
DiagnosticPropertiesBuilder properties
  • didUnmountRenderObject(covariant RenderClipRect renderObject): This function also holds void as the object. When a widget is removed from the widget tree it returns a widget of the same type.
void didUnmountRenderObject (
covariant RenderClipRect renderObject


Here we will clip the below image with a rounded corner rectangle:


import 'package:flutter/material.dart';
void main() {
class MyApp extends StatelessWidget {
  // This widget is
  //the root of your application.
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'ClipOval',
      theme: ThemeData(
      home: MyHomePAGE(),
      debugShowCheckedModeBanner: false,
class MyHomePAGE extends StatefulWidget {
  _MyHomePAGEState createState() => _MyHomePAGEState();
class _MyHomePAGEState extends State<MyHomePAGE> {
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('GeeksforGeeks'),
      body: Center(
          child: ClipRRect(
class MyClip extends CustomClipper<Rect> {
  Rect getClip(Size size) {
    return Rect.fromLTWH(0, 0, 100, 100);
  bool shouldReclip(oldClipper) {
    return false;



  1. First initialize the main app as a stateless widget.
  2. Second design the main widget as you desire.
  3. Build the Appbar with the scaffold widget.
  4. Now use the ClipRect widget inside the body of the scaffold widget and place it in the middle using the center widget.

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!