2

I see this answer for conditional color

I am trying to do the same for padding like so

Padding( padding: const EdgeInsets.only(bottom: isLogin ? 58.0 : 10.0), ) 

it is not being accepted.

Thank you

1
  • 2
    that's because you used the keyword "const" but you're taking a variable consideration... a constant can't change. Commented Oct 13, 2020 at 20:01

1 Answer 1

3

You can use it like this:

 padding: isLogin ? EdgeInsets.only(bottom: 58.0) : EdgeInsets.only(bottom: 10.0), 

Edit:

or just remove const like this.

 padding: EdgeInsets.only(bottom: isLogin ? 58.0 : 10.0), 

You can read the usage of const from here.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you very much

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.