Skip to content

Commit

Permalink
save changes to be deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
Kero-83 committed Apr 19, 2024
1 parent dbecd60 commit 4677c39
Show file tree
Hide file tree
Showing 8 changed files with 225 additions and 58 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,7 @@ app.*.map.json
/android/app/debug
/android/app/profile
/android/app/release
/lib/screens/home_screen_v2.dart
/lib/screens/movie_detail_screen.dart
/lib/services/API
/lib/services/Database helper.dart
1 change: 1 addition & 0 deletions lib/models/constants.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
const apiKey = 'f95df99b101b076c45da564f5191c26c';
5 changes: 4 additions & 1 deletion lib/models/movie.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@ class Movie {
required this.name,
required this.image,
});

factory Movie.fromMap(map) =>
Movie(name: map['title'], image: map['poster_path']);

Map<String, dynamic> toMap() => {'title': name, 'poster_path': image};
}
57 changes: 0 additions & 57 deletions lib/screens/home_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,6 @@ class HomeScreen extends StatelessWidget {
),
Row(
children: [
// IconButton(
// onPressed: () {},
// icon: Icon(
// Icons.cast,
// color: Colors.white,
// ),
// ),
IconButton(
onPressed: () {},
icon: Icon(
Expand All @@ -53,56 +46,6 @@ class HomeScreen extends StatelessWidget {
),
body: ListView(
children: [
// SizedBox(
// height: 100,
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Expanded(
// child: ElevatedButton(
// onPressed: () {},
// style: ElevatedButton.styleFrom(
// backgroundColor: Colors.transparent),
// child: const Text(
// 'TV Shows',
// style: TextStyle(
// color: Colors.white,
// fontSize: 16,
// ),
// ),
// ),
// ),
// Expanded(
// child: ElevatedButton(
// onPressed: () {},
// style: ElevatedButton.styleFrom(
// backgroundColor: Colors.transparent),
// child: const Text(
// 'Movies',
// style: TextStyle(
// color: Colors.white,
// fontSize: 16,
// ),
// ),
// ),
// ),
// Expanded(
// child: ElevatedButton(
// onPressed: () {},
// style: ElevatedButton.styleFrom(
// backgroundColor: Colors.transparent),
// child: const Text(
// 'Categories',
// style: TextStyle(
// color: Colors.white,
// fontSize: 16,
// ),
// ),
// ),
// ),
// ],
// ),
// ),
Container(
margin: EdgeInsets.fromLTRB(30, 0, 30, 0),
height: 500,
Expand Down
31 changes: 31 additions & 0 deletions lib/services/movie_servies.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import 'package:dio/dio.dart';
import 'package:movie_app/models/constants.dart';
import 'package:movie_app/models/movie.dart';

class MovieService {
final Dio dio;
MovieService(this.dio);

Future<List<Movie>> getMovies(String category) async {
try {
var response = await dio.get(
'https://api.themoviedb.org/3/movie/$category?api_key=$apiKey');

Map<String, dynamic> jsonData = response.data;

List<dynamic> moviesData = jsonData['articles'];

List<Movie> movieList = [];

for (var movieData in moviesData) {
Movie movie = Movie.fromMap(jsonData);
movieList.add(movie);
}

return movieList;
} catch (e) {
return [];
}
}

}
4 changes: 4 additions & 0 deletions macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
import FlutterMacOS
import Foundation

import path_provider_foundation
import sqflite

func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
}
177 changes: 177 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.1"
carousel_slider:
dependency: "direct main"
description:
name: carousel_slider
sha256: "9c695cc963bf1d04a47bd6021f68befce8970bcd61d24938e1fb0918cf5d9c42"
url: "https://pub.flutter-io.cn"
source: hosted
version: "4.2.1"
characters:
dependency: transitive
description:
Expand All @@ -41,6 +49,14 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.18.0"
crypto:
dependency: transitive
description:
name: crypto
sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.0.3"
cupertino_icons:
dependency: "direct main"
description:
Expand All @@ -49,6 +65,14 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.6"
dio:
dependency: "direct main"
description:
name: dio
sha256: "0978e9a3e45305a80a7210dbeaf79d6ee8bee33f70c8e542dc654c952070217f"
url: "https://pub.flutter-io.cn"
source: hosted
version: "5.4.2+1"
fake_async:
dependency: transitive
description:
Expand All @@ -57,6 +81,14 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.3.1"
ffi:
dependency: transitive
description:
name: ffi
sha256: "493f37e7df1804778ff3a53bd691d8692ddf69702cf4c1c1096a2e41b4779e21"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.2"
flutter:
dependency: "direct main"
description: flutter
Expand All @@ -75,6 +107,30 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
google_fonts:
dependency: "direct main"
description:
name: google_fonts
sha256: "5b1726fee554d1cc9db1baef8061b126567ff0a1140a03ed7de936e62f2ab98b"
url: "https://pub.flutter-io.cn"
source: hosted
version: "6.2.0"
http:
dependency: transitive
description:
name: http
sha256: "761a297c042deedc1ffbb156d6e2af13886bb305c2a343a4d972504cd67dd938"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.2.1"
http_parser:
dependency: transitive
description:
name: http_parser
sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b"
url: "https://pub.flutter-io.cn"
source: hosted
version: "4.0.2"
leak_tracker:
dependency: transitive
description:
Expand Down Expand Up @@ -139,6 +195,70 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.9.0"
path_provider:
dependency: transitive
description:
name: path_provider
sha256: c9e7d3a4cd1410877472158bee69963a4579f78b68c65a2b7d40d1a7a88bb161
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.3"
path_provider_android:
dependency: transitive
description:
name: path_provider_android
sha256: "51f0d2c554cfbc9d6a312ab35152fc77e2f0b758ce9f1a444a3a1e5b8f3c6b7f"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.2.3"
path_provider_foundation:
dependency: transitive
description:
name: path_provider_foundation
sha256: "5a7999be66e000916500be4f15a3633ebceb8302719b47b9cc49ce924125350f"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.3.2"
path_provider_linux:
dependency: transitive
description:
name: path_provider_linux
sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.2.1"
path_provider_platform_interface:
dependency: transitive
description:
name: path_provider_platform_interface
sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.2"
path_provider_windows:
dependency: transitive
description:
name: path_provider_windows
sha256: "8bc9f22eee8690981c22aa7fc602f5c85b497a6fb2ceb35ee5a5e5ed85ad8170"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.2.1"
platform:
dependency: transitive
description:
name: platform
sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec"
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.1.4"
plugin_platform_interface:
dependency: transitive
description:
name: plugin_platform_interface
sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.8"
sky_engine:
dependency: transitive
description: flutter
Expand All @@ -152,6 +272,22 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.10.0"
sqflite:
dependency: "direct main"
description:
name: sqflite
sha256: "5ce2e1a15e822c3b4bfb5400455775e421da7098eed8adc8f26298ada7c9308c"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.3.3"
sqflite_common:
dependency: transitive
description:
name: sqflite_common
sha256: "3da423ce7baf868be70e2c0976c28a1bb2f73644268b7ffa7d2e08eab71f16a4"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.5.4"
stack_trace:
dependency: transitive
description:
Expand All @@ -176,6 +312,14 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.2.0"
synchronized:
dependency: transitive
description:
name: synchronized
sha256: "539ef412b170d65ecdafd780f924e5be3f60032a1128df156adad6c5b373d558"
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.1.0+1"
term_glyph:
dependency: transitive
description:
Expand All @@ -192,6 +336,14 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.6.1"
typed_data:
dependency: transitive
description:
name: typed_data
sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.3.2"
vector_math:
dependency: transitive
description:
Expand All @@ -208,5 +360,30 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "13.0.0"
web:
dependency: transitive
description:
name: web
sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27"
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.5.1"
win32:
dependency: transitive
description:
name: win32
sha256: "0a989dc7ca2bb51eac91e8fd00851297cfffd641aa7538b165c62637ca0eaa4a"
url: "https://pub.flutter-io.cn"
source: hosted
version: "5.4.0"
xdg_directories:
dependency: transitive
description:
name: xdg_directories
sha256: faea9dee56b520b55a566385b84f2e8de55e7496104adada9962e0bd11bcff1d
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.4"
sdks:
dart: ">=3.3.0 <4.0.0"
flutter: ">=3.13.0"
4 changes: 4 additions & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ dependencies:
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.6
dio: ^5.4.2+1
google_fonts: ^6.2.0
sqflite: ^2.3.3
carousel_slider: ^4.2.1

dev_dependencies:
flutter_test:
Expand Down

0 comments on commit 4677c39

Please sign in to comment.