summaryrefslogtreecommitdiff
path: root/lib/level_selection.dart
blob: a5a9c32b0ccd71bf153b6a164fade25c7478f6f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import 'package:flutter/material.dart';

import 'level.dart';

class LevelSelection extends StatelessWidget {
  final List<String> _musicList = [
    "https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3",
    "https://www.soundhelix.com/examples/mp3/SoundHelix-Song-2.mp3",
    "https://www.soundhelix.com/examples/mp3/SoundHelix-Song-3.mp3",
  ];

  final List<String> _coverArtList = [
    "https://cdn.pixabay.com/photo/2020/05/19/13/48/cartoon-5190942_960_720.jpg",
    "https://cdn.pixabay.com/photo/2020/05/19/13/35/cartoon-5190860_960_720.jpg",
    "https://cdn.pixabay.com/photo/2020/10/23/17/52/fox-5679446_960_720.png",
  ];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Sense the Rhythm')),
      body: ListView.separated(
        itemCount: _musicList.length,
        separatorBuilder: (BuildContext context, int index) => const Divider(),
        itemBuilder: (context, index) {
          return ListTile(
            leading: Image.network(_coverArtList[index]),
            trailing: Icon(Icons.play_arrow),
            title: Text('Track ${index + 1}'),
            subtitle: Text('3:45'),
            onTap: () => Navigator.push(context,
                MaterialPageRoute(builder: (BuildContext context) => Level())),
          );
        },
      ),
      floatingActionButton:
          FloatingActionButton(onPressed: () => {}, child: Icon(Icons.add)),
    );
  }
}