Skip to content

Commit

Permalink
Fixed UI and Removed screenUtil Dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
kaungsatthe1n committed Mar 18, 2022
1 parent 3cc10b5 commit 750168c
Show file tree
Hide file tree
Showing 29 changed files with 270 additions and 200 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

## Download App

- #### Android : [Download TakoPlay.apk](https://github.com/kaungsatthe1n/Tako-Play/releases/download/v1.4.3/TakoPlay-1.4.3.apk)
- #### Android : [Download TakoPlay.apk](https://github.com/kaungsatthe1n/Tako-Play/releases/download/v1.5.1/TakoPlay-v1.5.1.apk)

- #### IOS : _Coming soon ..._

Expand Down
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.tako_play"
minSdkVersion 19
minSdkVersion 20
targetSdkVersion 31
multiDexEnabled true
versionCode flutterVersionCode.toInteger()
Expand Down
Binary file added assets/gif/anime-cry.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 4 additions & 7 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:logging/logging.dart';
import 'package:provider/provider.dart';
Expand Down Expand Up @@ -46,17 +45,15 @@ class MyApp extends StatelessWidget {
dispose: (_, RequestService service) => service.client.dispose(),
),
],
child: ScreenUtilInit(
designSize: const Size(360, 764),
builder: () => GetMaterialApp(
child:
GetMaterialApp(
debugShowCheckedModeBanner: false,
title: 'TakoPlay',
theme: TakoTheme.dark(),
initialRoute: '/',
initialBinding: ManagerBinding(),
getPages: TakoRoute.pages,
),
),
);
));

}
}
4 changes: 4 additions & 0 deletions lib/models/anime.dart
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ final List<Genre> genreList = [
name: 'Horror',
link: HORROR,
),
Genre(
name: 'Josei',
link: JOSEI,
),
Genre(
name: 'Kids',
link: KIDS,
Expand Down
23 changes: 4 additions & 19 deletions lib/screens/about_app_screen.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:url_launcher/url_launcher.dart';
import '../utils/constants.dart';
import '../widgets/tako_scaffold.dart';
import '../widgets/update_alert_dialog.dart';

class AboutAppScreen extends StatelessWidget {
const AboutAppScreen({Key? key}) : super(key: key);
Expand Down Expand Up @@ -37,7 +37,7 @@ class AboutAppScreen extends StatelessWidget {
Get.dialog(const AlertDialog(
backgroundColor: tkDarkBlue,
content: Text(
'(-) Ui Changes in Recently Added Anime List.\n\n(-) Fixed Duplicate Recently Watched Anime.'),
'(--) New Features ~~~ \n\n(-) Added Preferred video quality.\n\n(-) Added Genre to Filter Animes.\n\n(-) Added new icon for (Sub) and (Dub).\n\n(-) Pressing on a genre of the anime will take you to the page with list of anime with that genre. \n\n(--) Minor Changes ~~~ \n\n(-) Fixed Laggy Animation and Added Animation to some UI.\n\n(-) Fixed Layout Error in Big Screen Device.\n\n(-) Black Screen Issue In WebView Player. '),
));
},
),
Expand All @@ -49,23 +49,8 @@ class AboutAppScreen extends StatelessWidget {
content: Text('No Update Available'),
));
} else {
Get.dialog(AlertDialog(
backgroundColor: tkDarkBlue,
content: SizedBox(
height: (screenHeight * .15).h,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text('New Update is Available\n'),
MaterialButton(
elevation: 5,
color: tkLightGreen.withAlpha(200),
child: const Text('Update'),
onPressed: () => launch(updateLink.toString())),
],
),
),
));
Get.dialog(
UpdateAlertDialog(downloadLink: updateLink.toString()));
}
},
title: const Text('Check For Update '),
Expand Down
5 changes: 2 additions & 3 deletions lib/screens/genre_screen.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart';

Expand Down Expand Up @@ -67,9 +66,9 @@ class _GenreScreenState extends State<GenreScreen>

return GridView.builder(
padding: EdgeInsets.symmetric(
horizontal: 20.w, vertical: 20.h),
horizontal: 20, vertical: 20),
gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(
childAspectRatio: .53,
childAspectRatio: .56,
crossAxisSpacing: 30,
mainAxisSpacing: 40,
maxCrossAxisExtent: 220,
Expand Down
31 changes: 14 additions & 17 deletions lib/screens/home_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ import 'dart:convert';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart';

import '../helpers/network_manager.dart';
import '../models/anime.dart';
import '../models/github.dart';
Expand All @@ -14,7 +12,6 @@ import '../services/anime_service.dart';
import '../services/request_service.dart';
import '../theme/tako_theme.dart';
import '../utils/constants.dart';
import '../utils/tako_helper.dart';
import '../widgets/movie_card.dart';
import '../widgets/popular_anime_card.dart';
import '../widgets/recently_added_anime_card.dart';
Expand Down Expand Up @@ -104,19 +101,19 @@ class _HomeScreenState extends State<HomeScreen>
children: [
Container(
margin: EdgeInsets.symmetric(
horizontal: 20.w, vertical: 20.h),
horizontal: 20, vertical: 20),
child: Row(
children: [
Text(
'Popular',
style:
TakoTheme.darkTextTheme.headline4!.copyWith(
color: tkLightGreen,
color: Colors.white,
),
),
Padding(
padding:
EdgeInsets.symmetric(horizontal: 20.w),
EdgeInsets.symmetric(horizontal: 20),
child: const Icon(
Icons.local_fire_department_sharp,
color: Colors.orange,
Expand All @@ -129,7 +126,7 @@ class _HomeScreenState extends State<HomeScreen>
height: 300,
child: ListView.builder(
physics: const BouncingScrollPhysics(),
padding: EdgeInsets.symmetric(horizontal: 10.w),
padding: EdgeInsets.symmetric(horizontal: 10),
scrollDirection: Axis.horizontal,
itemCount: popularList!.length,
itemBuilder: (BuildContext context, int index) {
Expand Down Expand Up @@ -159,22 +156,22 @@ class _HomeScreenState extends State<HomeScreen>
),
Container(
margin: EdgeInsets.only(
top: 10.h,
left: 20.w,
right: 20.w,
bottom: 20.h,
top: 10,
left: 20,
right: 20,
bottom: 20,
),
child: Row(
children: [
Text(
'Recently Added ',
style:
TakoTheme.darkTextTheme.headline4!.copyWith(
color: tkLightGreen,
color: Colors.white,
),
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 20.w),
padding: EdgeInsets.symmetric(horizontal: 20),
child: const Icon(
Icons.bubble_chart_rounded,
color: Color(0xFF58E6DE),
Expand All @@ -188,7 +185,7 @@ class _HomeScreenState extends State<HomeScreen>
height: 300,
child: ListView.builder(
physics: const BouncingScrollPhysics(),
padding: EdgeInsets.symmetric(horizontal: 10.w),
padding: EdgeInsets.symmetric(horizontal: 10),
scrollDirection: Axis.horizontal,
itemCount: recentlyAdded!.length,
itemBuilder: (BuildContext context, int index) {
Expand Down Expand Up @@ -218,18 +215,18 @@ class _HomeScreenState extends State<HomeScreen>
),
Container(
margin: EdgeInsets.symmetric(
horizontal: 20.w, vertical: 20.h),
horizontal: 20, vertical: 20),
child: Row(
children: [
Text(
'Movies',
style:
TakoTheme.darkTextTheme.headline4!.copyWith(
color: tkLightGreen,
color: Colors.white,
),
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 20.w),
padding: EdgeInsets.symmetric(horizontal: 20),
child: const Icon(
Icons.movie_creation_sharp,
color: Color(0xFFF5EB64),
Expand Down
57 changes: 38 additions & 19 deletions lib/screens/media_fetch_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import '../services/anime_service.dart';
import '../theme/tako_theme.dart';
import '../utils/constants.dart';
import '../utils/routes.dart';

import '../utils/tako_helper.dart';
import '../widgets/tako_play_web_view.dart';

class MediaFetchScreen extends StatefulWidget {
const MediaFetchScreen({Key? key}) : super(key: key);
Expand Down Expand Up @@ -71,7 +72,8 @@ class _MediaFetchScreenState extends State<MediaFetchScreen> {
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
return SizedBox.fromSize(
size: Size(screenWidth / 1.5, screenHeight / 1.5),
size: Size(MediaQuery.of(context).size.width / 1.5,
MediaQuery.of(context).size.height / 1.5),
child: TakoPlayWebView(
initialUrl: 'https:${snapshot.data}',
onLoadingFinished: (_webViewController) async {
Expand All @@ -89,13 +91,19 @@ class _MediaFetchScreenState extends State<MediaFetchScreen> {
String rawUrl = await _webViewController
.runJavascriptReturningResult(
"document.getElementsByClassName('jw-video jw-reset')[0].attributes.src.value;");
if (rawUrl == 'null') {
for (var i = 0; i < 8; i++) {
rawUrl = await _webViewController
.runJavascriptReturningResult(
"document.getElementsByClassName('jw-video jw-reset')[0].attributes.src.value;");
}
if (rawUrl == 'null' ||
!rawUrl
.contains(RegExp(r'(.)[0-9]+(p.mp4)'))) {
hasError.value = true;
} else {
String url = rawUrl.split('"').toList()[1];

// takoDebugPrint(await _webViewController.runJavascriptReturningResult('document.documentElement.outerHTML;'));
await _webViewController

.runJavascriptReturningResult(
"if(document.getElementsByClassName('jw-icon jw-icon-display jw-button-color jw-reset')[0].ariaLabel == 'Play'){document.getElementsByClassName('jw-icon jw-icon-display jw-button-color jw-reset')[0].click();}");
String resolutionCount = await _webViewController
Expand All @@ -121,16 +129,14 @@ class _MediaFetchScreenState extends State<MediaFetchScreen> {
'.${quality}p.mp4'));
}
for (var qlt in _qualityList) {
takoDebugPrint(mediaFetchController.defaultQuality);
if (mediaFetchController.defaultQuality
.contains(qlt)) {

_filteredUrl = url.replaceAll(
RegExp(r'(.)[0-9]+(p.mp4)'),
'.${qlt}p.mp4');
}
}
takoDebugPrint('Filter Url : $_filteredUrl');
// takoDebugPrint('Filter Url : $_filteredUrl');
if (_filteredUrl != '') {
await Get.offNamed(Routes.videoPlayerScreen,
arguments: {
Expand Down Expand Up @@ -158,25 +164,34 @@ class _MediaFetchScreenState extends State<MediaFetchScreen> {
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
'assets/gif/anime${1 + _random.nextInt(25)}.gif',
width: 350,
height: 200,
Obx(
() => Image.asset(
hasError.value
? 'assets/gif/anime-cry.gif'
: 'assets/gif/anime${1 + _random.nextInt(25)}.gif',
width: 350,
height: 200,
),
),
SizedBox(
height: screenHeight * .10,
height: 20,
),
Text(
'Please Wait ...',
style: TakoTheme.darkTextTheme.bodyText1,
Obx(
() => Visibility(
visible: !hasError.value,
child: Text(
'Please Wait ...',
style: TakoTheme.darkTextTheme.bodyText1,
),
),
),
Obx(
() => Visibility(
visible: hasError.value,
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 20),
child: Text(
'Loading too slow ?',
'Episode can\'t be fetch',
style: TakoTheme.darkTextTheme.headline3,
),
),
Expand All @@ -198,8 +213,12 @@ class _MediaFetchScreenState extends State<MediaFetchScreen> {
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15),
),
color: tkLightGreen,
child: const Text('Continue with WebView Player'),
color: tkGradientBlue,
child: Text(
'Continue with WebView Player',
style: TakoTheme.darkTextTheme.headline3!
.copyWith(fontSize: 17.0),
),
),
),
),
Expand Down
3 changes: 1 addition & 2 deletions lib/screens/no_internet_screen.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';

import '../helpers/network_manager.dart';
import '../theme/tako_theme.dart';
import '../utils/constants.dart';
Expand Down Expand Up @@ -42,7 +41,7 @@ class NoInternetScreen extends StatelessWidget {
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15),
),
color: tkLightGreen,
color: tkGradientBlue,
child: const Text('Try Again'),
),
],
Expand Down
2 changes: 1 addition & 1 deletion lib/screens/recent_list_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class RecentListScreen extends StatelessWidget {
direction: DismissDirection.endToStart,
background: const Icon(
Icons.delete_rounded,
color: tkLightGreen,
color: tkGradientBlue,
),
child: RecentAnimeCard(
id: recentWatchManager.animeList[index].id,
Expand Down
Loading

0 comments on commit 750168c

Please sign in to comment.