Update youtube plugin, and switch to flutter_webview for inline web views
This commit is contained in:
parent
24f5f8487d
commit
6e5a715283
@ -1,6 +1,6 @@
|
|||||||
import 'package:wonders/common_libs.dart';
|
import 'package:wonders/common_libs.dart';
|
||||||
import 'package:wonders/ui/common/controls/app_loading_indicator.dart';
|
import 'package:wonders/ui/common/controls/app_loading_indicator.dart';
|
||||||
// import 'package:youtube_player_iframe/youtube_player_iframe.dart';
|
import 'package:youtube_player_iframe/youtube_player_iframe.dart';
|
||||||
|
|
||||||
class FullscreenVideoViewer extends StatefulWidget {
|
class FullscreenVideoViewer extends StatefulWidget {
|
||||||
const FullscreenVideoViewer({Key? key, required this.id}) : super(key: key);
|
const FullscreenVideoViewer({Key? key, required this.id}) : super(key: key);
|
||||||
@ -11,46 +11,44 @@ class FullscreenVideoViewer extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _FullscreenVideoViewerState extends State<FullscreenVideoViewer> {
|
class _FullscreenVideoViewerState extends State<FullscreenVideoViewer> {
|
||||||
|
late final _controller = YoutubePlayerController.fromVideoId(
|
||||||
|
videoId: widget.id,
|
||||||
|
params: const YoutubePlayerParams(showFullscreenButton: true),
|
||||||
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) => Placeholder();
|
void initState() {
|
||||||
// late final _controller = YoutubePlayerController.fromVideoId(
|
super.initState();
|
||||||
// videoId: widget.id,
|
appLogic.supportedOrientationsOverride = [Axis.horizontal, Axis.vertical];
|
||||||
// params: const YoutubePlayerParams(showFullscreenButton: true),
|
}
|
||||||
// );
|
|
||||||
//
|
@override
|
||||||
// @override
|
void dispose() {
|
||||||
// void initState() {
|
// when view closes, remove the override
|
||||||
// super.initState();
|
appLogic.supportedOrientationsOverride = null;
|
||||||
// appLogic.supportedOrientationsOverride = [Axis.horizontal, Axis.vertical];
|
super.dispose();
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @override
|
@override
|
||||||
// void dispose() {
|
Widget build(BuildContext context) {
|
||||||
// // when view closes, remove the override
|
double aspect = context.isLandscape ? MediaQuery.of(context).size.aspectRatio : 9 / 9;
|
||||||
// appLogic.supportedOrientationsOverride = null;
|
return Scaffold(
|
||||||
// super.dispose();
|
backgroundColor: Colors.black,
|
||||||
// }
|
body: YoutubePlayerScaffold(
|
||||||
//
|
controller: _controller,
|
||||||
// @override
|
aspectRatio: aspect,
|
||||||
// Widget build(BuildContext context) {
|
builder: (_, player) => Stack(
|
||||||
// double aspect = context.isLandscape ? MediaQuery.of(context).size.aspectRatio : 9 / 9;
|
children: [
|
||||||
// return Scaffold(
|
player,
|
||||||
// backgroundColor: Colors.black,
|
SafeArea(
|
||||||
// body: YoutubePlayerScaffold(
|
child: Padding(
|
||||||
// controller: _controller,
|
padding: EdgeInsets.all($styles.insets.md),
|
||||||
// aspectRatio: aspect,
|
child: const BackBtn(),
|
||||||
// builder: (_, player) => Stack(
|
),
|
||||||
// children: [
|
),
|
||||||
// player,
|
],
|
||||||
// SafeArea(
|
),
|
||||||
// child: Padding(
|
),
|
||||||
// padding: EdgeInsets.all($styles.insets.md),
|
);
|
||||||
// child: const BackBtn(),
|
}
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,22 @@
|
|||||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
import 'package:webview_flutter/webview_flutter.dart';
|
||||||
import 'package:wonders/common_libs.dart';
|
import 'package:wonders/common_libs.dart';
|
||||||
|
|
||||||
class FullscreenWebView extends StatelessWidget {
|
class FullscreenWebView extends StatelessWidget {
|
||||||
const FullscreenWebView(this.url, {Key? key}) : super(key: key);
|
FullscreenWebView(this.url, {Key? key}) : super(key: key);
|
||||||
final String url;
|
final String url;
|
||||||
|
|
||||||
|
late final controller = WebViewController()
|
||||||
|
..setJavaScriptMode(JavaScriptMode.unrestricted)
|
||||||
|
..setBackgroundColor(const Color(0x00000000))
|
||||||
|
..loadRequest(Uri.parse(url));
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return SafeArea(
|
return SafeArea(
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
appBar: AppBar(),
|
appBar: AppBar(),
|
||||||
body: InAppWebView(
|
body: WebViewWidget(
|
||||||
initialUrlRequest: URLRequest(url: Uri.parse(url)),
|
controller: controller,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
90
pubspec.lock
90
pubspec.lock
@ -165,10 +165,10 @@ packages:
|
|||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: collection
|
name: collection
|
||||||
sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0
|
sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.17.0"
|
version: "1.17.1"
|
||||||
convert:
|
convert:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -339,14 +339,6 @@ packages:
|
|||||||
description: flutter
|
description: flutter
|
||||||
source: sdk
|
source: sdk
|
||||||
version: "0.0.0"
|
version: "0.0.0"
|
||||||
flutter_inappwebview:
|
|
||||||
dependency: "direct main"
|
|
||||||
description:
|
|
||||||
name: flutter_inappwebview
|
|
||||||
sha256: "43319594a48b298b77c8ed9d2c91b83cbcb2bcb7c09761b33203eca58abaca7e"
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "5.7.2"
|
|
||||||
flutter_lints:
|
flutter_lints:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description:
|
description:
|
||||||
@ -616,10 +608,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: js
|
name: js
|
||||||
sha256: "5528c2f391ededb7775ec1daa69e65a2d61276f7552de2b5f7b8d34ee9fd4ab7"
|
sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.6.5"
|
version: "0.6.7"
|
||||||
js_wrapping:
|
js_wrapping:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -664,10 +656,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: matcher
|
name: matcher
|
||||||
sha256: "16db949ceee371e9b99d22f88fa3a73c4e59fd0afed0bd25fc336eb76c198b72"
|
sha256: c94db23593b89766cda57aab9ac311e3616cf87c6fa4e9749df032f66f30dcb8
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.12.13"
|
version: "0.12.14"
|
||||||
material_color_utilities:
|
material_color_utilities:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -680,10 +672,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: meta
|
name: meta
|
||||||
sha256: "6c268b42ed578a53088d834796959e4a1814b5e9e164f147f580a386e5decf42"
|
sha256: "12307e7f0605ce3da64cf0db90e5fcab0869f3ca03f76be6bb2991ce0a55e82b"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.8.0"
|
version: "1.9.0"
|
||||||
mime:
|
mime:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -768,10 +760,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: path
|
name: path
|
||||||
sha256: db9d4f58c908a4ba5953fcee2ae317c94889433e5024c27ce74a37f94267945b
|
sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.8.2"
|
version: "1.8.3"
|
||||||
path_drawing:
|
path_drawing:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -1141,10 +1133,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: test_api
|
name: test_api
|
||||||
sha256: ad540f65f92caa91bf21dfc8ffb8c589d6e4dc0c2267818b4cc2792857706206
|
sha256: "6182294da5abf431177fccc1ee02401f6df30f766bc6130a0852c6b6d7ee6b2d"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.4.16"
|
version: "0.4.18"
|
||||||
timing:
|
timing:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -1189,10 +1181,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: url_launcher
|
name: url_launcher
|
||||||
sha256: "3c92b0efb5e9dcb8f846aefabf9f0f739f91682ed486b991ceda51c288e60896"
|
sha256: e8f2efc804810c0f2f5b485f49e7942179f56eabcfe81dce3387fec4bb55876b
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "6.1.7"
|
version: "6.1.9"
|
||||||
url_launcher_android:
|
url_launcher_android:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -1269,10 +1261,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: vm_service
|
name: vm_service
|
||||||
sha256: e7fb6c2282f7631712b69c19d1bff82f3767eea33a2321c14fa59ad67ea391c7
|
sha256: "2277c73618916ae3c2082b6df67b6ebb64b4c69d9bf23b23700707952ac30e60"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "9.4.0"
|
version: "10.1.2"
|
||||||
watcher:
|
watcher:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -1293,10 +1285,42 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: webdriver
|
name: webdriver
|
||||||
sha256: ef67178f0cc7e32c1494645b11639dd1335f1d18814aa8435113a92e9ef9d841
|
sha256: "3c923e918918feeb90c4c9fdf1fe39220fa4c0e8e2c0fffaded174498ef86c49"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.0.1"
|
version: "3.0.2"
|
||||||
|
webview_flutter:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: webview_flutter
|
||||||
|
sha256: f7ec234830f86d0ef2bd664e8460b0038b8c1a83ff076035cad74ac70273753c
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "4.0.2"
|
||||||
|
webview_flutter_android:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: webview_flutter_android
|
||||||
|
sha256: da98c8cdaebea4cf89481853f37ca93ccc8d31fc386f5b3c928aea3b6e83268c
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "3.3.0"
|
||||||
|
webview_flutter_platform_interface:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: webview_flutter_platform_interface
|
||||||
|
sha256: "8b2262dda5d26eabc600a7282a8c16a9473a0c765526afb0ffc33eef912f7968"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.1"
|
||||||
|
webview_flutter_wkwebview:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: webview_flutter_wkwebview
|
||||||
|
sha256: dcd9ad0ef0f608f399d7a54d0b289597385e59a89f04983a672b9348faddfd98
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "3.1.0"
|
||||||
win32:
|
win32:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -1333,10 +1357,18 @@ packages:
|
|||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: youtube_player_iframe
|
name: youtube_player_iframe
|
||||||
sha256: "2c680672c96c3f4ae583ed4fac8e6a1abbf736e598c814db3f0fcf8ac1b86df7"
|
sha256: d7aec9083430db4e5da83a3b5d7b7fcbb93cfa027d9f680ce3c7e7cd20724305
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.3.0"
|
version: "4.0.4"
|
||||||
|
youtube_player_iframe_web:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: youtube_player_iframe_web
|
||||||
|
sha256: c7020816031600349b56d2729d4e8be011fcb723ff7dc2dd0cdf72096a0e5ff4
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.2"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=2.18.0 <4.0.0"
|
dart: ">=2.19.0 <4.0.0"
|
||||||
flutter: ">=3.0.0"
|
flutter: ">=3.0.0"
|
||||||
|
@ -23,7 +23,7 @@ dependencies:
|
|||||||
flutter_animate: ^1.0.0
|
flutter_animate: ^1.0.0
|
||||||
flutter_circular_text: ^0.3.1
|
flutter_circular_text: ^0.3.1
|
||||||
flutter_displaymode: ^0.4.0
|
flutter_displaymode: ^0.4.0
|
||||||
flutter_inappwebview: ^5.7.1
|
# flutter_inappwebview: ^5.7.1
|
||||||
flutter_native_splash: ^2.2.7
|
flutter_native_splash: ^2.2.7
|
||||||
flutter_staggered_grid_view: ^0.6.2
|
flutter_staggered_grid_view: ^0.6.2
|
||||||
flutter_svg: ^1.1.4
|
flutter_svg: ^1.1.4
|
||||||
@ -52,7 +52,8 @@ dependencies:
|
|||||||
sized_context: ^1.0.0+1
|
sized_context: ^1.0.0+1
|
||||||
smooth_page_indicator: ^1.0.0+2
|
smooth_page_indicator: ^1.0.0+2
|
||||||
unsplash_client: ^2.1.0+3
|
unsplash_client: ^2.1.0+3
|
||||||
# youtube_player_iframe: 4.0.4
|
webview_flutter: ^4.0.2
|
||||||
|
youtube_player_iframe: 4.0.4
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
build_runner: ^2.2.0
|
build_runner: ^2.2.0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user