Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
gmalpha_flutter
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
mobile
gmalpha_flutter
Commits
0a4e2416
Commit
0a4e2416
authored
Oct 24, 2019
by
林生雨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commit
parent
049544f6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
101 additions
and
64 deletions
+101
-64
AlbumModel.dart
lib/AlbumModel/page/album/AlbumModel.dart
+20
-3
AlbumPage.dart
lib/AlbumModel/page/album/AlbumPage.dart
+74
-54
TestPage.dart
lib/TestPage.dart
+1
-1
main.dart
lib/main.dart
+6
-6
No files found.
lib/AlbumModel/page/album/AlbumModel.dart
View file @
0a4e2416
...
...
@@ -24,6 +24,8 @@ class AlbumModel extends BaseModel {
LiveData
<
List
<
DirBean
>>
dirLive
=
LiveData
();
LiveData
<
String
>
titleData
=
LiveData
();
LiveData
<
int
>
backLive
=
LiveData
();
Map
<
String
,
List
<
ScanImageItem
>>
_mainValue
=
Map
();
List
<
String
>
_selectList
=
List
();
String
_nowDirName
=
MainDir
;
...
...
@@ -93,7 +95,6 @@ class AlbumModel extends BaseModel {
if
(
value
!=
null
)
{
_mainValue
=
value
;
value
.
forEach
((
key
,
eachValue
)
{
print
(
"VALUE!!!
$key
"
);
if
(
eachValue
!=
null
&&
!
eachValue
.
isEmpty
)
{
if
(
key
==
MainDir
)
{
titleData
.
notifyView
(
MainDirExplain
);
...
...
@@ -120,6 +121,8 @@ class AlbumModel extends BaseModel {
if
(
_listen
!=
null
)
{
_listen
.
cancel
();
}
selectSizeLive
.
dispost
();
backLive
.
dispost
();
albumLive
.
dispost
();
dirLive
.
dispost
();
titleData
.
dispost
();
...
...
@@ -212,7 +215,7 @@ class AlbumModel extends BaseModel {
void
changPopState
()
{
if
(
showPop
)
{
showPop
=
false
;
dirLive
.
notifyView
(
null
);
dirLive
.
notifyView
(
_dirList
);
}
else
{
showPop
=
true
;
dirLive
.
notifyView
(
_dirList
);
...
...
@@ -227,8 +230,22 @@ class AlbumModel extends BaseModel {
dirName
=
MainDir
;
}
_nowDirName
=
dirName
;
dirLive
.
notifyView
(
null
);
changPopState
(
);
showPop
=
false
;
albumLive
.
notifyView
(
_mainValue
[
dirName
]);
}
void
backAnim
(
double
dy
)
{
if
(
dy
<
0.2
)
{
backLive
.
notifyView
(
null
);
return
;
}
String
alp
=
"
${(dy.abs() * (99)).toInt()}
"
;
if
(
alp
.
length
==
1
)
{
alp
=
"0
$alp
"
;
}
String
colorString
=
"0x
${alp}
000000"
;
print
(
colorString
);
backLive
.
notifyView
(
int
.
parse
(
colorString
));
}
}
lib/AlbumModel/page/album/AlbumPage.dart
View file @
0a4e2416
...
...
@@ -26,10 +26,11 @@ class AlbumPage extends StatefulWidget {
class
AlbumState
extends
State
<
AlbumPage
>
with
SingleTickerProviderStateMixin
{
final
AlbumModel
_model
;
String
colorString
=
"0x00000000"
;
AlbumState
(
this
.
_model
);
Animation
<
double
>
animation
;
Animation
<
Offset
>
animation
;
AnimationController
controller
;
@override
...
...
@@ -37,17 +38,22 @@ class AlbumState extends State<AlbumPage> with SingleTickerProviderStateMixin {
super
.
initState
();
_model
.
initScanImages
(
context
);
controller
=
new
AnimationController
(
duration:
const
Duration
(
milliseconds:
2000
),
vsync:
this
);
animation
=
new
Tween
(
begin:
0.0
,
end:
1.0
).
animate
(
controller
)
..
addListener
(()
{
print
(
"LISTEN!!
${animation.value}
"
);
});
duration:
const
Duration
(
milliseconds:
300
),
vsync:
this
);
animation
=
new
Tween
(
begin:
Offset
(
0
,
-
1
),
end:
Offset
(
0
,
0
)).
animate
(
controller
)
..
addListener
(()
{
_model
.
backAnim
(
1
-
animation
.
value
.
dy
.
abs
());
});
}
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
appBar:
baseAppBarChangeTitle
(
backClick:
(){
Navigator
.
pop
(
context
,
null
);
},
centerTitle:
true
,
title:
GestureDetector
(
onTap:
()
{
_model
.
changPopState
();
...
...
@@ -75,6 +81,7 @@ class AlbumState extends State<AlbumPage> with SingleTickerProviderStateMixin {
),
text
,
Container
(
alignment:
Alignment
.
center
,
margin:
EdgeInsets
.
fromLTRB
(
1
,
0
,
0
,
0
),
child:
Transform
(
transform:
Matrix4
.
identity
()
...
...
@@ -98,8 +105,8 @@ class AlbumState extends State<AlbumPage> with SingleTickerProviderStateMixin {
initialData:
_model
.
selectSizeLive
.
data
,
builder:
(
c
,
data
)
{
String
showText
=
"下一步"
;
if
(
data
!=
0
)
{
showText
=
"
$showText
(
$
data
)"
;
if
(
data
.
data
!=
null
&&
data
.
data
!=
0
)
{
showText
=
"
$showText
(
$
{data.data}
)"
;
}
return
Center
(
child:
GestureDetector
(
...
...
@@ -118,6 +125,24 @@ class AlbumState extends State<AlbumPage> with SingleTickerProviderStateMixin {
body:
Stack
(
children:
<
Widget
>[
mainView
(),
StreamBuilder
<
int
>(
stream:
_model
.
backLive
.
stream
,
initialData:
_model
.
backLive
.
data
,
builder:
(
con
,
data
)
{
if
(
data
.
data
==
null
)
{
return
Container
();
}
return
GestureDetector
(
onTap:
()
{
_model
.
changPopState
();
},
child:
Container
(
width:
double
.
maxFinite
,
height:
double
.
maxFinite
,
color:
Color
(
data
.
data
),
));
},
),
popWindow
(),
],
));
...
...
@@ -136,7 +161,6 @@ class AlbumState extends State<AlbumPage> with SingleTickerProviderStateMixin {
initialData:
_model
.
albumLive
.
data
,
builder:
(
BuildContext
context
,
AsyncSnapshot
<
List
<
ScanImageItem
>>
imgList
)
{
print
(
"FINALL
$imgList
${imgList.data}
"
);
if
(
imgList
.
data
==
null
)
{
return
Center
(
child:
CircularProgressIndicator
());
}
...
...
@@ -230,57 +254,53 @@ class AlbumState extends State<AlbumPage> with SingleTickerProviderStateMixin {
builder:
(
BuildContext
context
,
AsyncSnapshot
<
List
<
DirBean
>>
snapshot
)
{
if
(
snapshot
.
data
==
null
)
{
return
Container
();
}
else
{
}
if
(
_model
.
showPop
)
{
controller
.
forward
();
return
Stack
(
children:
<
Widget
>[
Container
(
width:
double
.
maxFinite
,
height:
double
.
maxFinite
,
color:
Colors
.
black54
,
),
popWindowList
(
snapshot
)
],
);
}
else
{
controller
.
reverse
();
}
return
popWindowList
(
snapshot
);
});
}
popWindowList
(
AsyncSnapshot
<
List
<
DirBean
>>
snapshot
)
{
return
Container
(
padding:
EdgeInsets
.
fromLTRB
(
16
,
3
,
16
,
3
),
color:
Colors
.
white
,
height:
280
*
animation
.
value
,
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
(),
return
SlideTransition
(
position:
animation
,
child:
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:
Text
(
""
),
),
Icon
(
Icons
.
chevron_right
)
],
),
Icon
(
Icons
.
chevron_right
)
],
),
);
}));
);
})));
}
}
lib/TestPage.dart
View file @
0a4e2416
...
...
@@ -82,7 +82,7 @@ class TestPage extends StatelessWidget {
Navigator
.
push
(
context
,
new
CustomRoute
(
RouterCenterImpl
().
findAlbumRouter
()?.
getAlbumPage
(
"com.example.gengmei_flutter_plugin_example"
,
true
,
1
,
null
)));
"com.example.gengmei_flutter_plugin_example"
,
true
,
9
,
null
)));
},
"相册页面"
);
}
...
...
lib/main.dart
View file @
0a4e2416
...
...
@@ -119,12 +119,12 @@ class _MyAppState extends State<MyApp> {
return
MaterialApp
(
title:
'Flutter Boost example'
,
debugShowCheckedModeBanner:
false
,
routes:
{
'/'
:
(
context
)
{
return
TestPage
();
},
},
builder:
FlutterBoost
.
init
()
,
//
routes: {
//
'/': (context) {
//
return TestPage();
//
},
//
},
builder:
buildOnce
,
theme:
new
ThemeData
(
primaryColor:
Colors
.
white
,
backgroundColor:
Color
(
0xFFEFEFEF
),
...
...
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