Click here to Skip to main content
15,569,774 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello i  am loading json from local assets file and show in listview in my flutter app anyone know how to implement searchbar  here is my code
      body: Container(
    <pre>      child: Center(
            // Use future builder and DefaultAssetBundle to load the local JSON file
            child: FutureBuilder(
                future: DefaultAssetBundle
                    .of(context)
                    .loadString('assets/hebrew.json'), builder: (context, snapshot) {
                  // Decode the JSON
                  var new_data = json.decode(snapshot.data.toString());
                  return ListView.builder(
                    // Build the ListView
                    itemBuilder: (BuildContext context, int index) {
                      return GestureDetector(
                        onTap: (){
                       _showMyDialog(new_data[index]['eng'],new_data[index]['hebrew'],new_data[index]['urdu']);
                       },
                        child: Card(
                          child: Padding(
                            padding: EdgeInsets.all(20.0),
                            child: Column(
                              crossAxisAlignment: CrossAxisAlignment.stretch,
                              children: <Widget>[
                                Text(new_data[index]['eng']),
                                SizedBox(height: 10,),
                                Text(new_data[index]['hebrew']),
                                SizedBox(height: 10,),
                                Text(new_data[index]['urdu'])
                              ],
                            ),
                          ),
                        ),
                      );
                    },
                    itemCount: new_data == null ? 0 : new_data.length,
                  );
                }),
          ),
        ))
;

What I have tried:

i tried to search on google but no result found
Posted
Updated 22-Dec-21 23:43pm

1 solution

Quote:
i tried to search on google but no result found
What did you search for? Look at this: flutter search bar example - Google Search[^].
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900