class HomeView extends GetView<HomeController> { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text('ListView Filter'), centerTitle: true, ), body: Padding( padding: const EdgeInsets.all(10), child: Column( children: [ const SizedBox( height: 20, ), TextField( onChanged: (value) => controller.filterPlayer(value), //slanje value iz filtera decoration: const InputDecoration( labelText: 'Search', suffixIcon: Icon(Icons.search), ), ), const SizedBox( height: 20, ), Expanded( child: Obx( () => ListView.builder( itemCount: controller.foundPlayers.value.length, // da nam prikaze duzinu itemBuilder: (context, index) => ListTile( title: Text( controller.foundPlayers.value[index]['name'], // sta vadimo iz liste style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), ), subtitle: Text(controller.foundPlayers.value[index]['country']), ), ), ), ), ], ), ), ); } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter