last day (15 days later) » 

7:10 AM
0
A: Flutter how to set container background as transparent color

diegoveloperThe AlertDialog Widget has a backgroundColor property , just set it to transparent. AlertDialog( contentPadding: EdgeInsets.zero, backgroundColor: Colors.transparent, And remove the BoxDecoration Update Looks like backgroundColor is not available on Flutter 1.0.0...

 
I can't set backgroundColor: Colors.transparent. It gives me error.
 
hmm what version of Flutter do you have?
 
its Flutter 1.0.0 BTW docs.flutter.io/flutter/material/AlertDialog-class.html AlertDialog it self has not this type of property
 
yes, you are right, looks like is not available in that version yet.
 
By copy paste class MyAlertDialog I got so many error. Have you tried?
 
7:10 AM
yes, maybe you need to import : import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart';
 
return Dialog(
backgroundColor: backgroundColor,
elevation: elevation,
shape: shape,
child: dialogChild,
);
 
oh, hmm maybe Dialog also need a backgroundColor property
let me check
 
I added import 'package:flutter/foundation.dart' ;

backgroundColor and elevation has error
 
yeah hmm let me try another solution
 
Ok no problem .... BTW thanks, For Giving time to help me :)
 
7:15 AM
sure
I updated my answer , let me know if it works for you
 
sure
I added new dart file in my project name is "my_dialog.dart" and copy/paste your code
and bring some errors
color: backgroundColor ?? dialogTheme.backgroundColor ?? Theme.of(context).dialogBackgroundColor,
elevation: elevation ?? dialogTheme.elevation ?? _defaultElevation,
      style: titleTextStyle ?? dialogTheme.titleTextStyle ?? theme.textTheme.title,
 
hmm
looks like all is related
which lines ?
 
These three lines and
        style: contentTextStyle ?? dialogTheme.contentTextStyle ?? theme.textTheme.subhead,
this one too
 
Error has gone, But how can I use
 
7:28 AM
import 'my_dialog.dart' as mydialog;
mydialog.AlertDialog(
contentPadding: EdgeInsets.zero,
check my answer updated
 
Ok
 
I found an easy solution
 
I can't set showDialog under mydialog.AlertDialog as you suggested in the answer
 
check my updated answer
 
Hey.. It works
OMG..
 
7:34 AM
haha nice
it was easier than expected
 
I tried for it last 2 days.
You are the man! Dude .. Thank you so much for help :)
@diegoveloper Yes
 
sure, have a good day
 
Yeah! Same 2 u :)
 

last day (15 days later) »