import 'package:flutter/material.dart'; import 'models/album.dart'; import 'repositories/album_repository.dart'; import 'services/album_service.dart'; import 'widgets/album_card.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( title: 'Music Reviewer', theme: ThemeData.dark().copyWith( colorScheme: ColorScheme.fromSeed(seedColor: Colors.purpleAccent) ), home: const MyHomePage(title: 'Music Reviewer'), ); } } class MyHomePage extends StatefulWidget { const MyHomePage({super.key, required this.title}); final String title; @override State createState() => _MyHomePageState(); } class _MyHomePageState extends State { final AlbumRepository _albumRepository = AlbumRepository(); List _albums = []; @override void initState() { super.initState(); _loadAlbums(); } Future _loadAlbums() async { _albums = await fetchAlbums(); setState(() {}); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( backgroundColor: Theme.of(context).colorScheme.inversePrimary, title: Text(widget.title), ), body: ListView.builder( itemCount: _albums.length, itemBuilder: (context, index) { final album = _albums[index]; return AlbumCard(album: album); }, ), ); } }