[英]how i can change place of ElevatedButton
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
backgroundColor: Colors.white,
leading: const Icon(Icons.home),
automaticallyImplyLeading: true,
title: const Text('test app'),
foregroundColor: Colors.black,
actions: [
IconButton(
onPressed: () {},
icon: const Icon(Icons.menu),
),
],
),
body: Container(
child: Column(
children: [
Row(
children: [
const Text(
'New',
style: TextStyle(
color: Colors.black54,
fontSize: 40,
fontWeight: FontWeight.bold,
fontStyle: FontStyle.italic,
height: 2,
shadows: [
Shadow(color: Colors.black12, offset: Offset(4, 10))
]),
),
ElevatedButton.icon(onPressed: (){}, icon: Icon(Icons.navigate_next),label: Text(' '),
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(Colors.grey),
),
),
],
),
Row(),
],
),
),
),
);
}
There are 4 options u can use depending on what you want您可以根据需要使用 4 个选项
If u want it below new u can use Column instead of Row.如果你想要它低于新的你可以使用 Column 而不是 Row。
If u want to put some space next to new u can use SizedBox(width:X) between the Text and the elevated button.如果你想在新的旁边放置一些空间,你可以在文本和提升的按钮之间使用 SizedBox(width:X) 。
You can use mainAxisAlignment or crossAxisAlignment inside the row or column to customize the position you can find examples about them here https://docs.flutter.dev/development/ui/layout您可以在行或列内使用 mainAxisAlignment 或 crossAxisAlignment 来自定义 position 您可以在此处找到有关它们的示例https://docs.flutter.dev/development/ui/layout
you can use margin or padding on elevated button to customize its own position您可以在提升按钮上使用边距或填充来自定义其自己的 position
use the Row widget properties for laying out its childrens使用 Row 小部件属性来布置其子元素
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [....]
)
the official docs are helpful in that matter https://api.flutter.dev/flutter/widgets/Row-class.html官方文档在这方面很有帮助https://api.flutter.dev/flutter/widgets/Row-class.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.