2023-11-05 19:32:59 +01:00
|
|
|
import 'package:flutter/material.dart';
|
2023-11-06 10:38:26 +01:00
|
|
|
import 'package:release_schedule/api/movie_api.dart';
|
|
|
|
import 'package:release_schedule/api/wikidata_movie_api.dart';
|
|
|
|
import 'package:release_schedule/model/movie_manager.dart';
|
|
|
|
import 'package:release_schedule/view/movie_list.dart';
|
2023-11-05 19:32:59 +01:00
|
|
|
|
|
|
|
void main() {
|
|
|
|
runApp(const MyApp());
|
2023-11-06 10:38:26 +01:00
|
|
|
movieManager.loadUpcomingMovies();
|
2023-11-05 19:32:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
class MyApp extends StatelessWidget {
|
|
|
|
const MyApp({super.key});
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return MaterialApp(
|
2023-11-06 10:38:26 +01:00
|
|
|
title: 'Movie Schedule',
|
|
|
|
themeMode: ThemeMode.dark,
|
|
|
|
darkTheme: ThemeData.dark(useMaterial3: true),
|
2023-11-05 19:32:59 +01:00
|
|
|
theme: ThemeData(
|
|
|
|
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
|
|
|
|
useMaterial3: true,
|
|
|
|
),
|
2023-11-06 10:38:26 +01:00
|
|
|
home: HomePage(),
|
2023-11-05 19:32:59 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-11-06 10:38:26 +01:00
|
|
|
class HomePage extends StatelessWidget {
|
|
|
|
final MovieApi api = WikidataMovieApi();
|
2023-11-05 19:32:59 +01:00
|
|
|
|
2023-11-06 10:38:26 +01:00
|
|
|
HomePage({super.key});
|
2023-11-05 19:32:59 +01:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Scaffold(
|
2023-11-06 10:38:26 +01:00
|
|
|
appBar: AppBar(title: const Text("Release Schedule")),
|
|
|
|
body: AnimatedBuilder(
|
|
|
|
animation: movieManager,
|
|
|
|
// future: api.getUpcomingMovies(),
|
|
|
|
builder: (context, widget) {
|
|
|
|
return MovieList(movieManager.movies);
|
|
|
|
// var data = snapshot.data;
|
|
|
|
// if (snapshot.hasData && data != null) {
|
|
|
|
// return MovieList(data);
|
|
|
|
// } else if (snapshot.hasError) {
|
|
|
|
// return ErrorWidget(snapshot.error ?? "Something went wrong");
|
|
|
|
// }
|
|
|
|
// return const Center(child: CircularProgressIndicator());
|
|
|
|
},
|
2023-11-05 19:32:59 +01:00
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|