Commit 92480998 authored by 林生雨's avatar 林生雨

commit

parent ed07ea9f
...@@ -5,6 +5,10 @@ ...@@ -5,6 +5,10 @@
.packages .packages
.pub/ .pub/
Flutter/
Runner.xcworkspace/
.gradle/
.idea/ .idea/
.vagrant/ .vagrant/
.sconsign.dblite .sconsign.dblite
......
...@@ -7,6 +7,7 @@ import 'dart:async'; ...@@ -7,6 +7,7 @@ import 'dart:async';
import 'dart:io'; import 'dart:io';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:gengmei_flutter_plugin/ScanImagePlugn.dart'; import 'package:gengmei_flutter_plugin/ScanImagePlugn.dart';
import 'package:gengmei_flutter_plugin/gengmei_flutter_plugin.dart'; import 'package:gengmei_flutter_plugin/gengmei_flutter_plugin.dart';
import 'package:gmalpha_flutter/AlbumModel/bean/DirBean.dart'; import 'package:gmalpha_flutter/AlbumModel/bean/DirBean.dart';
...@@ -19,6 +20,32 @@ import 'package:gmalpha_flutter/commonModel/toast/toast.dart'; ...@@ -19,6 +20,32 @@ import 'package:gmalpha_flutter/commonModel/toast/toast.dart';
const String MainDir = "IsGengmeiAlbumAllImages"; const String MainDir = "IsGengmeiAlbumAllImages";
const String MainDirExplain = "全部相片"; const String MainDirExplain = "全部相片";
Map<String, List<ScanImageItem>> paseAlbum(Object event) {
var map = Map<String, List<dynamic>>.from(event);
var newMap = Map<String, List<ScanImageItem>>();
map.forEach((k, v) {
var list = List<Map>.from(v);
var scanList = List<ScanImageItem>();
list.forEach((listMap) {
var map2 = Map<String, dynamic>.from(listMap);
ScanImageItem item = new ScanImageItem();
item.path = map2["path"];
item.isVideo = map2["isVideo"] == "T" ? true : false;
item.during = map2["during"] ?? "0";
item.dataToken =
map2["dataToken"] == null ? 0 : int.parse(map2["dataToken"]);
scanList.add(item);
});
newMap[k] = scanList;
});
newMap.forEach((k, eachValue) {
eachValue.sort((a, b) {
return b.dataToken - a.dataToken;
});
});
return newMap;
}
class AlbumModel extends BaseModel { class AlbumModel extends BaseModel {
LiveData<List<ScanImageItem>> albumLive = LiveData(); LiveData<List<ScanImageItem>> albumLive = LiveData();
LiveData<int> selectSizeLive = LiveData(); LiveData<int> selectSizeLive = LiveData();
...@@ -82,6 +109,7 @@ class AlbumModel extends BaseModel { ...@@ -82,6 +109,7 @@ class AlbumModel extends BaseModel {
} }
void _onEvent(Object event) { void _onEvent(Object event) {
if (Platform.isAndroid) {
var map = (event as Map); var map = (event as Map);
if (_mainValue == null || _mainValue.length == 0) { if (_mainValue == null || _mainValue.length == 0) {
_mainValue = map; _mainValue = map;
...@@ -100,6 +128,16 @@ class AlbumModel extends BaseModel { ...@@ -100,6 +128,16 @@ class AlbumModel extends BaseModel {
}); });
} }
albumLive.notifyView(_mainValue[_nowDirName]); albumLive.notifyView(_mainValue[_nowDirName]);
} else {
compute(paseAlbum, event).then((value) {
_mainValue = value;
_dirList.clear();
_mainValue.forEach((k, v) {
_dirList.add(DirBean(k, v.length, File(v[0].path)));
});
albumLive.notifyView(_mainValue[_nowDirName]);
});
}
} }
void _onError(Object error) { void _onError(Object error) {
...@@ -107,19 +145,30 @@ class AlbumModel extends BaseModel { ...@@ -107,19 +145,30 @@ class AlbumModel extends BaseModel {
} }
void initScanImages(BuildContext context) { void initScanImages(BuildContext context) {
if (Platform.isAndroid) { titleData.notifyView(MainDirExplain);
_listen = GengmeiFlutterPlugin.phoneImagesEvent _listen = GengmeiFlutterPlugin.phoneImagesEvent
.receiveBroadcastStream() .receiveBroadcastStream()
.listen(_onEvent, onError: _onError); .listen(_onEvent, onError: _onError);
}
AlbumRepository.getInstance().scanPhoneImg().listen((value) { AlbumRepository.getInstance().scanPhoneImg().listen((value) {
if (value != null) { if (value != null) {
_mainValue = value; _mainValue = value;
selectSizeLive.notifyView(_selectList.length + _selectVideoList.length); selectSizeLive.notifyView(_selectList.length + _selectVideoList.length);
value.forEach((key, eachValue) { value.forEach((key, eachValue) {
if (Platform.isIOS) {
eachValue.sort((a, b) {
if (a.dataToken == 0 && b.dataToken != 0) {
return -b.dataToken;
} else if (a.dataToken != 0 && b.dataToken == 0) {
return -a.dataToken;
} else if (a.dataToken == 0 && b.dataToken == 0) {
return 0;
} else {
return b.dataToken - a.dataToken;
}
});
}
if (eachValue != null && !eachValue.isEmpty) { if (eachValue != null && !eachValue.isEmpty) {
if (key == MainDir) { if (key == MainDir) {
titleData.notifyView(MainDirExplain);
_dirList.add(DirBean( _dirList.add(DirBean(
MainDirExplain, eachValue.length, File(eachValue[0].path))); MainDirExplain, eachValue.length, File(eachValue[0].path)));
albumLive.notifyView(eachValue); albumLive.notifyView(eachValue);
...@@ -301,6 +350,10 @@ class AlbumModel extends BaseModel { ...@@ -301,6 +350,10 @@ class AlbumModel extends BaseModel {
}); });
} }
int allSelectSize() {
return _selectList.length + _selectVideoList.length;
}
void iosAlbumGetImagePath(String path, int index) {} void iosAlbumGetImagePath(String path, int index) {}
void nativeCamera(BuildContext context) { void nativeCamera(BuildContext context) {
...@@ -325,7 +378,11 @@ class AlbumModel extends BaseModel { ...@@ -325,7 +378,11 @@ class AlbumModel extends BaseModel {
list.insert(0, item); list.insert(0, item);
} }
_mainValue[MainDir].insert(0, item); _mainValue[MainDir].insert(0, item);
if (Platform.isAndroid) {
_selectList.add(item.realPath); _selectList.add(item.realPath);
} else {
_selectList.add(item.path);
}
bool haveIt = false; bool haveIt = false;
_dirList.forEach((it) { _dirList.forEach((it) {
if (it.dirName == foldName) { if (it.dirName == foldName) {
......
...@@ -124,12 +124,13 @@ class AlbumState extends BasePage<AlbumPage> ...@@ -124,12 +124,13 @@ class AlbumState extends BasePage<AlbumPage>
return Center( return Center(
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: () {
if (data.data != null && data.data != 0) { print("LSY ${_model.allSelectSize()}");
if(_model.allSelectSize()>0){
_model.onNext(context); _model.onNext(context);
} }
}, },
child: Container( child: Container(
margin: EdgeInsets.fromLTRB(0, 0, 16, 0), padding: EdgeInsets.fromLTRB(0, 0, 16, 0),
child: baseText(showText, 16, color), child: baseText(showText, 16, color),
))); )));
}, },
......
...@@ -75,14 +75,25 @@ class _MessagePageState extends BasePage<MessagePage> { ...@@ -75,14 +75,25 @@ class _MessagePageState extends BasePage<MessagePage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
ScreenUtil.instance = ScreenUtil(width: 375, height: 667)..init(context); ScreenUtil.instance = ScreenUtil(width: 375, height: 667)..init(context);
return Scaffold( return Scaffold(
appBar: AppBar( appBar: MyBar(),
leading: Container( // appBar: AppBar(
margin: EdgeInsets.only(left: ScreenUtil.instance.setWidth(16), top: ScreenUtil.instance.setHeight(16)), // title: Row(
child: messageTitle('消息'), // mainAxisAlignment: MainAxisAlignment.start,
), // crossAxisAlignment: CrossAxisAlignment.center,
elevation: 0, // children: <Widget>[
backgroundColor: ALColors.ColorFFFFFF, // messageTitle('消息'),
), // Expanded(
// child: Container(),
// )
// ],
// ),
// leading: MaterialButton(
// onPressed: () {},
//// padding: EdgeInsets.only(left: ScreenUtil.instance.setWidth(16), top: ScreenUtil.instance.setHeight(16)),
// child: messageTitle('消息'),
// ),
// elevation: 0,
// ),
body: Container( body: Container(
color: ALColors.ColorFFFFFF, color: ALColors.ColorFFFFFF,
child: SmartRefresher( child: SmartRefresher(
...@@ -139,10 +150,8 @@ class _MessagePageState extends BasePage<MessagePage> { ...@@ -139,10 +150,8 @@ class _MessagePageState extends BasePage<MessagePage> {
), ),
getListView() getListView()
], ],
) )),
), ));
)
);
} }
Widget getListView() { Widget getListView() {
...@@ -153,18 +162,13 @@ class _MessagePageState extends BasePage<MessagePage> { ...@@ -153,18 +162,13 @@ class _MessagePageState extends BasePage<MessagePage> {
var dataList = data?.data?.data; var dataList = data?.data?.data;
if (dataList == null) { if (dataList == null) {
return SliverFillViewport( return SliverFillViewport(
delegate: SliverChildListDelegate([ delegate: SliverChildListDelegate([Container()]));
Container()
])
);
} }
return SliverList( return SliverList(
delegate: SliverChildBuilderDelegate( delegate:
(BuildContext context, int index) { SliverChildBuilderDelegate((BuildContext context, int index) {
return messageList(dataList[index]); return messageList(dataList[index]);
}, }, childCount: dataList.length),
childCount: dataList.length
),
); );
}); });
} }
...@@ -274,3 +278,29 @@ class _MessagePageState extends BasePage<MessagePage> { ...@@ -274,3 +278,29 @@ class _MessagePageState extends BasePage<MessagePage> {
return widget.fromPage; return widget.fromPage;
} }
} }
class MyBar extends StatelessWidget implements PreferredSizeWidget {
@override
Size get preferredSize => Size.fromHeight(kToolbarHeight);
@override
Widget build(BuildContext context) {
return Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Container(
color: Colors.white,
margin: EdgeInsets.only(top: ScreenUtil.instance.setSp(16),
left: ScreenUtil.instance.setSp(16)),
child: messageTitle('消息'),
),
Expanded(
child: Container(
color: Colors.white,
),
)
],
);
}
}
...@@ -9,8 +9,10 @@ import 'package:gmalpha_flutter/res/value/ALColors.dart'; ...@@ -9,8 +9,10 @@ import 'package:gmalpha_flutter/res/value/ALColors.dart';
messageTitle(String text) { messageTitle(String text) {
return Text(text, return Text(text,
textScaleFactor: 1.0,
style: TextStyle( style: TextStyle(
color: ALColors.Color323232, fontSize: ScreenUtil().setSp(20))); color: ALColors.Color323232,
fontSize: ScreenUtil.instance.setSp(20)));
} }
var width = ScreenUtil.instance.setWidth(16); var width = ScreenUtil.instance.setWidth(16);
...@@ -208,7 +210,10 @@ Widget messageList(Data list) { ...@@ -208,7 +210,10 @@ Widget messageList(Data list) {
onTap: () { onTap: () {
onClickButton('photo', onClickButton('photo',
{'business_id': list.repliedContent.id.toString()}); {'business_id': list.repliedContent.id.toString()});
jumpToNative('url_page', {"url": 'alpha://${content[list.repliedContent?.type]['openUrl']}'}); jumpToNative('url_page', {
"url":
'alpha://${content[list.repliedContent?.type]['openUrl']}'
});
// jumpToNative('url_page', { // jumpToNative('url_page', {
// "url": // "url":
// 'alpha://topic_detail?topic_id=${list.repliedContent.topicId}' // 'alpha://topic_detail?topic_id=${list.repliedContent.topicId}'
...@@ -218,12 +223,12 @@ Widget messageList(Data list) { ...@@ -218,12 +223,12 @@ Widget messageList(Data list) {
width: ScreenUtil.instance.setWidth(48), width: ScreenUtil.instance.setWidth(48),
height: ScreenUtil.instance.setHeight(48), height: ScreenUtil.instance.setHeight(48),
child: Image.network( child: Image.network(
list.repliedContent.content != null ? list.repliedContent.content : 'http://alpha.iyanzhi.com/topic/2019/08/16/63ef62d019-w', list.repliedContent.content != null
? list.repliedContent.content
: 'http://alpha.iyanzhi.com/topic/2019/08/16/63ef62d019-w',
width: ScreenUtil.instance.setWidth(48), width: ScreenUtil.instance.setWidth(48),
height: ScreenUtil.instance.setHeight(48) height: ScreenUtil.instance.setHeight(48)),
), ))
)
)
], ],
)); ));
} }
......
...@@ -12,6 +12,7 @@ import 'package:cached_network_image/cached_network_image.dart'; ...@@ -12,6 +12,7 @@ import 'package:cached_network_image/cached_network_image.dart';
import 'package:gmalpha_flutter/commonModel/base/BaseComponent.dart'; import 'package:gmalpha_flutter/commonModel/base/BaseComponent.dart';
import 'package:gmalpha_flutter/commonModel/base/BasePage.dart'; import 'package:gmalpha_flutter/commonModel/base/BasePage.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:gmalpha_flutter/res/GMRes.dart';
class ReputationsPage extends StatefulWidget { class ReputationsPage extends StatefulWidget {
ReputationsModel _model; ReputationsModel _model;
...@@ -42,8 +43,7 @@ class ReputationsState extends BasePage<ReputationsPage> { ...@@ -42,8 +43,7 @@ class ReputationsState extends BasePage<ReputationsPage> {
screenWidth = MediaQuery.of(context).size.width; screenWidth = MediaQuery.of(context).size.width;
return WillPopScope( return WillPopScope(
child: Scaffold( child: Scaffold(
appBar: appBar: baseAppBarChangeTitle(
baseAppBarChangeTitle(
title: StreamBuilder<String>( title: StreamBuilder<String>(
stream: _model.titleLive.stream, stream: _model.titleLive.stream,
initialData: _model.titleLive.data, initialData: _model.titleLive.data,
...@@ -88,11 +88,8 @@ class ReputationsState extends BasePage<ReputationsPage> { ...@@ -88,11 +88,8 @@ class ReputationsState extends BasePage<ReputationsPage> {
if (index == 1) { if (index == 1) {
return Container( return Container(
margin: EdgeInsets.fromLTRB(19, 16, 19, 32), margin: EdgeInsets.fromLTRB(19, 16, 19, 32),
child: Text( child: baseText(data.data.data.introduce[0].answer,
data.data.data.introduce[0].answer, 13, ALColors.Color8E8E8E));
style: TextStyle(
fontSize: 13, color: Color(0xff8E8E8E)),
));
} }
if (index == data.data.data.reputations.length + 2) { if (index == data.data.data.reputations.length + 2) {
//bottom margin //bottom margin
...@@ -222,6 +219,7 @@ class ReputationsState extends BasePage<ReputationsPage> { ...@@ -222,6 +219,7 @@ class ReputationsState extends BasePage<ReputationsPage> {
Text MyText(double size, String text, int color) { Text MyText(double size, String text, int color) {
return Text( return Text(
text, text,
textScaleFactor: 1.0,
softWrap: true, softWrap: true,
maxLines: 2, maxLines: 2,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
......
...@@ -54,6 +54,7 @@ AppBar baseAppBarChangeTitle( ...@@ -54,6 +54,7 @@ AppBar baseAppBarChangeTitle(
Text baseText(String text, double fontSize, Color color) { Text baseText(String text, double fontSize, Color color) {
return Text( return Text(
text, text,
textScaleFactor: 1.0,
style: TextStyle(fontSize: fontSize, color: color), style: TextStyle(fontSize: fontSize, color: color),
); );
} }
......
...@@ -9,6 +9,7 @@ import 'package:gmalpha_flutter/Error_Page.dart'; ...@@ -9,6 +9,7 @@ import 'package:gmalpha_flutter/Error_Page.dart';
import 'package:gmalpha_flutter/TestPage.dart'; import 'package:gmalpha_flutter/TestPage.dart';
import 'commonModel/GMBase.dart'; import 'commonModel/GMBase.dart';
import 'res/value/ALColors.dart';
void main() { void main() {
initParams(() { initParams(() {
...@@ -125,15 +126,15 @@ class _MyAppState extends State<MyApp> { ...@@ -125,15 +126,15 @@ 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,
backgroundColor: Color(0xFFEFEFEF), backgroundColor: ALColors.ColorFFFFFF,
accentColor: Color(0xFF888888), accentColor: Color(0xFF888888),
textTheme: TextTheme( textTheme: TextTheme(
//设置Material的默认字体样式 //设置Material的默认字体样式
......
...@@ -336,23 +336,37 @@ class UserLogoutPicker implements ICenterPicker { ...@@ -336,23 +336,37 @@ class UserLogoutPicker implements ICenterPicker {
child: Container(), child: Container(),
), ),
baseDivide(1, 0, ALColors.ColorE4E4E4), baseDivide(1, 0, ALColors.ColorE4E4E4),
GestureDetector( MaterialButton(
onTap: sure,
child: Container(
alignment: Alignment.center,
height: 50, height: 50,
width: double.maxFinite, elevation: 0,
minWidth: double.maxFinite,
child: baseText("确定", 16, ALColors.Color0093FF), child: baseText("确定", 16, ALColors.Color0093FF),
)), onPressed: sure,
),
// GestureDetector(
// onTap: sure,
// child: Container(
// alignment: Alignment.center,
// height: 50,
// width: double.maxFinite,
// child: ,
// )),
baseDivide(1, 0, ALColors.ColorE4E4E4), baseDivide(1, 0, ALColors.ColorE4E4E4),
GestureDetector( MaterialButton(
onTap: cancel,
child: Container(
height: 50, height: 50,
alignment: Alignment.center, elevation: 0,
width: double.maxFinite, minWidth: double.maxFinite,
child: baseText("取消", 16, ALColors.Color999999), child: baseText("取消", 16, ALColors.Color999999),
)), onPressed: cancel,
)
// GestureDetector(
// onTap: cancel,
// child: Container(
// height: 50,
// alignment: Alignment.center,
// width: double.maxFinite,
// child: baseText("取消", 16, ALColors.Color999999),
// )),
], ],
)); ));
} }
......
...@@ -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: "00b2ed0f616c59ba5352a1dd9a3ed1fe8b2d7cdb" ref: "f5a11ea753541e0e4e7a6da6260e6f308f94ccf6"
protobuf: ^0.14.4 protobuf: ^0.14.4
grpc: ^2.1.2 grpc: ^2.1.2
flutter_svg: ^0.14.1 flutter_svg: ^0.14.1
......
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