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

commit

parent fc90f399
......@@ -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});
}
......@@ -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);
}
}
......@@ -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;
......
......@@ -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
......
......@@ -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<BottomNavigationBarItem> items = [];
final pages = [];
final List<HomeItem> 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);
}
}
}
......@@ -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();
......
......@@ -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,
......
......@@ -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:
......
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