【发布时间】:2021-12-04 08:15:32
【问题描述】:
我正在尝试从 dribble 开发一个 App 创意的克隆,可以在 here 找到。
你能告诉我我要写的代码是否正确吗? 当我尝试使用包含在容器中的两个文本小部件(单独)包装一列时,当我尝试更改一个容器的宽度时,它也会更改另一个容器的边距。
我的代码是:-
class HomeScreen extends StatelessWidget {
const HomeScreen({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: Column(
children: [
Container(
margin: const EdgeInsets.only(top: 30, left: 20),
child: const Text(
'Find Intrested Events to Join',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 30.0,
wordSpacing: 2,
),
),
width: 200,
),
// -----------------------------------------------------------------
Container(
margin: EdgeInsets.only(left: 20, top: 20),
width: 220,
child: Text(
'We share all events like Charity, workshop, Blood drive, etc.',
style: TextStyle(wordSpacing: 2, height: 1.4),
),
)
],
),
),
);
你能告诉我如何达到那个阶段,我可以改变容器的宽度而不影响其他人的边距。
【问题讨论】:
标签: flutter dart flutter-layout