Merge pull request #74 from gskinnerTeam/fix/state_loss_on_android
Fix/state loss on android
This commit is contained in:
commit
aacb37575e
@ -11,10 +11,10 @@ class FullscreenVideoViewer extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _FullscreenVideoViewerState extends State<FullscreenVideoViewer> {
|
||||
late final _controller = YoutubePlayerController(
|
||||
initialVideoId: widget.id,
|
||||
params: const YoutubePlayerParams(autoPlay: true, startAt: Duration(seconds: 1)),
|
||||
)..play();
|
||||
late final _controller = YoutubePlayerController.fromVideoId(
|
||||
videoId: widget.id,
|
||||
params: const YoutubePlayerParams(showFullscreenButton: true),
|
||||
);
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@ -34,26 +34,20 @@ class _FullscreenVideoViewerState extends State<FullscreenVideoViewer> {
|
||||
double aspect = context.isLandscape ? MediaQuery.of(context).size.aspectRatio : 9 / 9;
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.black,
|
||||
body: Stack(
|
||||
children: [
|
||||
Center(
|
||||
child: AspectRatio(
|
||||
aspectRatio: aspect,
|
||||
child: Stack(
|
||||
children: [
|
||||
const Center(child: AppLoadingIndicator()),
|
||||
YoutubePlayerIFrame(controller: _controller, aspectRatio: aspect),
|
||||
],
|
||||
body: YoutubePlayerScaffold(
|
||||
controller: _controller,
|
||||
aspectRatio: aspect,
|
||||
builder: (_, player) => Stack(
|
||||
children: [
|
||||
player,
|
||||
SafeArea(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all($styles.insets.md),
|
||||
child: const BackBtn(),
|
||||
),
|
||||
),
|
||||
),
|
||||
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';
|
||||
|
||||
class FullscreenWebView extends StatelessWidget {
|
||||
const FullscreenWebView(this.url, {Key? key}) : super(key: key);
|
||||
FullscreenWebView(this.url, {Key? key}) : super(key: key);
|
||||
final String url;
|
||||
|
||||
late final controller = WebViewController()
|
||||
..setJavaScriptMode(JavaScriptMode.unrestricted)
|
||||
..setBackgroundColor(const Color(0x00000000))
|
||||
..loadRequest(Uri.parse(url));
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SafeArea(
|
||||
child: Scaffold(
|
||||
appBar: AppBar(),
|
||||
body: InAppWebView(
|
||||
initialUrlRequest: URLRequest(url: Uri.parse(url)),
|
||||
body: WebViewWidget(
|
||||
controller: controller,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
90
pubspec.lock
90
pubspec.lock
@ -165,10 +165,10 @@ packages:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: collection
|
||||
sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0
|
||||
sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.17.0"
|
||||
version: "1.17.1"
|
||||
convert:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -339,14 +339,6 @@ packages:
|
||||
description: flutter
|
||||
source: sdk
|
||||
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:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
@ -616,10 +608,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: js
|
||||
sha256: "5528c2f391ededb7775ec1daa69e65a2d61276f7552de2b5f7b8d34ee9fd4ab7"
|
||||
sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.6.5"
|
||||
version: "0.6.7"
|
||||
js_wrapping:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -664,10 +656,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: matcher
|
||||
sha256: "16db949ceee371e9b99d22f88fa3a73c4e59fd0afed0bd25fc336eb76c198b72"
|
||||
sha256: c94db23593b89766cda57aab9ac311e3616cf87c6fa4e9749df032f66f30dcb8
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.12.13"
|
||||
version: "0.12.14"
|
||||
material_color_utilities:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -680,10 +672,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: meta
|
||||
sha256: "6c268b42ed578a53088d834796959e4a1814b5e9e164f147f580a386e5decf42"
|
||||
sha256: "12307e7f0605ce3da64cf0db90e5fcab0869f3ca03f76be6bb2991ce0a55e82b"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.8.0"
|
||||
version: "1.9.0"
|
||||
mime:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -768,10 +760,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path
|
||||
sha256: db9d4f58c908a4ba5953fcee2ae317c94889433e5024c27ce74a37f94267945b
|
||||
sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.8.2"
|
||||
version: "1.8.3"
|
||||
path_drawing:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -1141,10 +1133,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: test_api
|
||||
sha256: ad540f65f92caa91bf21dfc8ffb8c589d6e4dc0c2267818b4cc2792857706206
|
||||
sha256: "6182294da5abf431177fccc1ee02401f6df30f766bc6130a0852c6b6d7ee6b2d"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.4.16"
|
||||
version: "0.4.18"
|
||||
timing:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -1189,10 +1181,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher
|
||||
sha256: "3c92b0efb5e9dcb8f846aefabf9f0f739f91682ed486b991ceda51c288e60896"
|
||||
sha256: e8f2efc804810c0f2f5b485f49e7942179f56eabcfe81dce3387fec4bb55876b
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.1.7"
|
||||
version: "6.1.9"
|
||||
url_launcher_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -1269,10 +1261,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: vm_service
|
||||
sha256: e7fb6c2282f7631712b69c19d1bff82f3767eea33a2321c14fa59ad67ea391c7
|
||||
sha256: "2277c73618916ae3c2082b6df67b6ebb64b4c69d9bf23b23700707952ac30e60"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "9.4.0"
|
||||
version: "10.1.2"
|
||||
watcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -1293,10 +1285,42 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: webdriver
|
||||
sha256: ef67178f0cc7e32c1494645b11639dd1335f1d18814aa8435113a92e9ef9d841
|
||||
sha256: "3c923e918918feeb90c4c9fdf1fe39220fa4c0e8e2c0fffaded174498ef86c49"
|
||||
url: "https://pub.dev"
|
||||
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:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -1333,10 +1357,18 @@ packages:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: youtube_player_iframe
|
||||
sha256: "2c680672c96c3f4ae583ed4fac8e6a1abbf736e598c814db3f0fcf8ac1b86df7"
|
||||
sha256: d7aec9083430db4e5da83a3b5d7b7fcbb93cfa027d9f680ce3c7e7cd20724305
|
||||
url: "https://pub.dev"
|
||||
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:
|
||||
dart: ">=2.18.0 <4.0.0"
|
||||
dart: ">=2.19.0 <4.0.0"
|
||||
flutter: ">=3.0.0"
|
||||
|
@ -23,7 +23,6 @@ dependencies:
|
||||
flutter_animate: ^1.0.0
|
||||
flutter_circular_text: ^0.3.1
|
||||
flutter_displaymode: ^0.4.0
|
||||
flutter_inappwebview: ^5.7.1
|
||||
flutter_native_splash: ^2.2.7
|
||||
flutter_staggered_grid_view: ^0.6.2
|
||||
flutter_svg: ^1.1.4
|
||||
@ -39,7 +38,6 @@ dependencies:
|
||||
internet_connection_checker: ^0.0.1+3
|
||||
intl: ^0.17.0
|
||||
json_annotation: ^4.6.0
|
||||
#modal_bottom_sheet: ^2.1.0
|
||||
package_info_plus: ^1.4.3+1
|
||||
particle_field: ^0.0.1
|
||||
path_provider: ^2.0.11
|
||||
@ -52,7 +50,8 @@ dependencies:
|
||||
sized_context: ^1.0.0+1
|
||||
smooth_page_indicator: ^1.0.0+2
|
||||
unsplash_client: ^2.1.0+3
|
||||
youtube_player_iframe: 2.3.0
|
||||
webview_flutter: ^4.0.2
|
||||
youtube_player_iframe: 4.0.4
|
||||
|
||||
dev_dependencies:
|
||||
build_runner: ^2.2.0
|
||||
|
Loading…
x
Reference in New Issue
Block a user