Flutter 为什么我不能在这里使用子数组?颤振
我上了这门课,从其中一个例子中学习并改变了Flutter 为什么我不能在这里使用子数组?颤振,flutter,layout,flutter-layout,Flutter,Layout,Flutter Layout,我上了这门课,从其中一个例子中学习并改变了 class SignUpView extends StatelessWidget { const SignUpView({Key key}) : super(key: key); @override Widget build(BuildContext context) { return Scaffold( body: Center( child: SizedBox( width: 40
class SignUpView extends StatelessWidget {
const SignUpView({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: SizedBox(
width: 400,
child: Card(
child: SignUpForm(),
),
),
),
);
}
}
但如果我想把孩子,而不是孩子,像这样
class SignUpView extends StatelessWidget {
const SignUpView({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
children: [
SizedBox(
width: 400,
child: Card(
child: SignUpForm(),
),
),
],
),
);
}
}
它表示未定义命名参数子级
如果我想在中心容器中放置多个子容器,该怎么办?中心只能有一个子容器。使用类似于
列
、行
、或列表视图
的方法,可以为中心使用多个小部件
import 'package:flutter/material.dart';
class SignUpView extends StatelessWidget {
const SignUpView({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: ListView(
children: [
SizedBox(
width: 400,
child: Card(
child: SignUpForm(),
),
),
],
),
),
);
}
}
我很高兴能帮助你。Flatter社区是令人惊奇的:染料,我想是的,有没有一个地方我可以看到一个小部件可以为所有小部件包含多少子部件,以及什么可以嵌套在什么中?