Commit 7177940b authored by 林生雨's avatar 林生雨

commit

parent 92480998
......@@ -2,6 +2,7 @@ package io.flutter.plugins;
import io.flutter.plugin.common.PluginRegistry;
import com.taobao.idlefish.flutterboost.FlutterBoostPlugin;
import com.example.flutter_drag_scale.FlutterDragScalePlugin;
import com.example.gengmei_flutter_plugin.GengmeiFlutterPlugin;
import io.flutter.plugins.pathprovider.PathProviderPlugin;
import com.tekartik.sqflite.SqflitePlugin;
......@@ -16,6 +17,7 @@ public final class GeneratedPluginRegistrant {
return;
}
FlutterBoostPlugin.registerWith(registry.registrarFor("com.taobao.idlefish.flutterboost.FlutterBoostPlugin"));
FlutterDragScalePlugin.registerWith(registry.registrarFor("com.example.flutter_drag_scale.FlutterDragScalePlugin"));
GengmeiFlutterPlugin.registerWith(registry.registrarFor("com.example.gengmei_flutter_plugin.GengmeiFlutterPlugin"));
PathProviderPlugin.registerWith(registry.registrarFor("io.flutter.plugins.pathprovider.PathProviderPlugin"));
SqflitePlugin.registerWith(registry.registrarFor("com.tekartik.sqflite.SqflitePlugin"));
......
......@@ -4,6 +4,7 @@
#import "GeneratedPluginRegistrant.h"
#import <flutter_boost/FlutterBoostPlugin.h>
#import <flutter_drag_scale/FlutterDragScalePlugin.h>
#import <gengmei_flutter_plugin/GengmeiFlutterPlugin.h>
#import <path_provider/PathProviderPlugin.h>
#import <sqflite/SqflitePlugin.h>
......@@ -13,6 +14,7 @@
+ (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry {
[FlutterBoostPlugin registerWithRegistrar:[registry registrarForPlugin:@"FlutterBoostPlugin"]];
[FlutterDragScalePlugin registerWithRegistrar:[registry registrarForPlugin:@"FlutterDragScalePlugin"]];
[GengmeiFlutterPlugin registerWithRegistrar:[registry registrarForPlugin:@"GengmeiFlutterPlugin"]];
[FLTPathProviderPlugin registerWithRegistrar:[registry registrarForPlugin:@"FLTPathProviderPlugin"]];
[SqflitePlugin registerWithRegistrar:[registry registrarForPlugin:@"SqflitePlugin"]];
......
......@@ -49,7 +49,7 @@ class ActivityReportState extends BasePage<ActivityReportPage> {
.findBuriedRouter()
?.onClick(pageName(), "return");
Navigator.pop(context, "");
jumpToNative("search", null);
// jumpToNative("search", null);
},
action: <Widget>[
GestureDetector(
......@@ -124,7 +124,7 @@ class ActivityReportState extends BasePage<ActivityReportPage> {
animationNumberState.clearState();
animationCharacterState.clearState();
_model.dispose();
jumpToNative("search", null);
// jumpToNative("search", null);
}
@override
......
......@@ -11,11 +11,14 @@ import 'package:flutter/foundation.dart';
import 'package:gengmei_flutter_plugin/ScanImagePlugn.dart';
import 'package:gengmei_flutter_plugin/gengmei_flutter_plugin.dart';
import 'package:gmalpha_flutter/AlbumModel/bean/DirBean.dart';
import 'package:gmalpha_flutter/AlbumModel/page/preview/AlbumPreviewPage.dart';
import 'package:gmalpha_flutter/AlbumModel/repository/AlbumRepository.dart';
import 'package:gmalpha_flutter/Annotations/RouterCenterRestore.mark.dart';
import 'package:gmalpha_flutter/commonModel/GMBase.dart';
import 'package:gmalpha_flutter/commonModel/live/BaseModel.dart';
import 'package:gmalpha_flutter/commonModel/live/LiveData.dart';
import 'package:gmalpha_flutter/commonModel/toast/toast.dart';
import 'package:gmalpha_flutter/res/GMRes.dart';
const String MainDir = "IsGengmeiAlbumAllImages";
const String MainDirExplain = "全部相片";
......@@ -32,17 +35,21 @@ Map<String, List<ScanImageItem>> paseAlbum(Object event) {
item.path = map2["path"];
item.isVideo = map2["isVideo"] == "T" ? true : false;
item.during = map2["during"] ?? "0";
item.realPath = map2["realPath"] ?? "";
item.size = map2["size"] ?? 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;
if (Platform.isIOS) {
newMap.forEach((k, eachValue) {
eachValue.sort((a, b) {
return b.dataToken - a.dataToken;
});
});
});
}
return newMap;
}
......@@ -109,35 +116,35 @@ class AlbumModel extends BaseModel {
}
void _onEvent(Object event) {
if (Platform.isAndroid) {
var map = (event as Map);
if (_mainValue == null || _mainValue.length == 0) {
_mainValue = map;
} else {
_mainValue.forEach((k, itemList) {
var key = map[k];
if (key != null) {
for (int i = 0; i < itemList.length; i++) {
if (key[i] == null) {
continue;
}
itemList[i].path = key[i]["path"];
itemList[i].realPath = key[i]["realPath"];
}
}
});
}
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]);
// if (Platform.isAndroid) {
// var map = (event as Map);
// if (_mainValue == null || _mainValue.length == 0) {
// _mainValue = map;
// } else {
// _mainValue.forEach((k, itemList) {
// var key = map[k];
// if (key != null) {
// for (int i = 0; i < itemList.length; i++) {
// if (key[i] == null) {
// continue;
// }
// itemList[i].path = key[i]["path"];
// itemList[i].realPath = key[i]["realPath"];
// }
// }
// });
// }
// 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) {
......@@ -284,6 +291,9 @@ class AlbumModel extends BaseModel {
}
void onNext(BuildContext context) {
RouterCenterImpl()
.findBuriedRouter()
?.onEvent("post_add_pic_click_next", {"page_name": "post_add_pic"});
if (_selectList.isEmpty && _selectVideoList.isEmpty) {
Navigator.pop(context, null);
} else {
......@@ -357,6 +367,9 @@ class AlbumModel extends BaseModel {
void iosAlbumGetImagePath(String path, int index) {}
void nativeCamera(BuildContext context) {
RouterCenterImpl()
.findBuriedRouter()
?.onEvent("post_add_pic_click_camera", {"page_name": "post_add_pic"});
if (_selectList.length == maxCount) {
Toast.show(context, "最多选择${_maxCount}张图片");
return;
......@@ -439,6 +452,9 @@ class AlbumModel extends BaseModel {
void selectDir(int index) {
String dirName = _dirList[index].dirName;
RouterCenterImpl()
.findBuriedRouter()
?.onClick("post_add_pic", "album_name");
titleData.notifyView(dirName);
if (dirName == MainDirExplain) {
dirName = MainDir;
......@@ -467,9 +483,6 @@ class AlbumModel extends BaseModel {
if (during == null) {
return "";
} else {
if (Platform.isIOS) {
return during;
}
try {
var parse = int.parse(during);
String min;
......@@ -499,4 +512,46 @@ class AlbumModel extends BaseModel {
}
}
}
bool previewItemClick = false;
void previewItem(BuildContext context, int index, String pageName) {
String path;
if (Platform.isAndroid) {
path = albumLive.data[index].realPath;
if (albumLive.data[index].isVideo) {
GengmeiFlutterPlugin.playAlbumVideo(path);
} else {
Navigator.push(context, CustomRoute(AlbumPreviewPage(path, pageName)));
}
} else {
path = albumLive.data[index].path;
if (albumLive.data[index].isVideo) {
GengmeiFlutterPlugin.playAlbumVideo(path);
} else {
if (previewItemClick) {
return;
}
previewItemClick = true;
iosItem(path, context, (value) {
var realPath = value["realImagePath"];
Navigator.push(
context, CustomRoute(AlbumPreviewPage(realPath, pageName)));
});
}
}
}
void iosItem(String path, BuildContext context, Function fun) {
GengmeiFlutterPlugin.ios_album_item(path).then((value) {
if (value != null) {
fun(Map<String, String>.from(value));
}
previewItemClick = false;
}).catchError((error) {
Toast.debugShow(context, error.toString());
previewItemClick = false;
print(error);
});
}
}
......@@ -5,11 +5,15 @@
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:gengmei_flutter_plugin/ScanImagePlugn.dart';
import 'package:gmalpha_flutter/AlbumModel/bean/DirBean.dart';
import 'package:gmalpha_flutter/AlbumModel/page/preview/AlbumPreviewPage.dart';
import 'package:gmalpha_flutter/Annotations/RouterCenterRestore.mark.dart';
import 'package:gmalpha_flutter/commonModel/base/BaseComponent.dart';
import 'package:gmalpha_flutter/commonModel/base/BasePage.dart';
import 'package:gmalpha_flutter/res/GMRes.dart';
import 'package:gmalpha_flutter/res/value/ALColors.dart';
import 'AlbumModel.dart';
......@@ -25,10 +29,10 @@ class AlbumPage extends StatefulWidget {
bool fromNative,
int maxVideo,
List<String> videoSelectPath,
String fromPage
,String iosPushedPage) {
String fromPage,
String iosPushedPage) {
model = new AlbumModel(provider, showCamera, maxCount, selectedList,
fromNative, maxVideo, videoSelectPath, fromPage,iosPushedPage);
fromNative, maxVideo, videoSelectPath, fromPage, iosPushedPage);
}
@override
......@@ -59,9 +63,12 @@ class AlbumState extends BasePage<AlbumPage>
@override
Widget build(BuildContext context) {
ScreenUtil.instance = ScreenUtil(width: 375.0, height: 667.0)
..init(context);
return Scaffold(
appBar: baseAppBarChangeTitle(
backClick: () {
RouterCenterImpl().findBuriedRouter()?.onClick(pageName(), "next");
Navigator.pop(context, null);
},
centerTitle: true,
......@@ -125,7 +132,7 @@ class AlbumState extends BasePage<AlbumPage>
child: GestureDetector(
onTap: () {
print("LSY ${_model.allSelectSize()}");
if(_model.allSelectSize()>0){
if (_model.allSelectSize() > 0) {
_model.onNext(context);
}
},
......@@ -216,10 +223,11 @@ class AlbumState extends BasePage<AlbumPage>
String during;
if (_model.maxVideoCount > 0 && _model.isVideo(newIndex)) {
during = _model.getFormatTime(imgList.data[newIndex].during);
// print("druing ${imgList.data[newIndex].during} dur ${during}");
}
return GestureDetector(
onTap: () => _model.clickItem(context, newIndex),
onTap: () {
_model.previewItem(context, newIndex, pageName());
},
child: Container(
decoration: BoxDecoration(
image: DecorationImage(
......@@ -254,12 +262,22 @@ class AlbumState extends BasePage<AlbumPage>
)
: Container(),
_model.maxVideoCount > 0 && _model.isVideo(newIndex)
? Positioned(
left: 50,
top: 70,
? Container(
width: double.maxFinite,
height: double.maxFinite,
alignment: Alignment.bottomRight,
padding: EdgeInsets.only(right: 5, bottom: 2),
child: baseText(during, 15, ALColors.ColorF8F8F8),
)
: Container()
: Container(),
GestureDetector(
onTap: () => _model.clickItem(context, newIndex),
child: Container(
width: 40,
height: 40,
color: Colors.transparent,
),
)
],
),
));
......@@ -330,7 +348,7 @@ class AlbumState extends BasePage<AlbumPage>
@override
String pageName() {
return "album";
return "post_add_pic";
}
@override
......
/*
* @author lsy
* @date 2019-11-01
**/
import 'dart:io';
import 'dart:typed_data';
import 'dart:ui';
import 'package:gmalpha_flutter/commonModel/GMBase.dart';
class AlbumPreviewModel extends BaseModel{
final String imgPath;
AlbumPreviewModel(this.imgPath);
// scareImage() async{
// final Uint8List bytes = await File(imgPath).readAsBytes();
// return await instantiateImageCodec(bytes,targetHeight: 520,targetWidth: 520);
// }
@override
void dispose() {
// TODO: implement dispose
}
}
\ No newline at end of file
/*
* @author lsy
* @date 2019-11-01
**/
import 'dart:io';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_drag_scale/core/drag_scale_widget.dart';
import 'package:gmalpha_flutter/AlbumModel/page/preview/AlbumPreviewModel.dart';
import 'package:gmalpha_flutter/commonModel/base/BaseComponent.dart';
class AlbumPreviewPage extends StatefulWidget {
AlbumPreviewModel _model;
String fromPage;
AlbumPreviewPage(String imgPath, this.fromPage) {
_model = AlbumPreviewModel(imgPath);
}
@override
State<StatefulWidget> createState() => AlbumPreviewState(_model, fromPage);
}
class AlbumPreviewState extends State<AlbumPreviewPage> {
AlbumPreviewModel _model;
final String fromPage;
AlbumPreviewState(this._model, this.fromPage);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: baseAppBar(backClick: () {
Navigator.pop(context);
}),
body: Container(
alignment: Alignment.center,
width: double.maxFinite,
height: double.maxFinite,
child: DragScaleContainer(
doubleTapStillScale: false,
child: new Image.file(
File(
_model.imgPath,
),
fit: BoxFit.fitWidth,
)),
));
}
// @override
// String pageName() {
// return "album_preview";
// }
//
// @override
// String referrer() {
// return fromPage;
// }
}
......@@ -12,36 +12,40 @@ AppBar baseAppBar(
{String title,
List<Widget> action,
bool centerTitle,
VoidCallback backClick}) {
VoidCallback backClick,
Color backgroundColor}) {
return baseAppBarChangeTitle(
title: title == null
? Container()
: baseText(title, 16, ALColors.Color323232),
action: action,
centerTitle: centerTitle,
backClick: backClick);
backClick: backClick,
backgroundColor: backgroundColor);
}
AppBar baseAppBarChangeTitle(
{Widget title,
List<Widget> action,
bool centerTitle,
VoidCallback backClick}) {
VoidCallback backClick,
Color backgroundColor}) {
return AppBar(
backgroundColor: ALColors.ColorFFFFFF,
backgroundColor:
backgroundColor == null ? ALColors.ColorFFFFFF : backgroundColor,
title: title,
centerTitle: centerTitle,
elevation: 0.0,
leading: GestureDetector(
onTap: backClick,
child: Container(
color: ALColors.ColorFFFFFF,
alignment: Alignment.centerLeft,
padding: EdgeInsets.only(left: 22),
width: 30,
height: double.maxFinite,
child: Hero(
tag: "left_arrow",
child: Hero(
tag: "left_arrow",
child: Container(
color: ALColors.ColorFFFFFF,
alignment: Alignment.centerLeft,
padding: EdgeInsets.only(left: 22),
width: 30,
height: double.maxFinite,
child: SvgPicture.asset(
"images/left_arrow.svg",
color: Color(0xff323232),
......
......@@ -126,16 +126,16 @@ 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,
backgroundColor: ALColors.ColorFFFFFF,
accentColor: Color(0xFF888888),
accentColor: ALColors.ColorFFFFFF,
textTheme: TextTheme(
//设置Material的默认字体样式
body1: TextStyle(color: Color(0xFF888888), fontSize: 16.0),
......
......@@ -3,6 +3,8 @@
* @date 2019-10-14
**/
import 'dart:io';
import 'package:flutter/material.dart';
enum RouteWay {
......@@ -48,13 +50,22 @@ class CustomRoute extends PageRouteBuilder {
child: child,
);
} else if (routeWay.index == 1) {
return SlideTransition(
position: Tween<Offset>(
begin: Offset(1.0, 0.0), end: Offset(0.0, 0.0))
.animate(CurvedAnimation(
parent: animaton1, curve: Curves.fastOutSlowIn)),
child: child,
);
return SlideTransition(
position: Tween<Offset>(
begin: Offset(1.0, 0.0), end: Offset(0.0, 0.0))
.animate(CurvedAnimation(
parent: animaton1, curve: Curves.fastOutSlowIn)),
child: child,
);
// } else {
// return SlideTransition(
// position: Tween<Offset>(
// begin: Offset(0.0, 1.0), end: Offset(0.0, 0.0))
// .animate(CurvedAnimation(
// parent: animaton1, curve: Curves.fastOutSlowIn)),
// child: child,
// );
// }
} else {
return ScaleTransition(
scale: Tween(begin: 0.0, end: 1.0).animate(CurvedAnimation(
......
......@@ -39,7 +39,9 @@ dependencies:
gengmei_flutter_plugin:
git:
url: 'git@git.wanmeizhensuo.com:linshengyu/flutter_plugin.git'
ref: "f5a11ea753541e0e4e7a6da6260e6f308f94ccf6"
ref: "2f543feff272cfe6d0f6a4954b60f79b990a0903"
flutter_drag_scale:
git: 'https://github.com/LiuC520/flutter_drag_scale.git'
protobuf: ^0.14.4
grpc: ^2.1.2
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