Я хочу сделать экран в Flutter, но не очень хорошо, как размещать объекты, еще не удается понять rows/columns. У меня есть текст в центре и ниже два Icons, но эти Icons не выровнены в колонне. Любая подсказка я была бы большой помощи.
return Scaffold(
appBar: AppBar(
title: Text('Alerta'),
),
body: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors:[ const Color(0xFFfcaeae),const Color(0xFFfcf3e6)] )
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('DANGER', style:TextStyle(fontSize: 50.0,color: Colors.red[300],fontWeight:FontWeight.bold),
),
InkWell(
child: Align(
alignment: Alignment.topLeft,
child: Padding(
padding: EdgeInsets.all(12.0),
child: new IconButton(icon: new Icon(Icons.call),
iconSize:90.0,
onPressed:(){print('Telefono Clickeado');} ,
),
)
)),
InkWell(
child: Align(
alignment: Alignment.topRight,
child: Padding(
padding: EdgeInsets.all(12.0),
child: new IconButton(icon: new Icon(Icons.location_on),
iconSize:90.0,
onPressed:(){Navigator.push(context, MaterialPageRoute(builder: (context)=> DeliveryScreen()),);},
),
)
)
),
],
),
)
);
Простое изменение для того, чтобы ты смог получать ее alineaciГіn, который ты желаешь, состоит в том, чтобы помещать твои кнопки в один Row
, Row
состоит контейнер элементов в горизонтальном, в отличие от Column
, которые он вертикальный.
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
InkWell(
child: Align(
alignment: Alignment.topLeft,
child: Padding(
padding: EdgeInsets.all(12.0),
child: new IconButton(
icon: new Icon(Icons.call),
iconSize: 90.0,
onPressed: () {
print('Telefono Clickeado');
},
),
))),
InkWell(
child: Align(
alignment: Alignment.topRight,
child: Padding(
padding: EdgeInsets.all(12.0),
child: new IconButton(
icon: new Icon(Icons.location_on),
iconSize: 90.0,
onPressed: () {
/*Navigator.push(
context,
MaterialPageRoute(
builder: (context) => DeliveryScreen()),
);*/
},
),
))),
],
),
я рекомендую Тебе проверять widgets layout этого соединения: https://flutter.dev/docs/development/ui/widgets/layout