Skip to content
Snippets Groups Projects
Select Git revision
  • 1e9c71d8638b610f66fba6e0cff11c01618c36ea
  • main default
  • hsh-MOODLE_404+
  • hsh_3.10
  • master protected
  • v1.4.7
  • v1.4.6
  • v1.4.5
  • v1.4.3
  • v1.4.1
  • v1.4
  • v1.3r2
  • v1.3
  • v1.2
14 results

locallib.php

Blame
  • 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");