Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
flutter_plugin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
林生雨
flutter_plugin
Commits
971be4de
Commit
971be4de
authored
Oct 29, 2019
by
林生雨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commit :
parent
877d09a4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
99 additions
and
18 deletions
+99
-18
workspace.xml
.idea/workspace.xml
+0
-0
AlbumModel.dart
example/lib/AlbumModel/page/album/AlbumModel.dart
+74
-14
AlbumPage.dart
example/lib/AlbumModel/page/album/AlbumPage.dart
+16
-4
GengmeiFlutterPlugin.m
ios/Classes/GengmeiFlutterPlugin.m
+0
-0
ScanImagePlugn.dart
lib/ScanImagePlugn.dart
+5
-0
gengmei_flutter_plugin.dart
lib/gengmei_flutter_plugin.dart
+4
-0
No files found.
.idea/workspace.xml
View file @
971be4de
This diff is collapsed.
Click to expand it.
example/lib/AlbumModel/page/album/AlbumModel.dart
View file @
971be4de
...
...
@@ -56,19 +56,52 @@ class AlbumModel {
void
_onEvent
(
Object
event
)
{
var
map
=
(
event
as
Map
);
// var list = map[_nowDirName];
_mainValue
.
forEach
((
k
,
itemList
)
{
var
key
=
map
[
k
];
if
(
key
!=
null
)
{
for
(
int
i
=
0
;
i
<
itemList
.
length
;
i
++)
{
if
(
key
[
i
]
==
null
)
{
continue
;
if
(
_mainValue
==
null
||
_mainValue
.
length
==
0
)
{
_mainValue
=
map
;
}
else
{
_mainValue
.
forEach
((
k
,
itemList
)
{
var
key
=
map
[
k
];
if
(
key
!=
null
)
{
for
(
int
i
=
0
;
i
<
itemList
.
length
;
i
++)
{
if
(
key
[
i
]
==
null
)
{
continue
;
}
itemList
[
i
].
path
=
key
[
i
][
"path"
];
itemList
[
i
].
realPath
=
key
[
i
][
"realPath"
];
}
itemList
[
i
].
path
=
key
[
i
][
"path"
];
itemList
[
i
].
realPath
=
key
[
i
][
"realPath"
];
}
}
});
});
}
// var map = Map<String, List<dynamic>>.from(event);
//
// var newMap = Map<String, List<ScanImageItem>>();
// map.forEach((k, v) {
// var key = newMap["k"];
// if(key==null){
// newMap["k"]=new List<ScanImageItem>();
// }
// v.forEach((value){
// ScanImageItem item=new ScanImageItem();
// item.path=value["path"];
// item.isVideo=value["isVideo"]=="T"?true:false;
// item.during = value["during"] ?? "0";
// newMap["k"].add(item);
// });
// });
// _mainValue=newMap;
// var list = map[_nowDirName];
// _mainValue.forEach((k, itemList) {
// var key = map[k];
// if (key != null) {
// for (int i = 0; i < itemList.length; i++) {
// if (key[i] == null) {
// continue;
// }
// itemList[i].path = key[i]["path"];
// itemList[i].realPath = key[i]["realPath"];
// }
// }
// });
// var recordList=_mainValue[_nowDirName];
// List<ScanImageItem> tempList = new List();
// if (list != null && !list.isEmpty) {
...
...
@@ -195,11 +228,38 @@ class AlbumModel {
return
;
}
AlbumRepository
.
getInstance
().
nativeCamera
().
listen
((
data
)
{
print
(
"DATTTTTT
${data}
"
);
if
(
data
==
null
||
data
.
isEmpty
||
data
==
""
)
{
if
(
data
==
null
)
{
// Toast.show(context, "没有拍摄照片");
}
else
{
Navigator
.
pop
(
context
,
data
);
print
(
data
);
ScanImageItem
item
=
new
ScanImageItem
();
item
.
realPath
=
data
[
"realPath"
]==
null
?
null
:
data
[
"realPath"
]
as
String
;
item
.
path
=
data
[
"path"
]
as
String
;
item
.
isVideo
=
false
;
String
foldName
=
data
[
"folderName"
]
as
String
;
var
list
=
_mainValue
[
foldName
];
if
(
list
==
null
)
{
_mainValue
[
foldName
]
=
new
List
();
_mainValue
[
foldName
].
add
(
item
);
}
else
{
list
.
insert
(
0
,
item
);
}
_mainValue
[
MainDir
].
insert
(
0
,
item
);
_selectList
.
add
(
item
.
realPath
);
bool
haveIt
=
false
;
_dirList
.
forEach
((
it
)
{
if
(
it
.
dirName
==
foldName
)
{
haveIt
=
true
;
it
.
picCount
++;
}
});
if
(!
haveIt
)
{
_dirList
.
add
(
new
DirBean
(
foldName
,
1
,
File
(
item
.
path
)));
}
dirLive
.
notifyView
(
_dirList
);
albumLive
.
notifyView
(
_mainValue
[
_nowDirName
]);
// selectSizeLive.notifyView(_selectList.length + _selectVideoList.length);
// Navigator.pop(context, data);
// _selectList.add(data);
//TODO
}
...
...
example/lib/AlbumModel/page/album/AlbumPage.dart
View file @
971be4de
...
...
@@ -32,7 +32,6 @@ class AlbumState extends State<AlbumPage> {
_model
.
initScanImages
(
context
);
}
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
...
...
@@ -177,8 +176,9 @@ class AlbumState extends State<AlbumPage> {
}
int
newIndex
=
index
-
2
;
if
(
imgList
.
data
[
newIndex
]
==
null
||
imgList
.
data
[
newIndex
].
path
==
null
||
imgList
.
data
[
newIndex
].
realPath
==
null
)
{
imgList
.
data
[
newIndex
].
path
==
null
// || imgList.data[newIndex].realPath == null
)
{
return
Container
();
}
return
GestureDetector
(
...
...
@@ -204,13 +204,25 @@ class AlbumState extends State<AlbumPage> {
color:
Colors
.
grey
,
size:
25
,
),
imgList
.
data
[
newIndex
].
isVideo
?
Icon
(
Icons
.
cancel
,
color:
Colors
.
yellow
,):
Container
(),
imgList
.
data
[
newIndex
].
isVideo
?
Icon
(
Icons
.
cancel
,
color:
Colors
.
yellow
,
)
:
Container
(),
_model
.
isFullSelect
()
&&
!
_model
.
isSelect
(
newIndex
)
?
Container
(
width:
double
.
maxFinite
,
height:
double
.
maxFinite
,
color:
Colors
.
white60
,
)
:
Container
(),
imgList
.
data
[
newIndex
].
isVideo
&&
imgList
.
data
[
newIndex
].
during
!=
null
?
Text
(
imgList
.
data
[
newIndex
].
during
,
style:
TextStyle
(
fontSize:
20
,
color:
Colors
.
green
),
)
:
Container
()
],
),
...
...
ios/Classes/GengmeiFlutterPlugin.m
View file @
971be4de
This diff is collapsed.
Click to expand it.
lib/ScanImagePlugn.dart
View file @
971be4de
...
...
@@ -34,6 +34,11 @@ class ScanImagePlugn {
static
Future
<
bool
>
quitPage
(
MethodChannel
channel
)
async
{
return
await
channel
.
invokeMethod
(
"quit_page"
);
}
static
Future
<
String
>
ios_album_path
(
MethodChannel
channel
,
String
path
)
async
{
return
await
channel
.
invokeMethod
(
"IOS_IMAGE_BY_PATH"
,
{
"path"
,
path
});
}
}
class
ScanImageItem
{
...
...
lib/gengmei_flutter_plugin.dart
View file @
971be4de
...
...
@@ -23,6 +23,10 @@ class GengmeiFlutterPlugin {
return
await
ScanImagePlugn
.
nativeCamera
(
_channel
,
authority
);
}
static
Future
<
String
>
ios_album_path
(
String
path
)
async
{
return
await
ScanImagePlugn
.
ios_album_path
(
_channel
,
path
);
}
static
Future
<
bool
>
quitPage
()
async
{
return
await
ScanImagePlugn
.
quitPage
(
_channel
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment