小编Ant*_*nov的帖子

为什么只有 ListView.builder() 中的内容不滚动?

我有一个带有 Text 小部件和 ListView 的屏幕,当我尝试在 ListView 内滚动时,它不允许我滚动。

我的身体是 SingleChildScrollView 但它没有为 ListView.builder 提供滚动视图。我试图将 ListView.build 包装在 Expanded 中,但没有成功。

class HomePageState extends State<HomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: new AppBar(
          title: Text("MyBar"),
          centerTitle: true,
        ),
        body: SingleChildScrollView(child: Column(
          children: <Widget>[
            Text(
                "Information"),
            Container(
                child: ListView.builder(
                    scrollDirection: Axis.vertical,
                    shrinkWrap: true,
                    itemCount: widget.match.players.length,
                    itemBuilder: (context, index) {
                      return Column(
                        children: <Widget>[
                          Card(
                              child: ListTile(
                            leading: CircleAvatar(
                              radius: 30.0,
                              foregroundColor: 
                                Theme.of(context).primaryColor,
                              backgroundColor: Colors.grey,
                              backgroundImage: 
                          CachedNetworkImageProvider("url"),
                            ),
                            title: new Row(
                                mainAxisAlignment:
                                    MainAxisAlignment.spaceBetween,
                                children: …
Run Code Online (Sandbox Code Playgroud)

flutter flutter-layout flutter-listview flutter-widget

4
推荐指数
1
解决办法
4624
查看次数

Flutter socket.io 连接到 nodejs socket.io

这是我的服务器

class ChatbotServer {
  private http: Server;
  private io: socketIo.Server;

  constructor(app: express.Application, private nluService: NluService, private loggerService: LoggerService) {
    this.http = createServer(app);
    this.io = socketIo(this.http);

    this.setupSocketIo();
  }

  private setupSocketIo() {
    this.io.on("connection", socket => {
      new ChatSocketConnection(socket, this.nluService, this.loggerService);
    });
  }

  listen() {
    this.http.listen(port, () => console.log(`socket.io listening on port ${port}`));
  }
}
Run Code Online (Sandbox Code Playgroud)

这是我的颤振客户

class MySocketApp extends StatefulWidget {
  @override
  _MySocketAppState createState() => _MySocketAppState();
}

enum ConnectionStatus { connected, disconnected }

class _MySocketAppState extends State<MySocketApp> {
  SocketIOManager manager = SocketIOManager();
  SocketIO …
Run Code Online (Sandbox Code Playgroud)

node.js socket.io dart flutter

2
推荐指数
1
解决办法
5051
查看次数