Stepan
Stepan

Reputation: 1141

Flutter - get rid of shadow on iOS

I have a Flutter app and I am testing it on iOS. I found that below picture there is shadow (and padding) - picture below. The main problem is padding on the right and on the left.

Does anybody know how to ged rid of it?

Code:

return Row(
  mainAxisAlignment: MainAxisAlignment.center,
  children: <Widget>[
    roundedImage("assets/images/avatar.png"),
    Column(
        mainAxisAlignment: MainAxisAlignment.center,
        crossAxisAlignment: CrossAxisAlignment.start,
        children: <Widget>[
          Text("XXXXXX",
              style: Theme.of(context)
                  .textTheme
                  .display2
                  .copyWith(fontSize: 20.0)),
          Text("YYYYY",
              style: Theme.of(context)
                  .textTheme
                  .display4
                  .copyWith(fontSize: 14.0)),
        ]),
    Text("ZZZZZ",
        style: Theme.of(context)
            .textTheme
            .display4
            .copyWith(fontSize: 16.0, fontWeight: FontWeight.normal))
  ],
);


 Widget roundedImage(String path) {
    return Material(
     shape: CircleBorder(),
     color: Colors.transparent,
     child: Image.asset('assets/images/xxx.png', width: imageSize, height: 
     imageSize)
 );

Picture: The avatar has a shadow

Upvotes: 1

Views: 405

Answers (2)

Viren V Varasadiya
Viren V Varasadiya

Reputation: 27157

you can use Property of Row widget To do So if i am not wrong. use mainAxisSize: MainAxisSize.min, to remove padding from both sides.

Widget roundedImage(String path) {
    return CircleAvatar(
      backgroundImage: AssetImage("images/c1.jpeg"),
      radius: 50.0,
    );
  }

Upvotes: 1

Jake
Jake

Reputation: 2056

This wouldn't get rid of the shadow, but a good way to mask it would be to change the shadowColor to transparent.

This is how that would look;

 Widget roundedImage(String path) {
    return Material(
     shape: CircleBorder(),
     color: Colors.transparent,
     shadowColor: Colors.transparent,
     child: Image.asset('assets/images/xxx.png', width: imageSize, height: 
     imageSize)
 );

Upvotes: 1

Related Questions