Browse Source

image pre cached |view controller inited

ff_new
Loki 3 years ago
parent
commit
a631a134ed
  1. 27
      ios/Podfile.lock
  2. 5
      ios/Runner.xcodeproj/project.pbxproj
  3. 2
      ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
  4. 29
      lib/community/community_page.dart
  5. 51
      lib/community/community_view/community_dynamic.dart
  6. 3
      lib/community/photo_view_gallery_screen.dart

27
ios/Podfile.lock

@ -143,9 +143,6 @@ PODS:
- mob_sharesdk/ShareSDKPlatforms/WatermelonVideo (4.4.0): - mob_sharesdk/ShareSDKPlatforms/WatermelonVideo (4.4.0):
- mob_sharesdk/ShareSDK - mob_sharesdk/ShareSDK
- MOBFoundation (>= 3.2.9) - MOBFoundation (>= 3.2.9)
- mob_sharesdk/ShareSDKPlatforms/WeChat_Lite (4.4.0):
- mob_sharesdk/ShareSDK
- MOBFoundation (>= 3.2.9)
- mob_sharesdk/ShareSDKPlatforms/WhatsApp (4.4.0): - mob_sharesdk/ShareSDKPlatforms/WhatsApp (4.4.0):
- mob_sharesdk/ShareSDK - mob_sharesdk/ShareSDK
- MOBFoundation (>= 3.2.9) - MOBFoundation (>= 3.2.9)
@ -173,7 +170,7 @@ PODS:
- SDWebImage (5.12.1): - SDWebImage (5.12.1):
- SDWebImage/Core (= 5.12.1) - SDWebImage/Core (= 5.12.1)
- SDWebImage/Core (5.12.1) - SDWebImage/Core (5.12.1)
- shared_preferences (0.0.1): - shared_preferences_ios (0.0.1):
- Flutter - Flutter
- sharesdk_plugin (1.1.2): - sharesdk_plugin (1.1.2):
- Flutter - Flutter
@ -207,12 +204,12 @@ PODS:
- mob_sharesdk/ShareSDKPlatforms/Twitter - mob_sharesdk/ShareSDKPlatforms/Twitter
- mob_sharesdk/ShareSDKPlatforms/VKontakte - mob_sharesdk/ShareSDKPlatforms/VKontakte
- mob_sharesdk/ShareSDKPlatforms/WatermelonVideo - mob_sharesdk/ShareSDKPlatforms/WatermelonVideo
- mob_sharesdk/ShareSDKPlatforms/WeChat_Lite
- mob_sharesdk/ShareSDKPlatforms/WhatsApp - mob_sharesdk/ShareSDKPlatforms/WhatsApp
- mob_sharesdk/ShareSDKPlatforms/Yixin - mob_sharesdk/ShareSDKPlatforms/Yixin
- mob_sharesdk/ShareSDKPlatforms/YouDaoNote - mob_sharesdk/ShareSDKPlatforms/YouDaoNote
- mob_sharesdk/ShareSDKRestoreScene - mob_sharesdk/ShareSDKRestoreScene
- mob_sharesdk/ShareSDKUI - mob_sharesdk/ShareSDKUI
- WechatOpenSDK_Fuck (~> 1.9.2)
- sqflite (0.0.2): - sqflite (0.0.2):
- Flutter - Flutter
- FMDB (>= 2.7.5) - FMDB (>= 2.7.5)
@ -248,7 +245,7 @@ DEPENDENCIES:
- path_provider (from `.symlinks/plugins/path_provider/ios`) - path_provider (from `.symlinks/plugins/path_provider/ios`)
- permission_handler (from `.symlinks/plugins/permission_handler/ios`) - permission_handler (from `.symlinks/plugins/permission_handler/ios`)
- scan (from `.symlinks/plugins/scan/ios`) - scan (from `.symlinks/plugins/scan/ios`)
- shared_preferences (from `.symlinks/plugins/shared_preferences/ios`) - shared_preferences_ios (from `.symlinks/plugins/shared_preferences_ios/ios`)
- sharesdk_plugin (from `.symlinks/plugins/sharesdk_plugin/ios`) - sharesdk_plugin (from `.symlinks/plugins/sharesdk_plugin/ios`)
- sqflite (from `.symlinks/plugins/sqflite/ios`) - sqflite (from `.symlinks/plugins/sqflite/ios`)
- SSZipArchive (~> 2.4.2) - SSZipArchive (~> 2.4.2)
@ -298,8 +295,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/permission_handler/ios" :path: ".symlinks/plugins/permission_handler/ios"
scan: scan:
:path: ".symlinks/plugins/scan/ios" :path: ".symlinks/plugins/scan/ios"
shared_preferences: shared_preferences_ios:
:path: ".symlinks/plugins/shared_preferences/ios" :path: ".symlinks/plugins/shared_preferences_ios/ios"
sharesdk_plugin: sharesdk_plugin:
:path: ".symlinks/plugins/sharesdk_plugin/ios" :path: ".symlinks/plugins/sharesdk_plugin/ios"
sqflite: sqflite:
@ -321,13 +318,13 @@ SPEC CHECKSUMS:
AFNetworking: 7864c38297c79aaca1500c33288e429c3451fdce AFNetworking: 7864c38297c79aaca1500c33288e429c3451fdce
BaiduMapKit: 907c6d9b74f66c3ff4741fc4b568ae0b339917f8 BaiduMapKit: 907c6d9b74f66c3ff4741fc4b568ae0b339917f8
BMKLocationKit: 097814ef672b1e57e86e6c1968d7892fb78002bf BMKLocationKit: 097814ef672b1e57e86e6c1968d7892fb78002bf
Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a
flutter_baidu_mapapi_base: 90fddba11ec4435406a7211d6ee905b4311c31db flutter_baidu_mapapi_base: 90fddba11ec4435406a7211d6ee905b4311c31db
flutter_baidu_mapapi_map: 771bf00671832b1fcddb17733518cd631529df16 flutter_baidu_mapapi_map: 771bf00671832b1fcddb17733518cd631529df16
flutter_baidu_mapapi_search: 4cffaa74e739a4114595c4f82f790e1783bb612d flutter_baidu_mapapi_search: 4cffaa74e739a4114595c4f82f790e1783bb612d
flutter_baidu_mapapi_utils: a5bd582b91ecd35be1bc45558b38f49d5684f70a flutter_baidu_mapapi_utils: a5bd582b91ecd35be1bc45558b38f49d5684f70a
flutter_bmflocation: 12f1ba91bae4b16d78d4f475023e0254ed351f1c flutter_bmflocation: 12f1ba91bae4b16d78d4f475023e0254ed351f1c
fluwx: c192ef1ea3617badb813fa1a761ffc5c9c12208a fluwx: 02670633ce7509206f62b366e9734e7dda81e100
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
image_pickers: 5e6ec7083f9363d014c0fb061f1b9cd97bb5e451 image_pickers: 5e6ec7083f9363d014c0fb061f1b9cd97bb5e451
mob_sharesdk: c771f001e00739d24301a9fa250247601efe7a3c mob_sharesdk: c771f001e00739d24301a9fa250247601efe7a3c
@ -337,17 +334,17 @@ SPEC CHECKSUMS:
permission_handler: ccb20a9fad0ee9b1314a52b70b76b473c5f8dab0 permission_handler: ccb20a9fad0ee9b1314a52b70b76b473c5f8dab0
scan: aea35bb4aa59ccc8839c576a18cd57c7d492cc86 scan: aea35bb4aa59ccc8839c576a18cd57c7d492cc86
SDWebImage: 4dc3e42d9ec0c1028b960a33ac6b637bb432207b SDWebImage: 4dc3e42d9ec0c1028b960a33ac6b637bb432207b
shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d shared_preferences_ios: aef470a42dc4675a1cdd50e3158b42e3d1232b32
sharesdk_plugin: 5a59e49d2d5e55c8e8f67cc9ddf05172c2494a6b sharesdk_plugin: 31d5b9be9522985da8e3a90ff73f6e12e62f9049
sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904 sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904
SSZipArchive: e7b4f3d9e780c2acc1764cd88fbf2de28f26e5b2 SSZipArchive: e7b4f3d9e780c2acc1764cd88fbf2de28f26e5b2
thumbnails: bb4f4e9bb4b51c8ae4e6ad9a2fa81373f9b634ad thumbnails: df4b2db0d4030d134e7665da9c3060b0d78726fe
TPNS-iOS: 57a146496858ba2fb5d43e5f240feb19243b69cb TPNS-iOS: 57a146496858ba2fb5d43e5f240feb19243b69cb
tpns_flutter_plugin: a366649c8ad71f19dfb864d3c994ed0480b69daa tpns_flutter_plugin: a366649c8ad71f19dfb864d3c994ed0480b69daa
url_launcher: 6fef411d543ceb26efce54b05a0a40bfd74cbbef url_launcher: 6fef411d543ceb26efce54b05a0a40bfd74cbbef
video_player: 9cc823b1d9da7e8427ee591e8438bfbcde500e6e video_player: ecd305f42e9044793efd34846e1ce64c31ea6fcb
wakelock: d0fc7c864128eac40eba1617cb5264d9c940b46f wakelock: d0fc7c864128eac40eba1617cb5264d9c940b46f
webview_flutter: 3603125dfd3bcbc9d8d418c3f80aeecf331c068b webview_flutter: 5fb4def2bbd4339889ee14d045b605cefc5bc232
WechatOpenSDK_Fuck: aa8f4b0af902837e887a1d40c62f06c060c1dc98 WechatOpenSDK_Fuck: aa8f4b0af902837e887a1d40c62f06c060c1dc98
ZLPhotoBrowser-objc: c7657d3bc85ae231884e058d0e3638f619164736 ZLPhotoBrowser-objc: c7657d3bc85ae231884e058d0e3638f619164736

5
ios/Runner.xcodeproj/project.pbxproj

@ -674,7 +674,7 @@
97C146E61CF9000F007C117D /* Project object */ = { 97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject; isa = PBXProject;
attributes = { attributes = {
LastUpgradeCheck = 1020; LastUpgradeCheck = 1300;
ORGANIZATIONNAME = ""; ORGANIZATIONNAME = "";
TargetAttributes = { TargetAttributes = {
97C146ED1CF9000F007C117D = { 97C146ED1CF9000F007C117D = {
@ -994,7 +994,6 @@
"-l\"flutter_baidu_mapapi_map\"", "-l\"flutter_baidu_mapapi_map\"",
"-l\"flutter_baidu_mapapi_base\"", "-l\"flutter_baidu_mapapi_base\"",
"-l\"permission_handler\"", "-l\"permission_handler\"",
"-l\"shared_preferences\"",
"-l\"sqflite\"", "-l\"sqflite\"",
"-l\"sqlite3\"", "-l\"sqlite3\"",
"-l\"video_player\"", "-l\"video_player\"",
@ -1232,7 +1231,6 @@
"-l\"flutter_baidu_mapapi_map\"", "-l\"flutter_baidu_mapapi_map\"",
"-l\"flutter_baidu_mapapi_base\"", "-l\"flutter_baidu_mapapi_base\"",
"-l\"permission_handler\"", "-l\"permission_handler\"",
"-l\"shared_preferences\"",
"-l\"sqflite\"", "-l\"sqflite\"",
"-l\"sqlite3\"", "-l\"sqlite3\"",
"-l\"video_player\"", "-l\"video_player\"",
@ -1361,7 +1359,6 @@
"-l\"flutter_baidu_mapapi_map\"", "-l\"flutter_baidu_mapapi_map\"",
"-l\"flutter_baidu_mapapi_base\"", "-l\"flutter_baidu_mapapi_base\"",
"-l\"permission_handler\"", "-l\"permission_handler\"",
"-l\"shared_preferences\"",
"-l\"sqflite\"", "-l\"sqflite\"",
"-l\"sqlite3\"", "-l\"sqlite3\"",
"-l\"video_player\"", "-l\"video_player\"",

2
ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<Scheme <Scheme
LastUpgradeVersion = "1020" LastUpgradeVersion = "1300"
version = "1.3"> version = "1.3">
<BuildAction <BuildAction
parallelizeBuildables = "YES" parallelizeBuildables = "YES"

29
lib/community/community_page.dart

@ -20,6 +20,8 @@ class _CommunityPage extends State<CommunityPage>
with SingleTickerProviderStateMixin { with SingleTickerProviderStateMixin {
TabController tabcontroller; TabController tabcontroller;
CommunityChildPage guanzhu,tuijian ;
List<String> lables = [ List<String> lables = [
"关注", "关注",
"推荐", "推荐",
@ -37,20 +39,9 @@ class _CommunityPage extends State<CommunityPage>
tabcontroller = TabController(length: lables.length, vsync: this, initialIndex: 1); tabcontroller = TabController(length: lables.length, vsync: this, initialIndex: 1);
} }
_toRelease() async {
var result = await Navigator.of(context).pushNamed('/router/release_dynamic');
// int tmpIndex = tabcontroller.index;
// setState(() {
// tabcontroller.index = (tabcontroller.index == lables.length -1)?0:tabcontroller.index+1;
// });
// setState(() {
// tabcontroller.index = tmpIndex;
// });
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
debugPrint("createState createState createState ......");
return Scaffold( return Scaffold(
appBar: MyAppBar( appBar: MyAppBar(
leading: false, leading: false,
@ -81,7 +72,7 @@ class _CommunityPage extends State<CommunityPage>
), ),
), ),
onTap: () { onTap: () {
_toRelease(); Navigator.of(context).pushNamed('/router/release_dynamic');
}, },
action: GestureDetector( action: GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
@ -107,8 +98,16 @@ class _CommunityPage extends State<CommunityPage>
}else if(e == "课程"){ }else if(e == "课程"){
return CommunityCourse(); return CommunityCourse();
} }
else { else if(e == "关注"){
return CommunityChildPage(e); if (guanzhu == null ){
guanzhu = CommunityChildPage("关注");;
}
return guanzhu;
}else if(e == "推荐"){
if (tuijian == null){
tuijian = CommunityChildPage("推荐");
}
return tuijian;
} }
}).toList(), }).toList(),
controller: tabcontroller, controller: tabcontroller,

51
lib/community/community_view/community_dynamic.dart

@ -54,7 +54,6 @@ class _CommunityDynamic extends State<CommunityDynamic> {
double height = 0; double height = 0;
ApiService apiService; ApiService apiService;
VideoPlayerController videoPlayerController;
ChewieController chewieAudioController; ChewieController chewieAudioController;
Chewie chewies; Chewie chewies;
@ -70,47 +69,10 @@ class _CommunityDynamic extends State<CommunityDynamic> {
), ),
}, },
); );
initVideo();
} }
String filePath; String filePath;
initVideo() async {
if (widget?.article?.content == null) return;
var cnt = jsonDecode(widget.article.content);
if (cnt["type"] == "video" && cnt["video"] != null) {
if (widget.isList) {
videoPlayerController = VideoPlayerController.network(
cnt["video"],
)..initialize().then((value) {});
} else {
videoPlayerController = VideoPlayerController.network(
cnt["video"],
)..initialize().then((value) {
chewieAudioController = ChewieController(
videoPlayerController: videoPlayerController,
aspectRatio: videoPlayerController.value.aspectRatio,
//
autoPlay: false,
//
looping: false,
//
allowFullScreen: true,
//
materialProgressColors: chewie.ChewieProgressColors(
playedColor: Colors.white,
handleColor: Colors.white,
backgroundColor: Colors.grey,
bufferedColor: Colors.transparent,
),
autoInitialize: true,
);
chewieAudioController.addListener(_fullScreenListener);
if (mounted) setState(() {});
});
}
}
}
//// ////
_vipFollow(followId, isFollow) async { _vipFollow(followId, isFollow) async {
@ -425,10 +387,7 @@ class _CommunityDynamic extends State<CommunityDynamic> {
cnt["video"].isNotEmpty) { cnt["video"].isNotEmpty) {
itemWidget = videoWidget( itemWidget = videoWidget(
MediaQuery.of(context).size.width - 32, MediaQuery.of(context).size.width - 32,
videoPlayerController != null MediaQuery.of(context).size.width / 2,
? (MediaQuery.of(context).size.width - 32) /
videoPlayerController.value.aspectRatio
: MediaQuery.of(context).size.width / 2,
cnt["video"].replaceAll(".mp4", "_poster.jpg"), cnt["video"].replaceAll(".mp4", "_poster.jpg"),
); );
} }
@ -455,10 +414,6 @@ class _CommunityDynamic extends State<CommunityDynamic> {
chewieAudioController = null; chewieAudioController = null;
} }
if (videoPlayerController != null) {
videoPlayerController.pause();
videoPlayerController.dispose();
}
} }
Widget videoWidget(double width, double height, src) { Widget videoWidget(double width, double height, src) {
@ -491,9 +446,7 @@ class _CommunityDynamic extends State<CommunityDynamic> {
height: double.infinity, height: double.infinity,
child: MImage( child: MImage(
src, src,
aspectRatio: videoPlayerController != null aspectRatio: width / 7 * 5,
? videoPlayerController.value.aspectRatio
: (width / 7 * 5),
fit: BoxFit.cover, fit: BoxFit.cover,
errorSrc: "assets/image/default_2_1.png", errorSrc: "assets/image/default_2_1.png",
fadeSrc: "assets/image/default_2_1.png", fadeSrc: "assets/image/default_2_1.png",

3
lib/community/photo_view_gallery_screen.dart

@ -1,3 +1,4 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:photo_view/photo_view.dart'; import 'package:photo_view/photo_view.dart';
import 'package:photo_view/photo_view_gallery.dart'; import 'package:photo_view/photo_view_gallery.dart';
@ -41,7 +42,7 @@ class _PhotoViewGalleryScreenState extends State<PhotoViewGalleryScreen> {
scrollPhysics: const BouncingScrollPhysics(), scrollPhysics: const BouncingScrollPhysics(),
builder: (BuildContext context, int index) { builder: (BuildContext context, int index) {
return PhotoViewGalleryPageOptions( return PhotoViewGalleryPageOptions(
imageProvider: NetworkImage(widget.images[index]), imageProvider: CachedNetworkImageProvider(widget.images[index]),
); );
}, },

Loading…
Cancel
Save