I am making a code in flutter in case two list one horizontal and the other vertical, but between the lists stand a space as remove?

Asked

Viewed 35 times

0

import 'package:flutter/material.dart';

class Menu extends StatefulWidget {
  const Menu({Key? key}) : super(key: key);

  @override
  _MenuState createState() => _MenuState();
}

class _MenuState extends State<Menu> {
  var tbrin = [
    {"nome": "images/brinquedo.jpg"},
    {"nome": "images/brinquedo.jpg"},
    {"nome": "images/brinquedo.jpg"},
    {"nome": "images/brinquedo.jpg"},
  ];
  String appTitle = "Pesquise o produto";
  bool isSearchEnabled = true;
  switchSearchBarState() {
    setState(() {
      isSearchEnabled = !isSearchEnabled;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        elevation: 1,
        backgroundColor: Colors.blue.shade100,
        title: !isSearchEnabled
            ? Text(appTitle)
            : TextField(
                style: new TextStyle(
                  color: Colors.white,
                ),
                decoration: new InputDecoration(
                    border: InputBorder.none,
                    prefixIcon: new Icon(Icons.search, color: Colors.white),
                    hintText: "Procure o produto",
                    hintStyle: new TextStyle(color: Colors.white)),
              ),
      ),

      //****Menu selecionavel****//
      body: Column(
        verticalDirection: VerticalDirection.down,
        children: <Widget>[
          Expanded(
            child: SizedBox(
              child: ListView.builder(
                controller: ScrollController(),
                scrollDirection: Axis.horizontal,
                itemCount: tbrin.length,
                itemBuilder: (context, index) {
                  return Container(
                    margin: EdgeInsets.fromLTRB(10, 10, 10, 0),
                    width: 150,
                    child: Column(
                      children: <Widget>[
                        Card(
                          margin: EdgeInsets.fromLTRB(0, 0, 0, 10),
                          child: Container(
                            margin: EdgeInsets.all(0),
                            padding: EdgeInsets.all(0),
                            child: ListTile(
                              title: Image.asset(
                                tbrin[index]["nome"].toString(),
                              ),
                              subtitle: Text(
                                "Titulo",
                                textAlign: TextAlign.center,
                                style: TextStyle(
                                  fontSize: 25,
                                ),
                              ),
                            ),
                          ),
                        ),
                      ],
                    ),
                  );
                },
              ),
            ),
          ),
          Expanded(
            child: SizedBox(
              child: ListView(
                children: <Widget>[
                  Card(
                    margin: EdgeInsets.fromLTRB(0, 0, 0, 0),
                    child: Container(
                      margin: EdgeInsets.all(0),
                      padding: EdgeInsets.all(0),
                      child: ListTile(
                        title: Image.asset("images/brinquedo.jpg"),
                        subtitle: Text("Titulo",
                            textAlign: TextAlign.center,
                            style: TextStyle(
                              fontSize: 20,
                            )),
                      ),
                    ),
                  ),
                  Container(
                    width: 10,
                    child: ListTile(
                      title: Text("Titulo2",
                          textAlign: TextAlign.center,
                          style: TextStyle(
                            fontSize: 30,
                          )),
                    ),
                  ),
                ],
              ),
            ),
          )
        ],
      ),
      drawer: Drawer(
          child: ListView(children: <Widget>[
        DrawerHeader(
          child: Text('Drawer Header'),
          decoration: BoxDecoration(
            color: Colors.cyan,
          ),
        ),
        ListTile(
            leading: Icon(Icons.star),
            title: Text("Favoritos"),
            subtitle: Text("meus favoritos..."),
            trailing: Icon(Icons.arrow_forward),
            onTap: () {
              debugPrint('toquei no drawer');
            }),
      ])),
    );
  }
}

This is code over there can help me?

print da tela

1 answer

0


You are not able to join these images because you entered some spacing arguments, try to modify the margin:

EdgeInsets.fromLTRB(10, 10, 10, 0),
  • I tried to put everything 0 but still continues the space, I speak that space below the horizontal list

Browser other questions tagged

You are not signed in. Login or sign up in order to post.