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
0431ebee
Commit
0431ebee
authored
Nov 11, 2019
by
林生雨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commit
parent
fc90f399
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
104 additions
and
61 deletions
+104
-61
AlbumRouter.dart
lib/AlbumModel/AlbumRouter.dart
+2
-1
AlbumRouterImpl.dart
lib/AlbumModel/AlbumRouterImpl.dart
+2
-2
AlbumModel.dart
lib/AlbumModel/page/album/AlbumModel.dart
+6
-2
AlbumPage.dart
lib/AlbumModel/page/album/AlbumPage.dart
+3
-2
HomeModel.dart
lib/Home/HomeModel.dart
+28
-21
HomePage.dart
lib/Home/HomePage.dart
+46
-15
main.dart
lib/main.dart
+16
-17
pubspec.yaml
pubspec.yaml
+1
-1
No files found.
lib/AlbumModel/AlbumRouter.dart
View file @
0431ebee
...
...
@@ -12,5 +12,6 @@ import 'package:gmalpha_flutter/Annotations/anno/Router.dart';
abstract
class
AlbumRouter
implements
RouterBaser
{
Widget
getAlbumPage
(
String
provider
,
bool
showCamera
,
int
bigSelectImage
,
List
<
String
>
selectedImages
,
bool
fromNative
,
String
fromPage
,
{
int
maxVideoCount
=
0
,
videoSelectPath
=
null
,
iosPushedPage
=
null
});
{
int
maxVideoCount
=
0
,
videoSelectPath
=
null
,
iosPushedPage
=
null
,
noVideoHint
=
null
});
}
lib/AlbumModel/AlbumRouterImpl.dart
View file @
0431ebee
...
...
@@ -11,8 +11,8 @@ class AlbumRouterImpl implements AlbumRouter {
@override
Widget
getAlbumPage
(
String
provider
,
bool
showCamera
,
int
bigSelectSize
,
List
<
String
>
selectedImages
,
bool
fromNative
,
String
fromPage
,
{
int
maxVideoCount
=
0
,
videoSelectPath
,
iosPushedPage
})
{
{
int
maxVideoCount
=
0
,
videoSelectPath
,
iosPushedPage
,
noVideoHint
=
null
})
{
return
AlbumPage
(
provider
,
showCamera
,
bigSelectSize
,
selectedImages
,
fromNative
,
maxVideoCount
,
videoSelectPath
,
fromPage
,
iosPushedPage
);
fromNative
,
maxVideoCount
,
videoSelectPath
,
fromPage
,
iosPushedPage
,
noVideoHint
);
}
}
lib/AlbumModel/page/album/AlbumModel.dart
View file @
0431ebee
...
...
@@ -89,6 +89,7 @@ class AlbumModel extends BaseModel {
int
maxVideoCount
;
final
String
fromPage
;
final
String
iosPushedPage
;
final
String
noVideoHint
;
get
dirList
=>
_dirList
;
...
...
@@ -101,7 +102,8 @@ class AlbumModel extends BaseModel {
int
maxVideoCount
,
List
<
String
>
videoSelectPath
,
this
.
fromPage
,
this
.
iosPushedPage
)
{
this
.
iosPushedPage
,
this
.
noVideoHint
)
{
print
(
"======>>>>>
${selectedList}
${videoSelectPath}
<<<<<====="
);
this
.
maxVideoCount
=
maxVideoCount
;
this
.
_maxCount
=
maxCount
;
...
...
@@ -261,7 +263,9 @@ class AlbumModel extends BaseModel {
void
clickItem
(
BuildContext
context
,
int
index
)
{
if
(
maxVideoCount
==
0
&&
albumLive
.
data
[
index
].
isVideo
){
Toast
.
show
(
context
,
"头像暂时不支持视频哦~"
);
if
(
noVideoHint
!=
null
){
Toast
.
show
(
context
,
noVideoHint
);
}
return
;
}
String
path
;
...
...
lib/AlbumModel/page/album/AlbumPage.dart
View file @
0431ebee
...
...
@@ -30,9 +30,10 @@ class AlbumPage extends StatefulWidget {
int
maxVideo
,
List
<
String
>
videoSelectPath
,
String
fromPage
,
String
iosPushedPage
)
{
String
iosPushedPage
,
String
noVideoHint
)
{
model
=
new
AlbumModel
(
provider
,
showCamera
,
maxCount
,
selectedList
,
fromNative
,
maxVideo
,
videoSelectPath
,
fromPage
,
iosPushedPage
);
fromNative
,
maxVideo
,
videoSelectPath
,
fromPage
,
iosPushedPage
,
noVideoHint
);
}
@override
...
...
lib/Home/HomeModel.dart
View file @
0431ebee
...
...
@@ -3,17 +3,26 @@
* @date 2019-11-05
**/
import
'dart:math'
;
import
'dart:ui'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_svg/flutter_svg.dart'
;
import
'package:gmalpha_flutter/Annotations/RouterCenterRestore.mark.dart'
;
import
'package:gmalpha_flutter/commonModel/GMBase.dart'
;
import
'package:gmalpha_flutter/res/GMRes.dart'
;
class
HomeItem
{
HomeItem
(
this
.
index
,
this
.
svgIcon
);
int
index
;
String
svgIcon
;
}
class
HomeModel
extends
BaseModel
{
LiveData
<
int
>
indexLive
=
new
LiveData
();
LiveData
<
int
>
widgetLive
=
new
LiveData
();
final
List
<
BottomNavigationBar
Item
>
items
=
[];
final
pages
=
[];
final
List
<
Home
Item
>
items
=
[];
final
List
<
Widget
>
pages
=
[];
int
currentIndex
=
0
;
@override
...
...
@@ -29,45 +38,43 @@ class HomeModel extends BaseModel {
var
messagePage
=
RouterCenterImpl
().
findNewMessageRouter
()?.
getMessagePage
(
"main"
);
var
userPage
=
RouterCenterImpl
().
findUserRouter
()?.
getUserPage
();
int
index
=
0
;
if
(
mainWidget
!=
null
)
{
items
.
add
(
BottomNavigationBarItem
(
icon:
SvgPicture
.
asset
(
"images/home.svg"
)
,
title:
Container
()));
items
.
add
(
HomeItem
(
index
,
"images/home.svg"
));
pages
.
add
(
mainWidget
);
index
++;
}
if
(
findPage
!=
null
)
{
items
.
add
(
BottomNavigationBarItem
(
icon:
SvgPicture
.
asset
(
"images/find.svg"
)
,
title:
Container
()));
items
.
add
(
HomeItem
(
index
,
"images/find.svg"
));
pages
.
add
(
findPage
);
index
++;
}
if
(
showModel
)
{
items
.
add
(
BottomNavigationBarItem
(
icon:
SvgPicture
.
asset
(
"images/add.svg"
)
,
title:
Container
()))
;
items
.
add
(
HomeItem
(
index
,
"images/add.svg"
));
// items.add(baseItem(index, "images/add.svg"));
index
++
;
}
if
(
messagePage
!=
null
)
{
items
.
add
(
BottomNavigationBarItem
(
icon:
SvgPicture
.
asset
(
"images/message.svg"
)
,
title:
Container
()));
items
.
add
(
HomeItem
(
index
,
"images/message.svg"
));
pages
.
add
(
messagePage
);
index
++;
}
if
(
userPage
!=
null
)
{
items
.
add
(
BottomNavigationBarItem
(
icon:
SvgPicture
.
asset
(
"images/user.svg"
)
,
title:
Container
()));
items
.
add
(
HomeItem
(
index
,
"images/user.svg"
));
pages
.
add
(
userPage
);
index
++;
}
}
void
onTap
(
int
index
)
{
indexLive
.
notifyView
(
index
);
if
(
index
==
2
)
{
if
(
index
==
2
)
{
//TODO
}
else
if
(
index
<
2
)
{
}
else
if
(
index
<
2
)
{
widgetLive
.
notifyView
(
index
);
}
else
{
widgetLive
.
notifyView
(
index
-
1
);
}
else
{
widgetLive
.
notifyView
(
index
-
1
);
}
}
}
lib/Home/HomePage.dart
View file @
0431ebee
...
...
@@ -4,6 +4,8 @@
**/
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_svg/svg.dart'
;
import
'package:gmalpha_flutter/res/value/ALColors.dart'
;
import
'HomeModel.dart'
;
...
...
@@ -31,31 +33,60 @@ class HomeState extends State<HomePage> {
@override
Widget
build
(
BuildContext
context
)
{
var
width
=
MediaQuery
.
of
(
context
).
size
.
width
;
return
Scaffold
(
bottomNavigationBar:
StreamBuilder
<
int
>(
stream:
_model
.
indexLive
.
stream
,
initialData:
_model
.
indexLive
.
data
,
builder:
(
con
,
data
)
{
int
index
=
data
.
data
??
0
;
return
BottomNavigationBar
(
items:
_model
.
items
,
currentIndex:
index
,
onTap:
(
index
)
{
_model
.
onTap
(
index
);
});
}),
//
bottomNavigationBar: StreamBuilder<int>(
//
stream: _model.indexLive.stream,
//
initialData: _model.indexLive.data,
//
builder: (con, data) {
//
int index = data.data ?? 0;
//
return BottomNavigationBar(
//
items: _model.items,
//
currentIndex: index,
//
onTap: (index) {
//
_model.onTap(index);
//
});
//
}),
body:
StreamBuilder
<
int
>(
stream:
_model
.
widgetLive
.
stream
,
initialData:
_model
.
widgetLive
.
data
,
builder:
(
con
,
data
)
{
int
index
=
data
.
data
??
0
;
return
IndexedStack
(
index:
index
,
children:
_model
.
pages
[
index
],
List
<
Widget
>
tabList
=
new
List
();
_model
.
items
.
forEach
((
value
)
{
tabList
.
add
(
baseItem
(
value
.
index
,
value
.
svgIcon
));
});
return
Column
(
children:
<
Widget
>[
Expanded
(
child:
IndexedStack
(
index:
index
,
children:
_model
.
pages
,
)),
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
tabList
,
)
],
);
}));
}
Widget
baseItem
(
int
index
,
String
pic
)
{
return
Expanded
(
child:
GestureDetector
(
onTap:
()
{
_model
.
currentIndex
=
index
;
_model
.
onTap
(
index
);
},
child:
Container
(
height:
56
,
alignment:
Alignment
.
center
,
child:
_model
.
currentIndex
==
index
?
SvgPicture
.
asset
(
pic
,
color:
ALColors
.
Color323232
)
:
SvgPicture
.
asset
(
pic
,
color:
ALColors
.
Color999999
))));
}
@override
void
dispose
()
{
_model
.
dispose
();
...
...
lib/main.dart
View file @
0431ebee
...
...
@@ -74,7 +74,8 @@ class _MyAppState extends State<MyApp> {
:
new
List
<
String
>.
from
(
params
[
"videoSelectedPath"
]),
iosPushedPage:
params
[
"iosPushedPage"
]
==
null
?
null
:
params
[
"iosPushedPage"
]);
:
params
[
"iosPushedPage"
],
noVideoHint:
params
[
"noVideoHint"
]
??
""
);
},
"prestige"
:
(
pageName
,
params
,
_
)
{
print
(
"PARAMS!!
${params}
"
);
...
...
@@ -90,16 +91,14 @@ class _MyAppState extends State<MyApp> {
},
"activity_report"
:
(
pageName
,
params
,
_
)
{
print
(
"PARAMS!!
${params}
"
);
return
RouterCenterImpl
()
.
findWebRouter
()
?.
getActivityReportPage
(
params
[
"survey_record_id"
]
==
null
?
null
:
int
.
parse
(
params
[
"survey_record_id"
]),
params
[
"template_id"
]
==
null
?
null
:
int
.
parse
(
params
[
"template_id"
]),
params
[
"fromPage"
]);
return
RouterCenterImpl
().
findWebRouter
()?.
getActivityReportPage
(
params
[
"survey_record_id"
]
==
null
?
null
:
int
.
parse
(
params
[
"survey_record_id"
]),
params
[
"template_id"
]
==
null
?
null
:
int
.
parse
(
params
[
"template_id"
]),
params
[
"fromPage"
]);
},
"message_focus"
:
(
pageName
,
params
,
_
)
{
return
RouterCenterImpl
()
...
...
@@ -116,7 +115,7 @@ class _MyAppState extends State<MyApp> {
.
findNewMessageRouter
()
?.
getLikePage
(
params
[
"fromPage"
]);
},
'find_home'
:
(
pageName
,
params
,
_
)
{
'find_home'
:
(
pageName
,
params
,
_
)
{
if
(!
Api
.
getInstance
().
setDioCookie
(
params
)
||
params
[
"fromPage"
]
==
null
)
{
return
ErrorPage
(
"出错:需要传递的参数为空"
);
...
...
@@ -134,11 +133,11 @@ class _MyAppState extends State<MyApp> {
return
MaterialApp
(
title:
'Flutter Boost example'
,
debugShowCheckedModeBanner:
false
,
routes:
{
'/'
:
(
context
)
{
return
TestPage
();
},
},
//
routes: {
//
'/': (context) {
//
return TestPage();
//
},
//
},
builder:
buildOnce
,
theme:
new
ThemeData
(
primaryColor:
Colors
.
white
,
...
...
pubspec.yaml
View file @
0431ebee
...
...
@@ -39,7 +39,7 @@ dependencies:
gengmei_flutter_plugin
:
git
:
url
:
'
git@git.wanmeizhensuo.com:linshengyu/flutter_plugin.git'
ref
:
"
02bd549a993a9c6c0cb49b52c79927b984b030fd
"
ref
:
"
85f3ca475ec55464ff29e68dfaf444add58a0b64
"
# gengmei_flutter_plugin:
# path: /Users/apple/lsy/gengmei_flutter_plugin
flutter_drag_scale
:
...
...
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