Skip to content

Commit

Permalink
Merge pull request #13 from jdk-21/development
Browse files Browse the repository at this point in the history
Add library screen
  • Loading branch information
jdk-21 authored Dec 18, 2023
2 parents 704fdc1 + c913888 commit 06fbad8
Show file tree
Hide file tree
Showing 16 changed files with 695 additions and 166 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -261,15 +261,20 @@ jobs:
with:
name: jellyflix-windows
path: jellyflix-windows


- uses: johnyherangi/create-release-notes@main
id: create-release-notes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
id: create_release
uses: ncipollo/release-action@v1
with:
artifacts: |
jellyflix-apk/*.apk
jellyflix-linux/*.tar.gz
jellyflix-linux/*
jellyflix-windows/*.exe
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.version.outputs.content }}
commit: ${{ github.sha }}
body: ${{ steps.create-release-notes.outputs.release-notes }}
26 changes: 26 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "jellyflix",
"request": "launch",
"type": "dart"
""
},
{
"name": "jellyflix (profile mode)",
"request": "launch",
"type": "dart",
"flutterMode": "profile"
},
{
"name": "jellyflix (release mode)",
"request": "launch",
"type": "dart",
"flutterMode": "release"
}
]
}
13 changes: 7 additions & 6 deletions lib/components/item_carousel.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:jellyflix/models/carousel_media_type.dart';
import 'package:jellyflix/models/poster_type.dart';
import 'package:jellyflix/providers/api_provider.dart';
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
Expand All @@ -10,7 +10,7 @@ class ItemCarousel extends HookConsumerWidget {
final List titleList;
final List imageList;
final List subtitleList;
final CarouselMediaType mediaType;
final PosterType posterType;
final Function(int)? onTap;
late final double width;
late final double height;
Expand All @@ -21,19 +21,19 @@ class ItemCarousel extends HookConsumerWidget {
required this.titleList,
this.title,
subtitleList,
this.mediaType = CarouselMediaType.vertical,
this.posterType = PosterType.vertical,
super.key})
: subtitleList = subtitleList ?? [];

@override
Widget build(BuildContext context, WidgetRef ref) {
final ScrollController scrollController = useScrollController();
switch (mediaType) {
case CarouselMediaType.horizontal:
switch (posterType) {
case PosterType.horizontal:
width = 250;
height = 150;
break;
case CarouselMediaType.square:
case PosterType.square:
width = 150;
height = 150;
break;
Expand Down Expand Up @@ -65,6 +65,7 @@ class ItemCarousel extends HookConsumerWidget {
child: Padding(
padding: const EdgeInsets.only(right: 12.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
width: width,
Expand Down
1 change: 0 additions & 1 deletion lib/models/carousel_media_type.dart

This file was deleted.

1 change: 1 addition & 0 deletions lib/models/poster_type.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enum PosterType { vertical, horizontal, square }
5 changes: 5 additions & 0 deletions lib/models/sort_type.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
enum SortType {
name,
premiereDate,
random,
}
6 changes: 2 additions & 4 deletions lib/screens/detail_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,7 @@ class DetailScreen extends HookConsumerWidget {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => PlayerSreen(
url:
'http://192.168.179.21:8096/videos/$itemId/master.m3u8?MediaSourceId=$itemId',
itemId: itemId,
headers:
ref.read(apiProvider).headers,
)),
Expand Down Expand Up @@ -448,8 +447,7 @@ class DetailScreen extends HookConsumerWidget {
MaterialPageRoute(
builder: (context) =>
PlayerSreen(
url:
'http://192.168.179.21:8096/videos/${item.id}/master.m3u8?MediaSourceId=${item.id}',
itemId: item.id!,
headers: ref
.read(apiProvider)
.headers,
Expand Down
1 change: 1 addition & 0 deletions lib/screens/filter_type.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enum FilterType { unplayed, played, favorites, liked }
191 changes: 112 additions & 79 deletions lib/screens/home_screen.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import 'package:jellyflix/components/item_carousel.dart';
import 'package:jellyflix/models/carousel_media_type.dart';
import 'package:jellyflix/models/poster_type.dart';
import 'package:jellyflix/providers/api_provider.dart';
import 'package:jellyflix/screens/detail_screen.dart';
import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:jellyflix/screens/library_screen.dart';
import 'package:jellyflix/screens/profile_screen.dart';

class HomeScreen extends HookConsumerWidget {
Expand All @@ -12,8 +13,18 @@ class HomeScreen extends HookConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
return Scaffold(
extendBodyBehindAppBar: true,
appBar: AppBar(
backgroundColor: Colors.transparent,
leading: IconButton(
onPressed: () {
Navigator.of(context).push(
MaterialPageRoute(builder: (context) => const LibraryScreen()));
},
icon: const Icon(Icons.video_library_outlined),
),
actions: [
IconButton(onPressed: () {}, icon: const Icon(Icons.search_rounded)),
IconButton(
onPressed: () {
Navigator.of(context).push(MaterialPageRoute(
Expand All @@ -23,84 +34,106 @@ class HomeScreen extends HookConsumerWidget {
],
),
body: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
// Continue carousel
FutureBuilder(
future: ref.read(apiProvider).getContinueWatching(),
builder: (context, snapshot) {
if (snapshot.hasData) {
return ItemCarousel(
onTap: (index) {
Navigator.of(context).push(MaterialPageRoute(
builder: (context) => DetailScreen(
itemId: snapshot.data!.items[index].id!,
)));
},
imageList: snapshot.data!.items.map((e) {
return e.id!;
}).toList(),
titleList: snapshot.data!.items.map((e) {
return e.name!;
}).toList(),
title: "Continue Watching");
} else {
return const CircularProgressIndicator();
}
}),
FutureBuilder(
future: ref.read(apiProvider).getLatestItems("movies"),
builder: (context, snapshot) {
if (snapshot.hasData) {
return ItemCarousel(
onTap: (index) {
Navigator.of(context).push(MaterialPageRoute(
builder: (context) => DetailScreen(
itemId: snapshot.data![index].id!,
)));
},
imageList: snapshot.data!.map((e) {
return e.id!;
}).toList(),
titleList: snapshot.data!.map((e) {
return e.name!;
}).toList(),
title: "Recently Added Movies",
mediaType: CarouselMediaType.vertical);
} else {
return const CircularProgressIndicator();
}
}),
FutureBuilder(
future: ref.read(apiProvider).getLatestItems("tvshows"),
builder: (context, snapshot) {
if (snapshot.hasData) {
return ItemCarousel(
onTap: (index) {
Navigator.of(context).push(MaterialPageRoute(
builder: (context) => DetailScreen(
itemId: snapshot.data![index].id!,
)));
},
imageList: snapshot.data!.map((e) {
return e.id!;
}).toList(),
titleList: snapshot.data!.map((e) {
return e.name!;
}).toList(),
title: "Recently Added Shows",
mediaType: CarouselMediaType.vertical);
} else {
return const CircularProgressIndicator();
}
}),
],
),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
height: 100,
width: double.infinity,
color: Colors.blueGrey,
child: const Text("Header"),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
//mainAxisSize: MainAxisSize.min,
children: [
// Continue carousel
FutureBuilder(
future: ref.read(apiProvider).getContinueWatching(),
builder: (context, snapshot) {
if (snapshot.hasData) {
return ItemCarousel(
onTap: (index) {
Navigator.of(context).push(MaterialPageRoute(
builder: (context) => DetailScreen(
itemId:
snapshot.data!.items[index].id!,
)));
},
imageList: snapshot.data!.items.map((e) {
return e.id!;
}).toList(),
titleList: snapshot.data!.items.map((e) {
return e.name!;
}).toList(),
subtitleList: snapshot.data!.items.map((e) {
return e.productionYear.toString();
}).toList(),
title: "Continue Watching");
} else {
return const CircularProgressIndicator();
}
}),
FutureBuilder(
future: ref.read(apiProvider).getLatestItems("movies"),
builder: (context, snapshot) {
if (snapshot.hasData) {
return ItemCarousel(
onTap: (index) {
Navigator.of(context).push(MaterialPageRoute(
builder: (context) => DetailScreen(
itemId: snapshot.data![index].id!,
)));
},
imageList: snapshot.data!.map((e) {
return e.id!;
}).toList(),
titleList: snapshot.data!.map((e) {
return e.name!;
}).toList(),
title: "Recently Added Movies",
subtitleList: snapshot.data!.map((e) {
return e.productionYear.toString();
}).toList(),
posterType: PosterType.vertical);
} else {
return const CircularProgressIndicator();
}
}),
FutureBuilder(
future: ref.read(apiProvider).getLatestItems("tvshows"),
builder: (context, snapshot) {
if (snapshot.hasData) {
return ItemCarousel(
onTap: (index) {
Navigator.of(context).push(MaterialPageRoute(
builder: (context) => DetailScreen(
itemId: snapshot.data![index].id!,
)));
},
imageList: snapshot.data!.map((e) {
return e.id!;
}).toList(),
titleList: snapshot.data!.map((e) {
return e.name!;
}).toList(),
subtitleList: snapshot.data!.map((e) {
return e.productionYear.toString();
}).toList(),
title: "Recently Added Shows",
posterType: PosterType.vertical);
} else {
return const CircularProgressIndicator();
}
}),
],
),
),
],
),
),
);
Expand Down
Loading

0 comments on commit 06fbad8

Please sign in to comment.