Commit 0431ebee authored by 林生雨's avatar 林生雨

commit

parent fc90f399
...@@ -12,5 +12,6 @@ import 'package:gmalpha_flutter/Annotations/anno/Router.dart'; ...@@ -12,5 +12,6 @@ import 'package:gmalpha_flutter/Annotations/anno/Router.dart';
abstract class AlbumRouter implements RouterBaser { abstract class AlbumRouter implements RouterBaser {
Widget getAlbumPage(String provider, bool showCamera, int bigSelectImage, Widget getAlbumPage(String provider, bool showCamera, int bigSelectImage,
List<String> selectedImages, bool fromNative, String fromPage, List<String> selectedImages, bool fromNative, String fromPage,
{int maxVideoCount = 0, videoSelectPath = null, iosPushedPage = null}); {int maxVideoCount = 0, videoSelectPath = null, iosPushedPage = null
,noVideoHint=null});
} }
...@@ -11,8 +11,8 @@ class AlbumRouterImpl implements AlbumRouter { ...@@ -11,8 +11,8 @@ class AlbumRouterImpl implements AlbumRouter {
@override @override
Widget getAlbumPage(String provider, bool showCamera, int bigSelectSize, Widget getAlbumPage(String provider, bool showCamera, int bigSelectSize,
List<String> selectedImages, bool fromNative, String fromPage, 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, return AlbumPage(provider, showCamera, bigSelectSize, selectedImages,
fromNative, maxVideoCount, videoSelectPath, fromPage,iosPushedPage); fromNative, maxVideoCount, videoSelectPath, fromPage,iosPushedPage,noVideoHint);
} }
} }
...@@ -89,6 +89,7 @@ class AlbumModel extends BaseModel { ...@@ -89,6 +89,7 @@ class AlbumModel extends BaseModel {
int maxVideoCount; int maxVideoCount;
final String fromPage; final String fromPage;
final String iosPushedPage; final String iosPushedPage;
final String noVideoHint;
get dirList => _dirList; get dirList => _dirList;
...@@ -101,7 +102,8 @@ class AlbumModel extends BaseModel { ...@@ -101,7 +102,8 @@ class AlbumModel extends BaseModel {
int maxVideoCount, int maxVideoCount,
List<String> videoSelectPath, List<String> videoSelectPath,
this.fromPage, this.fromPage,
this.iosPushedPage) { this.iosPushedPage
,this.noVideoHint) {
print("======>>>>>${selectedList} ${videoSelectPath} <<<<<====="); print("======>>>>>${selectedList} ${videoSelectPath} <<<<<=====");
this.maxVideoCount = maxVideoCount; this.maxVideoCount = maxVideoCount;
this._maxCount = maxCount; this._maxCount = maxCount;
...@@ -261,7 +263,9 @@ class AlbumModel extends BaseModel { ...@@ -261,7 +263,9 @@ class AlbumModel extends BaseModel {
void clickItem(BuildContext context, int index) { void clickItem(BuildContext context, int index) {
if(maxVideoCount==0&&albumLive.data[index].isVideo){ if(maxVideoCount==0&&albumLive.data[index].isVideo){
Toast.show(context, "头像暂时不支持视频哦~"); if(noVideoHint!=null){
Toast.show(context, noVideoHint);
}
return; return;
} }
String path; String path;
......
...@@ -30,9 +30,10 @@ class AlbumPage extends StatefulWidget { ...@@ -30,9 +30,10 @@ class AlbumPage extends StatefulWidget {
int maxVideo, int maxVideo,
List<String> videoSelectPath, List<String> videoSelectPath,
String fromPage, String fromPage,
String iosPushedPage) { String iosPushedPage,
String noVideoHint) {
model = new AlbumModel(provider, showCamera, maxCount, selectedList, model = new AlbumModel(provider, showCamera, maxCount, selectedList,
fromNative, maxVideo, videoSelectPath, fromPage, iosPushedPage); fromNative, maxVideo, videoSelectPath, fromPage, iosPushedPage,noVideoHint);
} }
@override @override
......
...@@ -3,17 +3,26 @@ ...@@ -3,17 +3,26 @@
* @date 2019-11-05 * @date 2019-11-05
**/ **/
import 'dart:math'; import 'dart:math';
import 'dart:ui';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:gmalpha_flutter/Annotations/RouterCenterRestore.mark.dart'; import 'package:gmalpha_flutter/Annotations/RouterCenterRestore.mark.dart';
import 'package:gmalpha_flutter/commonModel/GMBase.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 { class HomeModel extends BaseModel {
LiveData<int> indexLive = new LiveData(); LiveData<int> indexLive = new LiveData();
LiveData<int> widgetLive = new LiveData(); LiveData<int> widgetLive = new LiveData();
final List<BottomNavigationBarItem> items = []; final List<HomeItem> items = [];
final pages = []; final List<Widget> pages = [];
int currentIndex = 0; int currentIndex = 0;
@override @override
...@@ -29,45 +38,43 @@ class HomeModel extends BaseModel { ...@@ -29,45 +38,43 @@ class HomeModel extends BaseModel {
var messagePage = var messagePage =
RouterCenterImpl().findNewMessageRouter()?.getMessagePage("main"); RouterCenterImpl().findNewMessageRouter()?.getMessagePage("main");
var userPage = RouterCenterImpl().findUserRouter()?.getUserPage(); var userPage = RouterCenterImpl().findUserRouter()?.getUserPage();
int index = 0;
if (mainWidget != null) { if (mainWidget != null) {
items.add( items.add(HomeItem(index, "images/home.svg"));
BottomNavigationBarItem(icon: SvgPicture.asset("images/home.svg")
,title: Container()));
pages.add(mainWidget); pages.add(mainWidget);
index++;
} }
if (findPage != null) { if (findPage != null) {
items.add( items.add(HomeItem(index, "images/find.svg"));
BottomNavigationBarItem(icon: SvgPicture.asset("images/find.svg")
,title: Container()));
pages.add(findPage); pages.add(findPage);
index++;
} }
if (showModel) { if (showModel) {
items.add( items.add(HomeItem(index, "images/add.svg"));
BottomNavigationBarItem(icon: SvgPicture.asset("images/add.svg") // items.add(baseItem(index, "images/add.svg"));
,title: Container())); index++;
} }
if (messagePage != null) { if (messagePage != null) {
items.add(BottomNavigationBarItem( items.add(HomeItem(index, "images/message.svg"));
icon: SvgPicture.asset("images/message.svg")
,title: Container()));
pages.add(messagePage); pages.add(messagePage);
index++;
} }
if (userPage != null) { if (userPage != null) {
items.add( items.add(HomeItem(index, "images/user.svg"));
BottomNavigationBarItem(icon: SvgPicture.asset("images/user.svg")
,title: Container()));
pages.add(userPage); pages.add(userPage);
index++;
} }
} }
void onTap(int index) { void onTap(int index) {
indexLive.notifyView(index); indexLive.notifyView(index);
if(index==2){ if (index == 2) {
//TODO //TODO
}else if(index<2){ } else if (index < 2) {
widgetLive.notifyView(index); widgetLive.notifyView(index);
}else{ } else {
widgetLive.notifyView(index-1); widgetLive.notifyView(index - 1);
} }
} }
} }
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
**/ **/
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:gmalpha_flutter/res/value/ALColors.dart';
import 'HomeModel.dart'; import 'HomeModel.dart';
...@@ -31,31 +33,60 @@ class HomeState extends State<HomePage> { ...@@ -31,31 +33,60 @@ class HomeState extends State<HomePage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var width = MediaQuery.of(context).size.width;
return Scaffold( return Scaffold(
bottomNavigationBar: StreamBuilder<int>( // bottomNavigationBar: StreamBuilder<int>(
stream: _model.indexLive.stream, // stream: _model.indexLive.stream,
initialData: _model.indexLive.data, // initialData: _model.indexLive.data,
builder: (con, data) { // builder: (con, data) {
int index = data.data ?? 0; // int index = data.data ?? 0;
return BottomNavigationBar( // return BottomNavigationBar(
items: _model.items, // items: _model.items,
currentIndex: index, // currentIndex: index,
onTap: (index) { // onTap: (index) {
_model.onTap(index); // _model.onTap(index);
}); // });
}), // }),
body: StreamBuilder<int>( body: StreamBuilder<int>(
stream: _model.widgetLive.stream, stream: _model.widgetLive.stream,
initialData: _model.widgetLive.data, initialData: _model.widgetLive.data,
builder: (con, data) { builder: (con, data) {
int index = data.data ?? 0; int index = data.data ?? 0;
return IndexedStack( 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, index: index,
children: _model.pages[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 @override
void dispose() { void dispose() {
_model.dispose(); _model.dispose();
......
...@@ -74,7 +74,8 @@ class _MyAppState extends State<MyApp> { ...@@ -74,7 +74,8 @@ class _MyAppState extends State<MyApp> {
: new List<String>.from(params["videoSelectedPath"]), : new List<String>.from(params["videoSelectedPath"]),
iosPushedPage: params["iosPushedPage"] == null iosPushedPage: params["iosPushedPage"] == null
? null ? null
: params["iosPushedPage"]); : params["iosPushedPage"],
noVideoHint: params["noVideoHint"] ?? "");
}, },
"prestige": (pageName, params, _) { "prestige": (pageName, params, _) {
print("PARAMS!! ${params}"); print("PARAMS!! ${params}");
...@@ -90,9 +91,7 @@ class _MyAppState extends State<MyApp> { ...@@ -90,9 +91,7 @@ class _MyAppState extends State<MyApp> {
}, },
"activity_report": (pageName, params, _) { "activity_report": (pageName, params, _) {
print("PARAMS!! ${params}"); print("PARAMS!! ${params}");
return RouterCenterImpl() return RouterCenterImpl().findWebRouter()?.getActivityReportPage(
.findWebRouter()
?.getActivityReportPage(
params["survey_record_id"] == null params["survey_record_id"] == null
? null ? null
: int.parse(params["survey_record_id"]), : int.parse(params["survey_record_id"]),
...@@ -134,11 +133,11 @@ class _MyAppState extends State<MyApp> { ...@@ -134,11 +133,11 @@ class _MyAppState extends State<MyApp> {
return MaterialApp( return MaterialApp(
title: 'Flutter Boost example', title: 'Flutter Boost example',
debugShowCheckedModeBanner: false, debugShowCheckedModeBanner: false,
routes: { // routes: {
'/': (context) { // '/': (context) {
return TestPage(); // return TestPage();
}, // },
}, // },
builder: buildOnce, builder: buildOnce,
theme: new ThemeData( theme: new ThemeData(
primaryColor: Colors.white, primaryColor: Colors.white,
......
...@@ -39,7 +39,7 @@ dependencies: ...@@ -39,7 +39,7 @@ dependencies:
gengmei_flutter_plugin: gengmei_flutter_plugin:
git: git:
url: 'git@git.wanmeizhensuo.com:linshengyu/flutter_plugin.git' url: 'git@git.wanmeizhensuo.com:linshengyu/flutter_plugin.git'
ref: "02bd549a993a9c6c0cb49b52c79927b984b030fd" ref: "85f3ca475ec55464ff29e68dfaf444add58a0b64"
# gengmei_flutter_plugin: # gengmei_flutter_plugin:
# path: /Users/apple/lsy/gengmei_flutter_plugin # path: /Users/apple/lsy/gengmei_flutter_plugin
flutter_drag_scale: flutter_drag_scale:
......
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