2

I'm trying to copy the tips app of Iphones. Here is the page:enter image description here

I'd like to add the text ' nouveautés' on the image of ios like on the picture. I tried like this:

Card(
            
            child: Column(
              children: <Widget>[
                Text('Nouveautés'),
                Container(
                  child: ClipRRect(
                    borderRadius: BorderRadius.circular(15.0),
                      child: Image.asset('images/ios14.png')),
                ),

              ],
            ),
            
              
            margin: EdgeInsets.only(left: 20.0, right: 20.0,top : 5.0),
            
          )

It doesn't works so I'd appreciate someone's help or idea please. Thank you in advance!

1 Answer 1

1

You can copy paste this example:

class MyWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Column(
        children: [
          Card(
            child: Container(
              height: 300,
              width: double.infinity,
              decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(15.0),
                  image: DecorationImage(
                      fit: BoxFit.cover,
                      image: AssetImage('images/ios14.png'))),
              child: Padding(
                padding: const EdgeInsets.all(10.0),
                child: Text('Nouveautés'),
              ),
            ),
            margin: EdgeInsets.only(left: 20.0, right: 20.0, top: 5.0),
          )
        ],
      ),
    );
  }
}
2
  • you can use Alignment.topLeft for Container instead of margin and set Padding
    – Dung Ngo
    Nov 16, 2020 at 3:42
  • @Reign thank you very much, do you know the way to not have a white background behind the rounded corners?
    – elios_cama
    Nov 16, 2020 at 11:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.