flutter listview don't working on browser

163 Views Asked by At

Listview on browser not working don't show but on phone working done

On a phone that actually works, it renders but on emulator don't working listview.builder

I'm not sure where the problem is

But sometimes some phones don't display either

I tried many ways and still not working

I tried different methods shown on mobile but still on browser it still doesn't work

This is image on browser

enter image description here

This is code

  return Scaffold(
  appBar: CustomAppBar(),
  body: Column(
    children: <Widget>[
      Container(
        padding: EdgeInsets.all(10.0),
        child: Card(
          child: ListTile(
            leading: Icon(Icons.search),
            title: TextField(
              controller: controller,
              onChanged: onSearch,
              decoration: InputDecoration(
                  hintText: "กรอกชื่อลูกค้า / รหัสลูกค้า / เบอร์โทรศัพท์",
                  border: InputBorder.none),
            ),
            trailing: IconButton(
              onPressed: () {
                controller.clear();
                onSearch('');
              },
              icon: Icon(Icons.cancel),
            ),
          ),
        ),
      ),
      loading
          ? Center(
              child: CircularProgressIndicator(),
            )
          : Expanded(
              child: _search.length != 0 || controller.text.isNotEmpty
                  ? ListView.builder(
                      itemCount: _search.length,
                      itemBuilder: (context, index) {
                        final b = _search[index];
                        return Card(
                          child: Container(
                              child: Column(
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: <Widget>[
                              ListTile(
                                title: Text(
                                  b.name!,
                                  style: TextStyle(
                                      fontWeight: FontWeight.normal,
                                      fontSize: 18.0,
                                      fontFamily: 'supermarket'),
                                ),
                                subtitle: Text(b.custnum!,
                                    style: TextStyle(
                                        fontWeight: FontWeight.normal,
                                        fontSize: 16.0,
                                        fontFamily: 'supermarket')),
                                onTap: () {
                                  Navigator.pop(
                                      context,
                                      MaterialPageRoute(
                                          builder: (context) =>
                                              MainPage()));
                                },
                              ),
                            ],
                          )),
                        );
                      },
                    )
                  : ListView.builder(
                      itemCount: _list.length,
                      itemBuilder: (context, index) {
                        final a = _list[index];
                        return Card(
                          child: Container(
                              child: Column(
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: <Widget>[
                              ListTile(
                                title: Text(
                                  a.name!,
                                  style: TextStyle(
                                      fontWeight: FontWeight.normal,
                                      fontSize: 18.0,
                                      fontFamily: 'supermarket'),
                                ),
                                subtitle: Text(a.custnum!,
                                    style: TextStyle(
                                        fontWeight: FontWeight.normal,
                                        fontSize: 16.0,
                                        fontFamily: 'supermarket')),
                                onTap: () {},
                              ),
                            ],
                          )),
                        );
                      }),
0

There are 0 best solutions below