Commit 769772e1 authored by 林生雨's avatar 林生雨

commit album

parent fd5a2c37
...@@ -2,6 +2,7 @@ package io.flutter.plugins; ...@@ -2,6 +2,7 @@ package io.flutter.plugins;
import io.flutter.plugin.common.PluginRegistry; import io.flutter.plugin.common.PluginRegistry;
import com.taobao.idlefish.flutterboost.FlutterBoostPlugin; import com.taobao.idlefish.flutterboost.FlutterBoostPlugin;
import com.example.gengmei_flutter_plugin.GengmeiFlutterPlugin;
import io.flutter.plugins.sharedpreferences.SharedPreferencesPlugin; import io.flutter.plugins.sharedpreferences.SharedPreferencesPlugin;
import fleamarket.taobao.com.xservicekit.XserviceKitPlugin; import fleamarket.taobao.com.xservicekit.XserviceKitPlugin;
...@@ -14,6 +15,7 @@ public final class GeneratedPluginRegistrant { ...@@ -14,6 +15,7 @@ public final class GeneratedPluginRegistrant {
return; return;
} }
FlutterBoostPlugin.registerWith(registry.registrarFor("com.taobao.idlefish.flutterboost.FlutterBoostPlugin")); FlutterBoostPlugin.registerWith(registry.registrarFor("com.taobao.idlefish.flutterboost.FlutterBoostPlugin"));
GengmeiFlutterPlugin.registerWith(registry.registrarFor("com.example.gengmei_flutter_plugin.GengmeiFlutterPlugin"));
SharedPreferencesPlugin.registerWith(registry.registrarFor("io.flutter.plugins.sharedpreferences.SharedPreferencesPlugin")); SharedPreferencesPlugin.registerWith(registry.registrarFor("io.flutter.plugins.sharedpreferences.SharedPreferencesPlugin"));
XserviceKitPlugin.registerWith(registry.registrarFor("fleamarket.taobao.com.xservicekit.XserviceKitPlugin")); XserviceKitPlugin.registerWith(registry.registrarFor("fleamarket.taobao.com.xservicekit.XserviceKitPlugin"));
} }
......
...@@ -35,9 +35,9 @@ buildDir = new File(rootProject.projectDir, "../build/host") ...@@ -35,9 +35,9 @@ buildDir = new File(rootProject.projectDir, "../build/host")
dependencies { dependencies {
implementation project(':flutter') implementation project(':flutter')
implementation fileTree(dir: 'libs', include: ['*.jar']) implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1' implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.2' implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:27.1.1' implementation 'com.android.support:design:28.0.0'
androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
......
...@@ -36,5 +36,14 @@ ...@@ -36,5 +36,14 @@
<category android:name="android.intent.category.LAUNCHER"/> <category android:name="android.intent.category.LAUNCHER"/>
</intent-filter> </intent-filter>
</activity> </activity>
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="com.example.gengmei_flutter_plugin"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
</application> </application>
</manifest> </manifest>
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#import "GeneratedPluginRegistrant.h" #import "GeneratedPluginRegistrant.h"
#import <flutter_boost/FlutterBoostPlugin.h> #import <flutter_boost/FlutterBoostPlugin.h>
#import <gengmei_flutter_plugin/GengmeiFlutterPlugin.h>
#import <shared_preferences/SharedPreferencesPlugin.h> #import <shared_preferences/SharedPreferencesPlugin.h>
#import <xservice_kit/XserviceKitPlugin.h> #import <xservice_kit/XserviceKitPlugin.h>
...@@ -11,6 +12,7 @@ ...@@ -11,6 +12,7 @@
+ (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry { + (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry {
[FlutterBoostPlugin registerWithRegistrar:[registry registrarForPlugin:@"FlutterBoostPlugin"]]; [FlutterBoostPlugin registerWithRegistrar:[registry registrarForPlugin:@"FlutterBoostPlugin"]];
[GengmeiFlutterPlugin registerWithRegistrar:[registry registrarForPlugin:@"GengmeiFlutterPlugin"]];
[FLTSharedPreferencesPlugin registerWithRegistrar:[registry registrarForPlugin:@"FLTSharedPreferencesPlugin"]]; [FLTSharedPreferencesPlugin registerWithRegistrar:[registry registrarForPlugin:@"FLTSharedPreferencesPlugin"]];
[XserviceKitPlugin registerWithRegistrar:[registry registrarForPlugin:@"XserviceKitPlugin"]]; [XserviceKitPlugin registerWithRegistrar:[registry registrarForPlugin:@"XserviceKitPlugin"]];
} }
......
...@@ -18,6 +18,7 @@ Depends on all your plugins, and provides a function to register them. ...@@ -18,6 +18,7 @@ Depends on all your plugins, and provides a function to register them.
s.public_header_files = './Classes/**/*.h' s.public_header_files = './Classes/**/*.h'
s.dependency 'Flutter' s.dependency 'Flutter'
s.dependency 'flutter_boost' s.dependency 'flutter_boost'
s.dependency 'gengmei_flutter_plugin'
s.dependency 'shared_preferences' s.dependency 'shared_preferences'
s.dependency 'xservice_kit' s.dependency 'xservice_kit'
end end
// This is a generated file; do not edit or check into version control. // This is a generated file; do not edit or check into version control.
FLUTTER_ROOT=/Users/apple/Downloads/flutter FLUTTER_ROOT=/Users/apple/Downloads/flutter
FLUTTER_APPLICATION_PATH=/Users/apple/lsy/gmalpha_flutter FLUTTER_APPLICATION_PATH=/Users/apple/lsy/gmalpha_flutter
FLUTTER_TARGET=lib/main.dart FLUTTER_TARGET=/Users/apple/lsy/gmalpha_flutter/lib/main.dart
FLUTTER_BUILD_DIR=build FLUTTER_BUILD_DIR=build
SYMROOT=${SOURCE_ROOT}/../build/ios SYMROOT=${SOURCE_ROOT}/../build/ios
FLUTTER_BUILD_NAME=1.0.0 FLUTTER_BUILD_NAME=1.0.0
FLUTTER_BUILD_NUMBER=1 FLUTTER_BUILD_NUMBER=1
TRACK_WIDGET_CREATION=true
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
0523E7645C49429140A87BC8 /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F32CCBF52B4BC64C019A584D /* libPods-Runner.a */; };
741F496221355F47001E2961 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 741F495E21355F27001E2961 /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 741F496221355F47001E2961 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 741F495E21355F27001E2961 /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
741F496821356857001E2961 /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 741F496521356807001E2961 /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 741F496821356857001E2961 /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 741F496521356807001E2961 /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
74974048213559DB008C567A /* Release.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 74974046213559DB008C567A /* Release.xcconfig */; }; 74974048213559DB008C567A /* Release.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 74974046213559DB008C567A /* Release.xcconfig */; };
...@@ -35,6 +36,8 @@ ...@@ -35,6 +36,8 @@
/* End PBXCopyFilesBuildPhase section */ /* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
2C9B1AB557CD5CBC16164957 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
441FD4625C7D0900F05C9A58 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
741F495E21355F27001E2961 /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = ../.ios/Flutter/engine/Flutter.framework; sourceTree = "<group>"; }; 741F495E21355F27001E2961 /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = ../.ios/Flutter/engine/Flutter.framework; sourceTree = "<group>"; };
741F496521356807001E2961 /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = ../.ios/Flutter/App.framework; sourceTree = "<group>"; }; 741F496521356807001E2961 /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = ../.ios/Flutter/App.framework; sourceTree = "<group>"; };
74974046213559DB008C567A /* Release.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = "<group>"; }; 74974046213559DB008C567A /* Release.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = "<group>"; };
...@@ -49,6 +52,8 @@ ...@@ -49,6 +52,8 @@
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
F32CCBF52B4BC64C019A584D /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; };
F99355DD7889C1520E1503E4 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */ /* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */ /* Begin PBXFrameworksBuildPhase section */
...@@ -56,12 +61,21 @@ ...@@ -56,12 +61,21 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
0523E7645C49429140A87BC8 /* libPods-Runner.a in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
/* End PBXFrameworksBuildPhase section */ /* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */ /* Begin PBXGroup section */
37CBF6198D3E34CE197F7E29 /* Frameworks */ = {
isa = PBXGroup;
children = (
F32CCBF52B4BC64C019A584D /* libPods-Runner.a */,
);
name = Frameworks;
sourceTree = "<group>";
};
741F49642135620F001E2961 /* Config */ = { 741F49642135620F001E2961 /* Config */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
...@@ -89,6 +103,8 @@ ...@@ -89,6 +103,8 @@
9740EEB11CF90186004384FC /* Flutter */, 9740EEB11CF90186004384FC /* Flutter */,
97C146F01CF9000F007C117D /* Runner */, 97C146F01CF9000F007C117D /* Runner */,
97C146EF1CF9000F007C117D /* Products */, 97C146EF1CF9000F007C117D /* Products */,
F558CDC6611173C14623ADA6 /* Pods */,
37CBF6198D3E34CE197F7E29 /* Frameworks */,
); );
sourceTree = "<group>"; sourceTree = "<group>";
}; };
...@@ -122,6 +138,16 @@ ...@@ -122,6 +138,16 @@
name = "Supporting Files"; name = "Supporting Files";
sourceTree = "<group>"; sourceTree = "<group>";
}; };
F558CDC6611173C14623ADA6 /* Pods */ = {
isa = PBXGroup;
children = (
F99355DD7889C1520E1503E4 /* Pods-Runner.debug.xcconfig */,
441FD4625C7D0900F05C9A58 /* Pods-Runner.release.xcconfig */,
2C9B1AB557CD5CBC16164957 /* Pods-Runner.profile.xcconfig */,
);
path = Pods;
sourceTree = "<group>";
};
/* End PBXGroup section */ /* End PBXGroup section */
/* Begin PBXNativeTarget section */ /* Begin PBXNativeTarget section */
...@@ -129,12 +155,14 @@ ...@@ -129,12 +155,14 @@
isa = PBXNativeTarget; isa = PBXNativeTarget;
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
buildPhases = ( buildPhases = (
E10CBE561B0B3954E5D8AB2F /* [CP] Check Pods Manifest.lock */,
9740EEB61CF901F6004384FC /* Run Script */, 9740EEB61CF901F6004384FC /* Run Script */,
97C146EA1CF9000F007C117D /* Sources */, 97C146EA1CF9000F007C117D /* Sources */,
97C146EB1CF9000F007C117D /* Frameworks */, 97C146EB1CF9000F007C117D /* Frameworks */,
97C146EC1CF9000F007C117D /* Resources */, 97C146EC1CF9000F007C117D /* Resources */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */,
741F496321355F47001E2961 /* Embed Frameworks */, 741F496321355F47001E2961 /* Embed Frameworks */,
5BAC25529DA8134F9EC5F747 /* [CP] Embed Pods Frameworks */,
); );
buildRules = ( buildRules = (
); );
...@@ -156,6 +184,7 @@ ...@@ -156,6 +184,7 @@
TargetAttributes = { TargetAttributes = {
97C146ED1CF9000F007C117D = { 97C146ED1CF9000F007C117D = {
CreatedOnToolsVersion = 7.3.1; CreatedOnToolsVersion = 7.3.1;
DevelopmentTeam = 86R4V3XFLU;
}; };
}; };
}; };
...@@ -208,6 +237,24 @@ ...@@ -208,6 +237,24 @@
shellPath = /bin/sh; shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin";
}; };
5BAC25529DA8134F9EC5F747 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
"${PODS_ROOT}/../Flutter/engine/Flutter.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
9740EEB61CF901F6004384FC /* Run Script */ = { 9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
...@@ -222,6 +269,28 @@ ...@@ -222,6 +269,28 @@
shellPath = /bin/sh; shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
}; };
E10CBE561B0B3954E5D8AB2F /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputFileListPaths = (
);
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */ /* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */
...@@ -312,7 +381,7 @@ ...@@ -312,7 +381,7 @@
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = S8QB4VV633; DEVELOPMENT_TEAM = 86R4V3XFLU;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
...@@ -440,6 +509,7 @@ ...@@ -440,6 +509,7 @@
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = 86R4V3XFLU;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
...@@ -464,6 +534,7 @@ ...@@ -464,6 +534,7 @@
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = 86R4V3XFLU;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
...@@ -506,7 +577,6 @@ ...@@ -506,7 +577,6 @@
defaultConfigurationName = Release; defaultConfigurationName = Release;
}; };
/* End XCConfigurationList section */ /* End XCConfigurationList section */
}; };
rootObject = 97C146E61CF9000F007C117D /* Project object */; rootObject = 97C146E61CF9000F007C117D /* Project object */;
} }
...@@ -4,4 +4,7 @@ ...@@ -4,4 +4,7 @@
<FileRef <FileRef
location = "group:Runner.xcodeproj"> location = "group:Runner.xcodeproj">
</FileRef> </FileRef>
<FileRef
location = "group:Pods/Pods.xcodeproj">
</FileRef>
</Workspace> </Workspace>
/*
* @author lsy
* @date 2019-09-09
**/
import 'package:flutter/material.dart';
import 'package:gmalpha_flutter/AlbumModel/AlbumRouterImpl.dart';
import 'package:gmalpha_flutter/Annotations/RouterBaser.dart';
import 'package:gmalpha_flutter/Annotations/anno/Router.dart';
@Router("albumModel", AlbumRouterImpl)
abstract class AlbumRouter implements RouterBaser {
Widget getAlbumPage(
bool showCamera, int bigSelectImage, List<String> selectedImages);
}
/*
* @author lsy
* @date 2019-09-09
**/
import 'package:flutter/src/widgets/framework.dart';
import 'package:gmalpha_flutter/AlbumModel/AlbumRouter.dart';
import 'package:gmalpha_flutter/AlbumModel/page/album/AlbumPage.dart';
class AlbumRouterImpl implements AlbumRouter {
@override
Widget getAlbumPage(
bool showCamera, int bigSelectSize, List<String> selectedImages) {
return AlbumPage(showCamera, bigSelectSize, selectedImages);
}
}
/*
* @author lsy
* @date 2019-09-10
**/
import 'dart:io';
class DirBean {
String dirName;
File pic;
int picCount;
DirBean(this.dirName, this.pic, this.picCount);
}
/*
* @author lsy
* @date 2019-09-09
**/
import 'dart:async';
import 'dart:io';
import 'package:flutter/cupertino.dart';
import 'package:gengmei_flutter_plugin/ScanImagePlugn.dart';
import 'package:gengmei_flutter_plugin/gengmei_flutter_plugin.dart';
import 'package:gmalpha_flutter/AlbumModel/bean/DirBean.dart';
import 'package:gmalpha_flutter/AlbumModel/repository/AlbumRepository.dart';
import 'package:gmalpha_flutter/commonModel/live/BaseModel.dart';
import 'package:gmalpha_flutter/commonModel/live/LiveData.dart';
import 'package:gmalpha_flutter/commonModel/toast/toast.dart';
const String MainDir = "IsGengmeiAlbumAllImages";
const String MainDirExplain = "全部相片";
class AlbumModel extends BaseModel {
LiveData<List<ScanImageItem>> albumLive = LiveData();
LiveData<List<DirBean>> dirLive = LiveData();
LiveData<String> titleData = LiveData();
Map<String, List<ScanImageItem>> _mainValue = Map();
List<String> _selectList = List();
String _nowDirName = MainDir;
StreamSubscription _listen;
bool showCamera = true;
int _maxCount = 1;
get selectList => _selectList;
get maxCount => _maxCount;
get nowDirName {
if (_nowDirName == MainDir) {
return MainDirExplain;
} else {
return _nowDirName;
}
}
bool showPop = false;
bool isAndroid = Platform.isAndroid;
List<DirBean> _dirList = List();
get dirList => _dirList;
AlbumModel(this.showCamera, int maxCount, List<String> selectedList) {
this._maxCount = maxCount;
if (selectedList != null && !selectedList.isEmpty) {
this._selectList.clear();
this._selectList.addAll(selectedList);
}
if (isAndroid) {
_listen = GengmeiFlutterPlugin.phoneImagesEvent
.receiveBroadcastStream()
.listen(_onEvent, onError: _onError);
}
}
void _onEvent(Object event) {
var list = (event as Map)[_nowDirName];
List<ScanImageItem> tempList = new List();
if (list != null && !list.isEmpty) {
for (var item in list) {
ScanImageItem scanImageItem = new ScanImageItem();
scanImageItem.path = item["path"];
scanImageItem.size = item["size"];
scanImageItem.realPath = item["realPath"];
tempList.add(scanImageItem);
}
}
albumLive.notifyView(tempList);
}
void _onError(Object error) {
print(error);
}
void initScanImages(BuildContext context) {
AlbumRepository.getInstance().scanPhoneImg().listen((value) {
if (value != null) {
_mainValue = value;
value.forEach((key, value) {
if (key == MainDir) {
albumLive.notifyView(value);
titleData.notifyView(MainDirExplain);
_dirList.add(
DirBean(MainDirExplain, File(value[0].path), value.length));
} else {
_dirList.add(DirBean(key, File(value[0].path), value.length));
}
});
}
}).onError((error) {
Toast.show(context, error.toString());
print(error);
});
}
void changDir() {}
@override
void dispose() {
if (_listen != null) {
_listen.cancel();
}
albumLive.dispost();
dirLive.dispost();
titleData.dispost();
}
select(int index) {}
bool isSelect(int index) {
bool haveIt = false;
if (_selectList.isEmpty) {
return false;
}
_selectList.forEach((value) {
if (isAndroid) {
if (value == albumLive.data[index].realPath) {
haveIt = true;
}
} else {
if (value == albumLive.data[index].path) {
haveIt = true;
}
}
});
return haveIt;
}
bool isFullSelect() {
return _selectList.length == _maxCount;
}
void clickItem(BuildContext context, int index) {
String path;
if (isAndroid) {
path = albumLive.data[index].realPath;
} else {
path = albumLive.data[index].path;
}
if (!_selectList.contains(path)) {
if (_selectList.length >= _maxCount) {
Toast.show(context, "最多选择${_maxCount}张图片");
return;
}
_selectList.add(path);
} else {
_selectList.remove(path);
}
albumLive.notifyView(albumLive.data);
}
void onNext() {
}
void nativeCamera(BuildContext context) {
if (_selectList.length == maxCount) {
Toast.show(context, "最多选择${_maxCount}张图片");
return;
}
AlbumRepository.getInstance().nativeCamera().listen((data) {
if (data == null && data.isEmpty) {
Toast.show(context, "没有拍摄照片");
} else {
_selectList.add(data);
//TODO
}
}).onError((error) {
Toast.show(context, error);
print(error);
});
}
void AiCamera(BuildContext context) {
if (_selectList.length == maxCount) {
Toast.show(context, "最多选择${_maxCount}张图片");
return;
}
AlbumRepository.getInstance().aiCamera().listen((data) {
if (data == null && data.isEmpty) {
Toast.show(context, "没有拍摄照片");
} else {
_selectList.add(data);
//TODO
}
}).onError((error) {});
}
File getDirPic(int index) {
return File(_mainValue[_dirList[index]][0].path);
}
void changPopState() {
if (showPop) {
showPop = false;
dirLive.notifyView(null);
} else {
showPop = true;
dirLive.notifyView(_dirList);
}
titleData.notifyView(nowDirName);
}
void selectDir(int index) {
String dirName = _dirList[index].dirName;
titleData.notifyView(dirName);
if (dirName == MainDirExplain) {
dirName = MainDir;
}
_nowDirName = dirName;
dirLive.notifyView(null);
showPop = false;
albumLive.notifyView(_mainValue[dirName]);
}
}
/*
* @author lsy
* @date 2019-09-09
**/
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:gengmei_flutter_plugin/ScanImagePlugn.dart';
import 'package:gmalpha_flutter/AlbumModel/bean/DirBean.dart';
import 'package:gmalpha_flutter/AlbumModel/page/album/AlbumModel.dart';
class AlbumPage extends StatefulWidget {
AlbumModel model;
AlbumPage(bool showCamera, int maxCount, List<String> selectedList) {
model = new AlbumModel(showCamera, maxCount, selectedList);
}
@override
State<StatefulWidget> createState() => AlbumState(model);
}
class AlbumState extends State<AlbumPage> {
final AlbumModel _model;
AlbumState(this._model);
@override
void initState() {
super.initState();
_model.initScanImages(context);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
leading: GestureDetector(
onTap: () => Navigator.pop(context),
child: Center(
child: Container(
padding: EdgeInsets.fromLTRB(16, 0, 0, 0),
child: Text("取消"),
),
)),
centerTitle: true,
title: GestureDetector(
onTap: () {
_model.changPopState();
},
child: StreamBuilder<String>(
stream: _model.titleData.stream,
initialData: _model.titleData.data,
builder: (context, data) {
return Row(
children: <Widget>[
Expanded(
child: Container(),
),
data.data == null
? Text(
MainDirExplain,
style: TextStyle(fontSize: 18),
)
: Text(data.data, style: TextStyle(fontSize: 18)),
Container(
margin: EdgeInsets.fromLTRB(1, 0, 0, 0),
child: Transform(
transform: Matrix4.identity()..rotateZ(
_model.showPop?1.6:4.7
), // 旋转的角度
origin: Offset(10, 10), // 旋转的中心点
child: Icon(
Icons.chevron_right,
size: 20,
),
),
),
Expanded(
child: Container(),
),
],
);
})),
actions: <Widget>[
Center(
child: GestureDetector(
onTap: () => _model.onNext(),
child: Container(
margin: EdgeInsets.fromLTRB(0, 0, 16, 0),
child: Text(
"下一步",
style: TextStyle(fontSize: 16),
),
)))
],
),
body: Stack(
children: <Widget>[
mainView(),
popWindow(),
],
));
}
@override
void dispose() {
super.dispose();
_model.dispose();
}
mainView() {
return StreamBuilder<List<ScanImageItem>>(
stream: _model.albumLive.stream,
initialData: _model.albumLive.data,
builder:
(BuildContext context, AsyncSnapshot<List<ScanImageItem>> imgList) {
if (imgList.data == null) {
return Center(child: CircularProgressIndicator());
}
if (imgList.data != null && imgList.data.isEmpty) {
return Center(
child: Text("没有发现照片哦"),
);
}
return GridView.builder(
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3,
crossAxisSpacing: 5,
mainAxisSpacing: 5,
childAspectRatio: 1),
itemCount: imgList.data.length + 2,
itemBuilder: (BuildContext context, int index) {
if (index == 0) {
return GestureDetector(
onTap: () => _model.nativeCamera(context),
child: Container(
color: Colors.yellow,
child: Column(
children: <Widget>[
Expanded(
child: Container(),
),
Icon(Icons.camera_alt),
Container(
margin: EdgeInsets.fromLTRB(0, 5, 0, 0),
child: Text("本地相机"),
),
Expanded(
child: Container(),
),
],
)));
}
if (index == 1) {
return GestureDetector(
onTap: () => _model.AiCamera(context),
child: Container(
color: Colors.orange,
child: Column(
children: <Widget>[
Expanded(
child: Container(),
),
Icon(Icons.camera_alt),
Container(
margin: EdgeInsets.fromLTRB(0, 5, 0, 0),
child: Text("AI相机"),
),
Expanded(
child: Container(),
),
],
)));
}
int newIndex = index - 2;
if (imgList.data[newIndex] == null) {
return Icon(
Icons.photo,
size: 20,
);
}
return GestureDetector(
onTap: () => _model.clickItem(context, newIndex),
child: Container(
decoration: BoxDecoration(
image: DecorationImage(
image: FileImage(File(imgList.data[newIndex].path)),
fit: BoxFit.cover),
borderRadius: BorderRadius.all(Radius.circular(3.0))),
margin: EdgeInsets.only(left: 2, top: 2, right: 2, bottom: 2),
child: Stack(
alignment: AlignmentDirectional.topEnd,
children: <Widget>[
_model.isSelect(newIndex)
? Icon(
Icons.check_circle,
color: Colors.amberAccent,
size: 25,
)
: Icon(
Icons.check_circle_outline,
color: Colors.grey,
size: 25,
),
_model.isFullSelect() && !_model.isSelect(newIndex)
? Container(
width: double.maxFinite,
height: double.maxFinite,
color: Colors.white60,
)
: Container()
],
),
));
},
);
},
);
}
popWindow() {
return StreamBuilder<List<DirBean>>(
stream: _model.dirLive.stream,
initialData: _model.dirLive.data,
builder: (BuildContext context, AsyncSnapshot<List<DirBean>> snapshot) {
if (snapshot.data == null) {
return Container();
} else {
return Stack(
children: <Widget>[
Container(
width: double.maxFinite,
height: double.maxFinite,
color: Colors.black54,
),
popWindowList(snapshot)
],
);
}
});
}
popWindowList(AsyncSnapshot<List<DirBean>> snapshot) {
return Container(
padding: EdgeInsets.fromLTRB(16, 3, 16, 3),
color: Colors.white,
height: 280,
child: ListView.separated(
separatorBuilder: (context, index) {
return Divider();
},
itemCount: snapshot.data.length,
itemBuilder: (context, index) {
return GestureDetector(
onTap: () => _model.selectDir(index),
child: Row(
children: <Widget>[
Container(
width: 50,
height: 50,
child: Image.file(
snapshot.data[index].pic,
fit: BoxFit.cover,
),
),
Container(
padding: EdgeInsets.fromLTRB(5, 0, 0, 0),
child: Text(
"${snapshot.data[index].dirName} (${snapshot.data[index].picCount})"),
),
Expanded(
child: Container(),
),
Icon(Icons.chevron_right)
],
),
);
}));
}
}
/*
* @author lsy
* @date 2019-09-09
**/
\ No newline at end of file
/*
* @author lsy
* @date 2019-09-09
**/
import 'package:gengmei_flutter_plugin/ScanImagePlugn.dart';
import 'package:gengmei_flutter_plugin/gengmei_flutter_plugin.dart';
import 'package:rxdart/rxdart.dart';
class AlbumRepository {
AlbumRepository._();
static AlbumRepository _instance;
static AlbumRepository getInstance() {
if (_instance == null) {
_instance = AlbumRepository._();
}
return _instance;
}
Map<String, List<ScanImageItem>> _cacheList = new Map();
Observable<Map<String, List<ScanImageItem>>> scanPhoneImg() {
return Observable.fromFuture(GengmeiFlutterPlugin.phoneImages())
.map((value) {
if (value != null) {
_cacheList.clear();
_cacheList.addAll(value);
}
return value;
});
}
get cacheList => _cacheList;
void clearMemory() {
_cacheList.clear();
}
Observable<String> nativeCamera() {
return Observable.fromFuture(GengmeiFlutterPlugin.nativeCamera());
}
Observable<String> aiCamera() {
return Observable.fromFuture(GengmeiFlutterPlugin.aiCamera());
}
}
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
// RouterCenterGenerator // RouterCenterGenerator
// ************************************************************************** // **************************************************************************
import "package:gmalpha_flutter/AlbumModel/AlbumRouterImpl.dart";
import "package:gmalpha_flutter/AlbumModel/AlbumRouter.dart";
import "package:gmalpha_flutter/messageModel/MessageRouterImpl.dart"; import "package:gmalpha_flutter/messageModel/MessageRouterImpl.dart";
import "package:gmalpha_flutter/messageModel/MessageRouter.dart"; import "package:gmalpha_flutter/messageModel/MessageRouter.dart";
import "package:gmalpha_flutter/userModel/UserRouterImpl.dart"; import "package:gmalpha_flutter/userModel/UserRouterImpl.dart";
...@@ -36,6 +38,7 @@ class RouterCenterImpl { ...@@ -36,6 +38,7 @@ class RouterCenterImpl {
} }
void init() { void init() {
map.putIfAbsent("albumModel", () => AlbumRouterImpl());
map.putIfAbsent("messageModel", () => MessageRouterImpl()); map.putIfAbsent("messageModel", () => MessageRouterImpl());
map.putIfAbsent("userModel", () => UserRouterImpl()); map.putIfAbsent("userModel", () => UserRouterImpl());
} }
...@@ -44,6 +47,13 @@ class RouterCenterImpl { ...@@ -44,6 +47,13 @@ class RouterCenterImpl {
return map[modelName]; return map[modelName];
} }
AlbumRouter findAlbumRouter() {
if (map["albumModel"] == null) {
return null;
}
return map["albumModel"] as AlbumRouter;
}
MessageRouter findMessageRouter() { MessageRouter findMessageRouter() {
if (map["messageModel"] == null) { if (map["messageModel"] == null) {
return null; return null;
......
...@@ -61,7 +61,8 @@ class _MyAppState extends State<MyApp> { ...@@ -61,7 +61,8 @@ class _MyAppState extends State<MyApp> {
// return null; // return null;
// } // }
// return findMessageRouter.getMessagePage({}); // return findMessageRouter.getMessagePage({});
return RouterCenterImpl().findUserRouter()?.getUserPage(); // return RouterCenterImpl().findUserRouter()?.getUserPage();
return RouterCenterImpl().findAlbumRouter().getAlbumPage(true, 9, null);
// var findUserRouter = RouterCenterImpl().findUserRouter(); // var findUserRouter = RouterCenterImpl().findUserRouter();
// if(findUserRouter==null){ // if(findUserRouter==null){
// return null; // return null;
......
...@@ -186,6 +186,13 @@ packages: ...@@ -186,6 +186,13 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.1.18" version: "0.1.18"
gengmei_flutter_plugin:
dependency: "direct main"
description:
name: gengmei_flutter_plugin
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.0.713"
glob: glob:
dependency: transitive dependency: transitive
description: description:
......
...@@ -34,7 +34,7 @@ dependencies: ...@@ -34,7 +34,7 @@ dependencies:
# flutter_easyrefresh: ^1.2.7 # 上拉下拉刷新组件 # flutter_easyrefresh: ^1.2.7 # 上拉下拉刷新组件
# mmkv_flutter: ^1.0.10 # mmkv_flutter: ^1.0.10
flutter_boost: ^0.0.411 flutter_boost: ^0.0.411
gengmei_flutter_plugin: ^0.0.713
......
// This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility that Flutter provides. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:gmalpha_flutter/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(MyApp());
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);
// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();
// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment