release_schedule/lib/main.dart

47 lines
1.2 KiB
Dart
Raw Normal View History

2023-11-05 19:32:59 +01:00
import 'package:flutter/material.dart';
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';
2023-11-08 14:43:59 +01:00
import 'package:release_schedule/view/movie_manager_list.dart';
2023-11-05 19:32:59 +01:00
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
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-08 14:43:59 +01:00
home: HomePage(movieManager),
2023-11-05 19:32:59 +01:00
);
}
}
class HomePage extends StatelessWidget {
final MovieApi api = WikidataMovieApi();
2023-11-08 14:43:59 +01:00
final MovieManager manager;
2023-11-05 19:32:59 +01:00
2023-11-08 14:43:59 +01:00
HomePage(this.manager, {super.key});
2023-11-05 19:32:59 +01:00
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text("Release Schedule")),
2023-11-08 14:43:59 +01:00
body: MovieManagerList(manager),
floatingActionButton: FloatingActionButton(
child: const Icon(Icons.refresh),
onPressed: () => manager.loadUpcomingMovies(),
2023-11-05 19:32:59 +01:00
),
);
}
}