title: How to create a transparent full screen dialog on top of activity - Flutter
body: <p>I am trying to create a transparent full screen dialog on top of activity. I have tried following this <a href="https://github.com/flutter/flutter/issues/9627" rel="noreferrer">thread</a> but solution doesn't work.</p>
  
  <p><strong>In short , what I need is:</strong></p>
  
  <ul>
  <li>full screen dialog.</li>
  <li>transparent background except for the widget I use for the dialog</li>
  </ul>
  
  <p>here's my code: </p>
  
  <blockquote>
    <p>To open dialog</p>
  </blockquote>
  
  <pre><code>void onNextBtnClick(){
      var route = new MaterialPageRoute(
          builder: (BuildContext context) =&gt;
          new GenreDialogUI(),fullscreenDialog: true
      );
      Navigator.of(context).push(route);
  }
  </code></pre>
  
  <blockquote>
    <p>For Dialog view</p>
  </blockquote>
  
  <pre><code>import 'package:flutter/widgets.dart';
  
  class HolePuncherPainter extends CustomPainter {
    static final clearPaint = new Paint()
      ..color = Colors.transparent,
      ..blendMode = BlendMode.clear;
  
    const HolePuncherPainter();
  
    @override
    void paint(Canvas canvas, Size size) {
      canvas.drawRect(
          new Rect.fromLTWH(0.0, 0.0, size.width, size.height), clearPaint);
    }
  
    @override
    bool shouldRepaint(CustomPainter oldDelegate) {
      return true;
    }
  }
  
  class GenreDialogUI extends StatefulWidget {
     @override
     _GenreDialogUI createState() =&gt; new _GenreDialogUI();
  }
  
  class _GenreDialogUI extends State&lt;GenreDialogUI&gt;  {
  
    @override
    Widget build(BuildContext context) {
      return new Scaffold(
        appBar: addAppbar(),
        body: new CustomPaint(
          painter: HolePuncherPainter(),
          child: new Container(
          color: Colors.transparent,
          alignment: Alignment.center,
          child: UtilCommonWidget.addText('Transparent Dialog', Colors.red, 22.0, 1),
          ),
        ),
      );
    }
  }
  </code></pre>