Skip to content
Snippets Groups Projects
Select Git revision
  • 1c16579d68652ed259c04660b39d3f20cbb40060
  • master default protected
  • version2
  • update_bulma_fontawesome
  • privacy_notification
  • specify_target_asset_app
  • v2.2.24
  • v2.3.0
  • v2.2.23
  • v2.2.22
  • v2.2.21
  • v2.2.20
  • v2.2.19
  • v2.2.18
  • v2.2.17
  • v2.2.16
  • v2.2.15
  • v2.2.14
  • v2.2.13
  • v2.2.12
  • v2.2.11
  • v2.2.10
  • v2.2.9
  • v2.2.8
  • v2.2.7
  • v2.2.6
26 results

README.md

Blame
  • To learn more about this project, read the wiki.
    searchpage.dart 2.25 KiB
    import 'package:flutter/material.dart';
    
    import 'dart:developer';
    
    import 'package:ambient/homepage.dart';
    import 'package:ambient/services/spotify.dart';
    import 'package:flutter/material.dart';
    
    class StateSearcgPage extends StatefulWidget {
      const StateSearcgPage({super.key});
    
      @override
      State<StateSearcgPage> createState() => SearchPage();
    }
    
    class SearchPage extends State<StateSearcgPage> {
      final controller = TextEditingController();
      Spotify spotifyApi = Spotify();
      final List<Song> songs = List.empty(growable: true);
    
      @override
      Widget build(BuildContext context) {
        return Scaffold(
            body: Padding(
                padding: const EdgeInsets.all(10.0),
                child: Column(
                  children: [
                    const SizedBox(
                      height: 20,
                    ),
                    TextField(
                      onChanged: (value) {
                        updateList(value);
                        setState(() {
                          log(songs.length.toString());
                          songs;
                        });
                      },
                      decoration: const InputDecoration(
                          labelText: 'Search', suffixIcon: Icon(Icons.search)),
                    ),
                    const SizedBox(
                      height: 20,
                    ),
                    Expanded(
                      child: ListView.builder(
                          itemCount: songs.length,
                          itemBuilder: ((context, index) {
                            Song song = songs[index];
    
                            return Card(
                              child: Padding(
                                padding: const EdgeInsets.all(10),
                                child: Row(
                                  children: [
                                    Text(song.id),
                                    Text(song.name),
                                    Text(song.artist)
                                  ],
                                ),
                              ),
                            );
                          })),
                    )
                  ],
                )));
      }
    
      updateList(String searchedString) async {
        log("abb");