屏幕没有显示出颤动

问题描述 投票:0回答:1

我有这些片段用于登录屏幕,当我在Android设备上启动应用程序时,这些代码不会显示

这里控制台上的错误I / flutter(12389):══╡通过渲染图书馆的例外情况╞═​​═══════════════════════════════════════════════════════════════════════════════════ ════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════>> 12389):BoxConstraints强制无限宽度。 I / flutter(12389):这些无效约束由I / flutter(12389)提供给RenderAnimatedOpacity的layout()函数:follow函数,它可能计算了有问题的无效约束:

    import 'package:flutter/material.dart';

class UserEmail extends StatefulWidget{
  @override
  State<StatefulWidget> createState() {
    return UserEmailState();
  }

}

class UserEmailState extends State<UserEmail> {

  final TextEditingController _emailController = new TextEditingController();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: new AppBar(
        backgroundColor: Colors.transparent,
        elevation: 0.0,
      ),

      body: ListView(
        children: <Widget>[
          Padding(
            padding: const EdgeInsets.all(16.0),
            child: SizedBox(
              child: new Row(
                children: <Widget>[
                  Text("Welcome",
                  style: TextStyle(color: Colors.black,fontWeight: FontWeight.bold
                  ),),
                  Text("A short slogan about the app...")
                ],
              ),
            ),
          ),

          Padding(
            padding: const EdgeInsets.all(24.0),
            child: SizedBox(
              child: Column(
                children: <Widget>[
                  Row(
                    children: <Widget>[
                      TextField(
                        controller: _emailController,
                        decoration: new InputDecoration(
                          labelText: "Email",
                          hintText: "Enter email address"
                        ),
                      )
                    ],
                  ),

                  Padding(
                    padding: const EdgeInsets.all(8.0),
                    child: new RaisedButton(
                        onPressed: null,
                        textColor: Colors.white,
                        color: Colors.blueGrey,
                        padding: const EdgeInsets.all(8.0),
                        child: new Text(
                            "Continue")
                    ),
                  ),
                ],
              ),
            ),
          )
        ],
      ),
    );
  }
}
flutter
1个回答
0
投票

将TextField包装在Expanded或Flexible小部件中。像这样:

            Flexible(
                      child: TextField(
                        controller: _emailController,
                        decoration: new InputDecoration(
                            labelText: "Email",
                            hintText: "Enter email address"
                        ),
                      ),
                    )
© www.soinside.com 2019 - 2024. All rights reserved.