Reputation: 77
Hello i have some problem with my flutter design
i want to make a box with rounded border using container
and on the top of this box i want to make a text and text looks like this
but when i wrote the code the text is cannot be up look like this
this is my code
height: 440.0,
color: Colors.transparent,
child: new Container(
decoration: new BoxDecoration(
color: Colors.blue,
borderRadius: new BorderRadius.only(
topLeft: const Radius.circular(40.0),
topRight: const Radius.circular(40.0),
)),
child: new Center(
child: Padding(
padding: EdgeInsets.symmetric(vertical: 0),
child: Text('Email'),
),
),
),
)
Upvotes: 1
Views: 172
Reputation: 382
Try this:
new Container(
alignment: Alignment.topCenter,
decoration: new BoxDecoration(
color: Colors.blue,
borderRadius: new BorderRadius.only(
topLeft: const Radius.circular(40.0),
topRight: const Radius.circular(40.0),
),
),
Upvotes: 1
Reputation: 12565
Just use Align
for keeping always on head.
Container(
decoration: new BoxDecoration(
color: Colors.blue,
borderRadius: new BorderRadius.only(
topLeft: const Radius.circular(40.0),
topRight: const Radius.circular(40.0),
)),
child: new Align(
alignment: Alignment.topCenter,
child: Padding(
padding: EdgeInsets.symmetric(vertical: 0),
child: Text('Email'),
),
),
),
output:
Upvotes: 2