问题

Waiting for another flutter command to release the startup lock...
  • 关闭AndroidStudio,打开任务管理器‘Activity Monitor’,删除多余的dart 进程。

快捷键打开控制日志面版 command+4
Packages get 卡住的问题。

https://flutter.dev/community/china

使用Listview和GridView出现以下错误

image.png

那么需要使用Flexible 包裹ListView

 @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Flexible(child: GridView(
      gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3,crossAxisSpacing: 10),
      children: <Widget>[
        Icon(Icons.ac_unit),
        Icon(Icons.map),
        Icon(Icons.nature),
        Icon(Icons.school),
        Icon(Icons.home),
        Icon(Icons.delete),
      ],
    ),
    );
  }

InkWell 使用问题

image.png
    Container(
      alignment: Alignment.topCenter,
      child: Material(
        child: InkWell(
          child: Hero(
              tag: "avatar",
              child: ClipOval(
                child: Image.asset(
                  "images/splash_bg.jpg",
                  width: 50,
                ),
              )),
          onTap: () {
            Navigator.push(context, PageRouteBuilder(pageBuilder:
                (BuildContext context, Animation<double> animation,
                Animation<double> secondaryAnimation) {
              return FadeTransition(
                opacity: animation,
                child: Scaffold(
//                title: Text("原图"),
                  body: HeroAnimationRouteB(),
                ),
              );
            }));
          },
        ),
      ),
      );

需要用一个Material包裹。

如果没有显示Widget,可能是忘记return Widget。

创建Dialog没反应,应在在StatefulWidget 中创建,在StateLessWidget中创建没作用。

image.png

表示当前不能使用 StateFullWidget

导航切换时,返回上一个页面黑屏

使用调用的Widget的context

class MessageForm extends StatefulWidget {
  final parentContext ;
  MessageForm(this.parentContext,{Key key}) :super(key :key)
  ...
}
class MessageFormState extends State<MessageForm> {
      ...
        InkWell(
          onTap: () {
            var msg =
            Message(textInput.text, DateTime
                .now()
                .millisecondsSinceEpoch);
            print(msg);
            return Navigator.pop(widget.parentContext);
          },
        ...
          ),
        )
      ],
    );
  }
}

setState()表示Widget重新build一次。

Unhandled Exception: SocketException: Failed to create server socket (OS Error: Permission denied, errno = 13), address = 0.0.0.0, port = 40

image.png

如果网络权限都加了的话,还出现这个问题,那就要换个端口号。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容