Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter: A Card with a CircleAvatar, which stick out

Tags:

flutter

dart

I want to make a card with a CircleAvatar, which stick out (you can see the details in this picture):

Card

I don't know, how it could work :/ I tried something with a Stack and the Positioned Widget, but it didn't work...

like image 308
CodingBrain Avatar asked Jul 14 '18 21:07

CodingBrain


People also ask

How do you make a big avatar circle flutter?

To change the avatar size, you can use radius property. There are two other properties related to size: minRadius and maxRadius . The are used to set the minimum and maximum radius respectively. If you alredy use radius , you are not allowed to use minRadius and/or maxRadius .


1 Answers

Stack indeed is the solution.

enter image description here

Stack(
  children: <Widget>[
    Card(
      margin: const EdgeInsets.only(top: 20.0),
      child: SizedBox(
          height: 100.0,
          width: double.infinity,
          child: Padding(
            padding: const EdgeInsets.only(top: 45.0),
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.center,
              children: <Widget>[
                Text(
                  "Foo",
                  style: Theme.of(context).textTheme.subhead,
                ),
                Text("bar")
              ],
            ),
          )),
    ),
    Positioned(
      top: .0,
      left: .0,
      right: .0,
      child: Center(
        child: CircleAvatar(
          radius: 30.0,
          child: Text("D"),
        ),
      ),
    )
  ],
),
like image 56
Rémi Rousselet Avatar answered Oct 04 '22 06:10

Rémi Rousselet