Commit 1400309e authored by 林生雨's avatar 林生雨

commit

parent e2848217
No preview for this file type
#!/usr/bin/env bash
flutter packages pub run build_runner clean
flutter packages pub run build_runner build --delete-conflicting-outputs
\ No newline at end of file
......@@ -26,6 +26,7 @@ class ServiceGenerator extends GeneratorForAnnotation<ServiceCenter> {
StringBuffer methodBuffer = StringBuffer("");
StringBuffer outBuffer = StringBuffer();
StringBuffer mapBuffer = new StringBuffer();
List<String> outList=[];
List<String> differentList = [];
for (var methodElement in (element as ClassElement).methods) {
for (var annometadata in methodElement.metadata) {
......@@ -96,11 +97,14 @@ class ServiceGenerator extends GeneratorForAnnotation<ServiceCenter> {
// Map map = json.decode(value.toString());
// return ${methodElement.returnType.name}.fromJson(map);
mapBuffer.write("))");
outBuffer.write("""
if(!outList.contains(methodElement.returnType.name)){
outList.add(methodElement.returnType.name);
outBuffer.write("""
${methodElement.returnType.name} pase${methodElement.returnType.name}(String value){
return ${methodElement.returnType.name}.fromJson(json.decode(value));
}\n
""");
}
mapBuffer.write("""
.flatMap((value){
if(value!=null&&(value.statusCode>=200&&value.statusCode<300)){
......
......@@ -5,6 +5,7 @@
import 'dart:math';
import 'dart:ui';
import 'package:example_flutter/commonModel/toast/toast.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
......@@ -13,7 +14,7 @@ import 'commonModel/live/BaseModel.dart';
import 'commonModel/live/LiveData.dart';
class HomeItem {
HomeItem(this.index, this.svgIcon,this.name);
HomeItem(this.index, this.svgIcon, this.name);
int index;
String svgIcon;
......@@ -33,27 +34,32 @@ class HomeModel extends BaseModel {
void init() {
var mainWidget = RouterCenterImpl().findHomeRouter()?.getHomePage();
var persionPage=RouterCenterImpl().findUserRouter()?.getPersionPage();
var persionPage = RouterCenterImpl().findUserRouter()?.getPersionPage();
var checkPage = RouterCenterImpl().findHomeRouter()?.getCheckPage();
var findPage = RouterCenterImpl().findHomeRouter()?.getDataPage();
int index = 0;
if (mainWidget != null) {
items.add(HomeItem(index, "images/home.svg","主页"));
items.add(HomeItem(index, "images/home.svg", "主页"));
pages.add(mainWidget);
index++;
}
if(persionPage!=null){
items.add(HomeItem(index, "images/home.svg","主页"));
if (checkPage != null) {
items.add(HomeItem(index, "images/home.svg", "主页"));
pages.add(checkPage);
index++;
}
if (persionPage != null) {
items.add(HomeItem(index, "images/home.svg", "主页"));
pages.add(persionPage);
index++;
}
if (findPage != null) {
items.add(HomeItem(index, "images/find.svg","变美助手"));
items.add(HomeItem(index, "images/find.svg", "变美助手"));
pages.add(findPage);
index++;
}
}
void onTap(int index) {
widgetLive.notifyView(index);
}
......
......@@ -11,4 +11,5 @@ import 'package:flutter/cupertino.dart';
abstract class HomeRouter extends RouterBaser {
Widget getHomePage();
Widget getDataPage();
Widget getCheckPage();
}
......@@ -3,6 +3,7 @@
* @date 2019-11-07
**/
import 'package:example_flutter/HomeModel/HomeRouter.dart';
import 'package:example_flutter/HomeModel/page/check/CheckPage.dart';
import 'package:example_flutter/HomeModel/page/data/DataCenter.dart';
import 'package:example_flutter/HomeModel/page/home/HomePage.dart';
import 'package:flutter/src/widgets/framework.dart';
......@@ -18,4 +19,9 @@ class HomeRouterImpl extends HomeRouter{
return DataCenter();
}
@override
Widget getCheckPage() {
return CheckPage();
}
}
\ No newline at end of file
......@@ -92,7 +92,7 @@ Widget basehead(BuildContext context) {
GestureDetector(
onTap: () {
BaseDrawPicker()
..setPicker(DrawPicker(["全部项目", "成员管理", "数据中心"]))
..setPicker(DrawPicker(["全部项目", "标注审核", "人员管理","数据中心"]))
..show(context);
},
child: Container(
......@@ -247,26 +247,6 @@ class DrawPicker implements IDrawPicker {
}
}
Widget baseButton(VoidCallback press, EdgeInsetsGeometry margin, String text) {
return FlatButton(
onPressed: press,
child: Container(
margin: margin,
alignment: Alignment.center,
width: 100,
height: 39,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(2),
color: Colors.purple,
gradient: LinearGradient(colors: [
Color.fromARGB(255, 253, 113, 34),
Color.fromARGB(255, 253, 166, 41)
], begin: Alignment.centerRight, end: Alignment.centerLeft),
),
child: baseText(text, 15, Colors.white),
),
);
}
class SurePicker implements ICenterPicker {
VoidCallback cancel;
......@@ -453,11 +433,3 @@ Widget refreshloadingItem(VoidCallback callback) {
return SliverFillViewport(delegate: SliverChildListDelegate([loadCircle]));
}
Widget baseFlatButtonItem(VoidCallback callback,String text){
return FlatButton(
padding: EdgeInsets.only(top: 2, bottom: 2),
color: Color.fromARGB(255, 236, 236, 236),
onPressed: callback,
child: baseText(text, 13, Colors.black),
);
}
/*
* @author lsy
* @date 2019-12-10
**/
const checkListText="""
{
"pic_list": [{
"picurl": "https://anno-1258538551.cos.ap-chengdu.myqcloud.com/f540275d1e6d2fbad9273a8f17924e94.png",
"id": 11,
"status": "2"
}, {
"picurl": "https://anno-1258538551.cos.ap-chengdu.myqcloud.com/f540275d1e6d2fbad9273a8f17924e94",
"id": 12,
"status": "2"
}, {
"picurl": "https://anno-1258538551.cos.ap-chengdu.myqcloud.com/f540275d1e6d2fbad9273a8f17924e94",
"id": 12,
"status": "2"
}, {
"picurl": "https://anno-1258538551.cos.ap-chengdu.myqcloud.com/f540275d1e6d2fbad9273a8f17924e94",
"id": 12,
"status": "2"
}, {
"picurl": "https://anno-1258538551.cos.ap-chengdu.myqcloud.com/f540275d1e6d2fbad9273a8f17924e94",
"id": 12,
"status": "2"
}, {
"picurl": "https://anno-1258538551.cos.ap-chengdu.myqcloud.com/f540275d1e6d2fbad9273a8f17924e94",
"id": 12,
"status": "2"
}, {
"picurl": "https://anno-1258538551.cos.ap-chengdu.myqcloud.com/f540275d1e6d2fbad9273a8f17924e94",
"id": 12,
"status": "2"
}, {
"picurl": "https://anno-1258538551.cos.ap-chengdu.myqcloud.com/f540275d1e6d2fbad9273a8f17924e94",
"id": 12,
"status": "2"
}, {
"picurl": "https://anno-1258538551.cos.ap-chengdu.myqcloud.com/f540275d1e6d2fbad9273a8f17924e94",
"id": 12,
"status": "2"
}]
}
""";
const checkDetail="""
{
"url": "http://img.zcool.cn/community/038500855ea70a732f875a13258473a.jpg",
"anno": {
"eyelid_right": "单眼皮",
"eyelid_left": "单眼皮",
"nose": "窄鼻翼",
"wrink": "有",
"lip_thickness": "标准唇",
"lip_peak": "无",
"pouch": "有",
"cheekbone": "高颧骨",
"brow_shape": "上挑眉",
"brow_density": "分布均匀",
"chin_shape": "圆",
"lip_shape": "樱桃唇",
"lip_radian": "微笑唇",
"eye_shape_right": "杏眼",
"eye_shape_left": "杏眼",
"brows_style": "柳叶眉",
"brows_thickness": "粗眉",
"Dense": "非常淡",
"brows_spacing": "宽",
"face": "梨形脸",
"heiyanquan_left": "有",
"wocan_left": "有",
"yanwen_left": "有",
"yuweiwen_left": "有",
"zhongyanpao_left": "有",
"leigou_left": "有",
"heiyanquan_right": "有",
"wocan_right": "有",
"yanwen_right": "有",
"yuweiwen_right": "有",
"zhongyanpao_right": "有",
"leigou_right": "有"
}
}
""";
/*
* @author lsy
* @date 2019-12-09
**/
import 'dart:math';
import 'package:example_flutter/HomeModel/page/checkInfo/CheckInfoPage.dart';
import 'package:example_flutter/HomeModel/service/HomeRepo.dart';
import 'package:example_flutter/HomeModel/service/remote/entity/ImageResultBean.dart';
import 'package:example_flutter/HomeModel/util/JumpUtil.dart';
import 'package:example_flutter/commonModel/GMBase.dart';
import 'package:example_flutter/commonModel/picker/base/BasePickerComponent.dart';
import 'package:example_flutter/commonModel/toast/toast.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/src/widgets/framework.dart';
class CheckModel extends BaseModel {
LiveData<int> pageIndexLive = new LiveData();
LiveData<List<PicList>> checkItemLive = new LiveData();
LiveData<String> titleLive = new LiveData();
HomeRepo _repo = HomeRepo.getInstance();
//0 标签 1 mask ..
int state = 0;
@override
void dispose() {
pageIndexLive.dispost();
checkItemLive.dispost();
titleLive.dispost();
}
void changeState(BuildContext context, int sta, String title) {
checkItemLive.notifyView(null);
state = sta;
if (sta == 0) {
getData(context, true);
} else if (sta == 1) {
getMaskData(context, true);
}
titleLive.notifyView(title);
}
void getMaskData(BuildContext context, bool showDialog) {
if (showDialog) {
BaseCenterPicker()
..setPicker(BaseLoadingItem("加载中..."))
..show(context);
}
HomeRepo.getInstance()
.getCheckMaskList(HomeRepo.getInstance().nowCheckMaskPageIndex)
.listen((value) {
if (showDialog) {
Navigator.pop(context);
}
_repo.updateCheckMaskList(value.picList);
checkItemLive.notifyView(value.picList);
pageIndexLive.notifyView(_repo.nowCheckMaskPageIndex);
}).onError((error) {
if (showDialog) {
Navigator.pop(context);
}
Toast.show(context, error.toString());
print(error.toString());
});
}
void getData(BuildContext context, bool showDialog) {
if (showDialog) {
BaseCenterPicker()
..setPicker(BaseLoadingItem("加载中..."))
..show(context);
}
titleLive.notifyView("标记列表");
HomeRepo.getInstance()
.getCheckList(HomeRepo.getInstance().nowCheckPageIndex)
.listen((value) {
if (showDialog) {
Navigator.pop(context);
}
_repo.updateCheckList(value.picList);
checkItemLive.notifyView(value.picList);
pageIndexLive.notifyView(_repo.nowCheckPageIndex);
}).onError((error) {
if (showDialog) {
Navigator.pop(context);
}
Toast.show(context, error.toString());
print(error.toString());
});
}
void checkClick(BuildContext context, String id, int index) {
JumpUtil.jumpToPage(context, CheckInfoPage(state, id, index)).then((value) {
if (state == 0) {
getData(context, false);
} else if (state == 1) {
getMaskData(context, false);
}
});
}
void after(BuildContext context) {
BaseCenterPicker()
..setPicker(BaseLoadingItem("加载中。。。"))
..show(context);
if (state == 0) {
_repo.getCheckList(_repo.nowCheckPageIndex + 1).listen((data) {
if (data == null || data.picList == null || data.picList.isEmpty) {
Toast.show(context, "已经是最后一页了哦~");
} else {
_repo.nowCheckPageIndex = _repo.nowCheckPageIndex + 1;
_repo.updateCheckList(data.picList);
checkItemLive.notifyView(data.picList);
}
pageIndexLive.notifyView(_repo.nowCheckPageIndex);
Navigator.pop(context);
}).onError((error) {
Toast.show(context, error.toString());
Toast.show(context, "没有下一页了");
print(error.toString());
Navigator.pop(context);
});
} else if (state == 1) {
_repo.getCheckMaskList(_repo.nowCheckMaskPageIndex + 1).listen((data) {
if (data == null || data.picList == null || data.picList.isEmpty) {
Toast.show(context, "已经是最后一页了哦~");
} else {
_repo.nowCheckMaskPageIndex = _repo.nowCheckMaskPageIndex + 1;
_repo.updateCheckMaskList(data.picList);
checkItemLive.notifyView(data.picList);
}
pageIndexLive.notifyView(_repo.nowCheckMaskPageIndex);
Navigator.pop(context);
}).onError((error) {
Toast.show(context, error.toString());
Toast.show(context, "没有下一页了");
print(error.toString());
Navigator.pop(context);
});
}
}
void before(BuildContext context) {
if (state == 0) {
if (_repo.nowCheckPageIndex == 1) {
Toast.show(context, "已经是第一页了哦");
return;
}
_repo.nowCheckPageIndex = _repo.nowCheckPageIndex - 1;
getData(context, true);
pageIndexLive.notifyView(_repo.nowCheckPageIndex);
} else if (state == 1) {
if (_repo.nowCheckMaskPageIndex == 1) {
Toast.show(context, "已经是第一页了哦");
return;
}
_repo.nowCheckMaskPageIndex = _repo.nowCheckMaskPageIndex - 1;
getMaskData(context, true);
pageIndexLive.notifyView(_repo.nowCheckMaskPageIndex);
}
}
}
/*
* @author lsy
* @date 2019-12-09
**/
import 'package:example_flutter/HomeModel/base/BaseTitle.dart';
import 'package:example_flutter/HomeModel/page/work/temp.dart';
import 'package:example_flutter/HomeModel/service/remote/entity/ImageResultBean.dart';
import 'package:example_flutter/commonModel/base/BaseComponent.dart';
import 'package:example_flutter/commonModel/base/BaseState.dart';
import 'package:example_flutter/commonModel/cache/CacheManager.dart';
import 'package:example_flutter/res/GMRes.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'CheckModel.dart';
class CheckPage extends StatefulWidget {
@override
State<StatefulWidget> createState() => CheckState();
}
class CheckState extends State<CheckPage> {
bool isChecker = false;
CheckModel _model;
@override
void initState() {
isChecker =
(CacheManager.getInstance().get(MEMORY_CACHE).get("checkId")==null ? -1:CacheManager.getInstance().get(MEMORY_CACHE).get("checkId") == 1);
_model = CheckModel();
if (isChecker) {
_model.getData(context, false);
}
super.initState();
}
@override
void dispose() {
_model.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: MyAppBar(),
body: isChecker
? Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
FixLeft(),
Expanded(
child: RightItem(),
)
],
)
: Center(
child: baseText("这个账号没有审核权限哦", 18, Colors.black),
),
);
}
Widget RightItem() {
return Card(
elevation: 5,
margin: EdgeInsets.only(left: 30, top: 30, right: 200, bottom: 50),
child: Container(
child: Column(
children: <Widget>[rightTitle(), rightBody(), rightFoot()],
),
),
);
}
Widget rightTitle() {
return Container(
width: double.maxFinite,
height: 50,
color: Colors.red,
alignment: Alignment.center,
child: StreamBuilder(
stream: _model.titleLive.stream,
initialData: "",
builder: (con, data) {
return baseText("审查列表 -- ${data.data}", 15, Colors.black);
},
));
}
Widget rightFoot() {
return Container(
width: double.maxFinite,
height: 50,
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
baseButton(() {
if(_model.state==0){
_model.getData(context, true);
}else if(_model.state==1){
_model.getMaskData(context, true);
}
}, EdgeInsets.only(), "刷新"),
// baseButton(() {}, EdgeInsets.only(), ""),
// baseButton(() {}, EdgeInsets.only(), ""),
// baseButton(() {}, EdgeInsets.only(), ""),
Expanded(
child: Container(),
),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
_model.before(context);
},
child: Container(
alignment: Alignment.center,
width: 38,
height: 38,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5.0),
border: Border.all(color: Colors.orange, width: 2),
),
child: Icon(
Icons.arrow_left,
color: Colors.orange,
),
)),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {},
child: Container(
margin: EdgeInsets.only(left: 5, right: 5),
alignment: Alignment.center,
width: 38,
height: 38,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5.0),
border: Border.all(color: Colors.orange, width: 2),
),
child: StreamBuilder<int>(
stream: _model.pageIndexLive.stream,
initialData: 1,
builder: (con, data) {
return baseText("${data.data}", 13, Colors.orange);
},
))),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
_model.after(context);
},
child: Container(
alignment: Alignment.center,
width: 38,
height: 38,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5.0),
border: Border.all(color: Colors.orange, width: 2),
),
child: Icon(
Icons.arrow_right,
color: Colors.orange,
),
)),
Container(
width: 30,
)
],
),
);
}
Widget rightBody() {
return Expanded(
child: Container(
child: StreamBuilder<List<PicList>>(
stream: _model.checkItemLive.stream,
initialData: [],
builder: (con, data) {
List<Widget> list = [
Item(ALColors.ColorTitle, "id", null, "名称", "标注者", "审查类型", "质检状态",
"完成时间", -1)
];
list.add(baseDivideColumn());
int index = 0;
if (data.data != null) {
data.data.forEach((value) {
list.add(Item(
Colors.white,
"${value.id}",
value.picurl,
value.picurl.substring(
value.picurl.lastIndexOf("/") + 1, value.picurl.length),
"未知",
_model.state == 0 ? "标记审查" : "点审查",
STATEEXPLAIN[value.status],
"未知",
index));
index++;
list.add(baseDivideColumn());
});
}
print(list.length);
return ListView(
children: list,
);
},
)),
);
}
Widget Item(Color color, String id, String url, String name, String persion,
String type, String state, String date, int index) {
return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
if (index != -1) {
_model.checkClick(context, id, index);
}
},
child: Container(
width: double.maxFinite,
height: 50,
color: color,
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Container(
alignment: Alignment.center,
height: 50,
width: 50,
child: Container(
child: baseText(id, 13, Colors.black),
),
),
baseDivideRow(),
Expanded(
child: Container(
alignment: Alignment.center,
child: url == null
? baseText("图片", 13, Colors.black)
: Image.network(
url,
height: double.maxFinite,
fit: BoxFit.fitHeight,
),
),
),
baseDivideRow(),
Expanded(
child: Container(
alignment: Alignment.center,
child: baseText(name, 13, Colors.black),
),
),
baseDivideRow(),
Expanded(
child: Container(
alignment: Alignment.center,
child: baseText(persion, 13, Colors.black),
),
),
baseDivideRow(),
Expanded(
child: Container(
alignment: Alignment.center,
child: baseText(state, 13, Colors.black),
),
),
baseDivideRow(),
Expanded(
child: Container(
alignment: Alignment.center,
child: baseText(type, 13, Colors.black),
),
),
baseDivideRow(),
Expanded(
child: Container(
alignment: Alignment.center,
child: baseText(date, 13, Colors.black),
),
)
],
)));
}
Widget FixLeft() {
return Card(
elevation: 5,
margin: EdgeInsets.only(left: 50, top: 30),
child: Container(
width: 120,
height: 300,
child: Column(
children: <Widget>[
Container(
height: 30,
),
baseFlatButtonItem(() {
_model.changeState(context, 0, "标记列表");
}, "标记列表"),
baseFlatButtonItem(() {
_model.changeState(context, 1, "点列表");
}, "点列表"),
baseFlatButtonItem(() {}, "TODO"),
Expanded(
child: Container(),
),
],
),
),
);
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -54,6 +54,7 @@ class WorkState extends BaseState<WorkPage> {
_model = new WorkModel(id, currentIndex);
}
@override
void initState() {
super.initState();
......
......@@ -309,3 +309,9 @@ String listToUi(List<Offset> list) {
}
return stringBuffer.toString();
}
const STATEEXPLAIN={
"0":"未分配",
"1":"已分配未标记",
"2":"已分配已标记",
"3":"已审核"
};
......@@ -7,6 +7,7 @@ import 'dart:io';
import 'dart:typed_data';
import 'package:dio/dio.dart';
import 'package:example_flutter/HomeModel/base/test/HomeTest.dart';
import 'package:example_flutter/HomeModel/page/work/temp.dart';
import 'package:example_flutter/HomeModel/service/remote/api/HomeApi.serv.dart';
import 'package:example_flutter/HomeModel/service/remote/entity/AllTabBean.dart';
......@@ -25,10 +26,6 @@ import 'package:flutter/foundation.dart';
import 'package:flutter_animation_set/animator.dart';
import 'package:rxdart/rxdart.dart';
ImageResultBean paseImageResult(String value) {
return ImageResultBean.fromJson(json.decode(value));
}
class HomeRepo {
Dio mydio;
......@@ -63,10 +60,6 @@ class HomeRepo {
// return Observable.fromFuture(compute(paseImageResult, TEST_IMAGES));
}
Observable<UploadResultBean> upload() {
// DioUtil().downloadFile(urlPath, savePath)
}
List<PicList> currentList = new List();
void updateCurrentPageList(List<PicList> picList) {
......@@ -80,7 +73,7 @@ class HomeRepo {
return currentList;
}
Observable<ImageAiBean> imageAi(int id) {
Observable<ImageAiBean> imageAi(String id) {
return Observable.fromFuture(DioUtil().get('images/${id}/'))
.flatMap((value) {
if (value != null &&
......@@ -108,15 +101,14 @@ class HomeRepo {
}
Observable<MaskResultBean> maskImage(
String path, int id, String tag, String ui) {
String path, String id, String tag, String ui,int tagged) {
var name = path.substring(path.lastIndexOf("/") + 1, path.length);
FormData formData = new FormData.from({
"file": new UploadFileInfo(new File(path), name),
"tag": tag,
"ui": ui
"ui": ui,
"tagged":"${tagged}"
});
var existsSync = File(path).existsSync();
print("EXITTTT $existsSync");
return Observable.fromFuture(DioUtil.getInstance()
.getDio()
.post('maskimages/${id}/', data: formData))
......@@ -131,10 +123,10 @@ class HomeRepo {
});
}
Observable<MaskResultBean> getMaskInfo(int id, String tag) {
Observable<MaskResultBean> getMaskInfo(String id, String tag,int tagged) {
return Observable.fromFuture(DioUtil.getInstance()
.getDio()
.get('maskimages/${id}/', queryParameters: {"tag": tag}))
.get('maskimages/${id}/', queryParameters: {"tag": tag,"tagged":tagged}))
.flatMap((value) {
if (value != null &&
(value.statusCode >= 200 && value.statusCode < 300)) {
......@@ -169,7 +161,6 @@ class HomeRepo {
.download("api/downfile", path,
options: Options(method: "POST"), data: FormData.from({"id": id}))
.then((value) {
print(value);
}).whenComplete(() {
ok();
});
......@@ -244,6 +235,69 @@ class HomeRepo {
}
});
}
final int checkPageSize = 9;
int nowCheckPageIndex = 1;
List<PicList> checkList = [];
Observable<ImageResultBean> getCheckList(int currentPage) {
return HomeApiImpl().getCheckList(currentPage, checkPageSize);
// return Observable.fromFuture(
// Future.value(paseImageResultBean(checkListText)));
}
int nowCheckMaskPageIndex = 1;
List<PicList> checkMaskList = [];
Observable<ImageResultBean> getCheckMaskList(int currentPage) {
return HomeApiImpl().getCheckMaskList(currentPage, checkPageSize,"0");
// return Observable.fromFuture(
// Future.value(paseImageResultBean(checkListText)));
}
void updateCheckList(List<PicList> picList) {
if (picList != null && picList.isNotEmpty) {
checkList.clear();
checkList.addAll(picList);
}
}
void updateCheckMaskList(List<PicList> picList) {
if (picList != null && picList.isNotEmpty) {
checkMaskList.clear();
checkMaskList.addAll(picList);
}
}
Observable<ImageAiBean> getCheckImageDetail(String id) {
return Observable.fromFuture(
DioUtil().getDio().get("checkimagedetail/${id}"))
.flatMap((value) {
if (value != null &&
(value.statusCode >= 200 && value.statusCode < 300)) {
return Observable.fromFuture(compute(paseImageAi, value.toString()));
} else {
return Observable.fromFuture(null);
}
});
// return Observable.fromFuture(
// Future.value(ImageAiBean.fromJson(json.decode(checkDetail))));
}
Observable<PutImageDataBean> saveCheckResult(String id, String jsonResult) {
return Observable.fromFuture(DioUtil.getInstance()
.getDio()
.put('checkimagedetail/${id}/', data: jsonResult))
.flatMap((value) {
if (value != null &&
(value.statusCode >= 200 && value.statusCode < 300)) {
return Observable.fromFuture(
compute(parsePutImageBean, value.toString()));
} else {
return Observable.fromFuture(null);
}
});
}
}
UploadBean parseUpload(String value) {
......
......@@ -26,4 +26,10 @@ abstract class HomeApi{
@Get("countimage/")
TotalImageBean getTotalImages();
@Get("checkimagelist/")
ImageResultBean getCheckList(@Query("page")int page,@Query("pageSize")int pageSize);
@Get("checkmasklist/")
ImageResultBean getCheckMaskList(@Query("page")int page,@Query("pageSize")int pageSize,@Query("tagged")String tagged);
}
\ No newline at end of file
......@@ -83,6 +83,34 @@ class HomeApiImpl {
}
});
}
Observable<ImageResultBean> getCheckList(int page, int pageSize) {
return Observable.fromFuture(DioUtil().get('checkimagelist/',
data: {'page': page, 'pageSize': pageSize})).flatMap((value) {
if (value != null &&
(value.statusCode >= 200 && value.statusCode < 300)) {
return Observable.fromFuture(
compute(paseImageResultBean, value.toString()));
} else {
return Observable.fromFuture(null);
}
});
}
Observable<ImageResultBean> getCheckMaskList(
int page, int pageSize, String tagged) {
return Observable.fromFuture(DioUtil().get('checkmasklist/',
data: {'page': page, 'pageSize': pageSize, 'tagged': tagged}))
.flatMap((value) {
if (value != null &&
(value.statusCode >= 200 && value.statusCode < 300)) {
return Observable.fromFuture(
compute(paseImageResultBean, value.toString()));
} else {
return Observable.fromFuture(null);
}
});
}
}
AllTabBean paseAllTabBean(String value) {
......
/*
* @author lsy
* @date 2019-12-10
**/
class CheckDetailBean {
String url;
Anno anno;
CheckDetailBean({this.url, this.anno});
CheckDetailBean.fromJson(Map<String, dynamic> json) {
url = json['url'];
anno = json['anno'] != null ? new Anno.fromJson(json['anno']) : null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['url'] = this.url;
if (this.anno != null) {
data['anno'] = this.anno.toJson();
}
return data;
}
}
class Anno {
String eyelidRight;
String eyelidLeft;
String nose;
String wrink;
String lipThickness;
String lipPeak;
String pouch;
String cheekbone;
String browShape;
String browDensity;
String chinShape;
String lipShape;
String lipRadian;
String eyeShapeRight;
String eyeShapeLeft;
String browsStyle;
String browsThickness;
String dense;
String browsSpacing;
String face;
String heiyanquanLeft;
String wocanLeft;
String yanwenLeft;
String yuweiwenLeft;
String zhongyanpaoLeft;
String leigouLeft;
String heiyanquanRight;
String wocanRight;
String yanwenRight;
String yuweiwenRight;
String zhongyanpaoRight;
String leigouRight;
Anno(
{this.eyelidRight,
this.eyelidLeft,
this.nose,
this.wrink,
this.lipThickness,
this.lipPeak,
this.pouch,
this.cheekbone,
this.browShape,
this.browDensity,
this.chinShape,
this.lipShape,
this.lipRadian,
this.eyeShapeRight,
this.eyeShapeLeft,
this.browsStyle,
this.browsThickness,
this.dense,
this.browsSpacing,
this.face,
this.heiyanquanLeft,
this.wocanLeft,
this.yanwenLeft,
this.yuweiwenLeft,
this.zhongyanpaoLeft,
this.leigouLeft,
this.heiyanquanRight,
this.wocanRight,
this.yanwenRight,
this.yuweiwenRight,
this.zhongyanpaoRight,
this.leigouRight});
Anno.fromJson(Map<String, dynamic> json) {
eyelidRight = json['eyelid_right'];
eyelidLeft = json['eyelid_left'];
nose = json['nose'];
wrink = json['wrink'];
lipThickness = json['lip_thickness'];
lipPeak = json['lip_peak'];
pouch = json['pouch'];
cheekbone = json['cheekbone'];
browShape = json['brow_shape'];
browDensity = json['brow_density'];
chinShape = json['chin_shape'];
lipShape = json['lip_shape'];
lipRadian = json['lip_radian'];
eyeShapeRight = json['eye_shape_right'];
eyeShapeLeft = json['eye_shape_left'];
browsStyle = json['brows_style'];
browsThickness = json['brows_thickness'];
dense = json['Dense'];
browsSpacing = json['brows_spacing'];
face = json['face'];
heiyanquanLeft = json['heiyanquan_left'];
wocanLeft = json['wocan_left'];
yanwenLeft = json['yanwen_left'];
yuweiwenLeft = json['yuweiwen_left'];
zhongyanpaoLeft = json['zhongyanpao_left'];
leigouLeft = json['leigou_left'];
heiyanquanRight = json['heiyanquan_right'];
wocanRight = json['wocan_right'];
yanwenRight = json['yanwen_right'];
yuweiwenRight = json['yuweiwen_right'];
zhongyanpaoRight = json['zhongyanpao_right'];
leigouRight = json['leigou_right'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['eyelid_right'] = this.eyelidRight;
data['eyelid_left'] = this.eyelidLeft;
data['nose'] = this.nose;
data['wrink'] = this.wrink;
data['lip_thickness'] = this.lipThickness;
data['lip_peak'] = this.lipPeak;
data['pouch'] = this.pouch;
data['cheekbone'] = this.cheekbone;
data['brow_shape'] = this.browShape;
data['brow_density'] = this.browDensity;
data['chin_shape'] = this.chinShape;
data['lip_shape'] = this.lipShape;
data['lip_radian'] = this.lipRadian;
data['eye_shape_right'] = this.eyeShapeRight;
data['eye_shape_left'] = this.eyeShapeLeft;
data['brows_style'] = this.browsStyle;
data['brows_thickness'] = this.browsThickness;
data['Dense'] = this.dense;
data['brows_spacing'] = this.browsSpacing;
data['face'] = this.face;
data['heiyanquan_left'] = this.heiyanquanLeft;
data['wocan_left'] = this.wocanLeft;
data['yanwen_left'] = this.yanwenLeft;
data['yuweiwen_left'] = this.yuweiwenLeft;
data['zhongyanpao_left'] = this.zhongyanpaoLeft;
data['leigou_left'] = this.leigouLeft;
data['heiyanquan_right'] = this.heiyanquanRight;
data['wocan_right'] = this.wocanRight;
data['yanwen_right'] = this.yanwenRight;
data['yuweiwen_right'] = this.yuweiwenRight;
data['zhongyanpao_right'] = this.zhongyanpaoRight;
data['leigou_right'] = this.leigouRight;
return data;
}
}
......@@ -6,8 +6,8 @@ import 'package:example_flutter/res/anim/Anim.dart';
import 'package:flutter/cupertino.dart';
class JumpUtil {
static void jumpToPage(BuildContext context, Widget widget) {
Navigator.of(context).push(CustomRoute(widget, routeWay: RouteWay.ALP));
static Future jumpToPage(BuildContext context, Widget widget) {
return Navigator.of(context).push(CustomRoute(widget, routeWay: RouteWay.ALP));
}
static void jumpReplace(BuildContext context,Widget widget){
......
This diff is collapsed.
......@@ -19,7 +19,6 @@ import '../../../HomePage.dart';
class LoginModel extends BaseModel {
resign(BuildContext context, String text, String text2) {
Resp.getInstance().resign(text, text2).listen((value) {
Navigator.pop(context);
if (value != null && value.username != null) {
login(context, text, text2);
} else {
......@@ -36,19 +35,34 @@ class LoginModel extends BaseModel {
// CacheManager.getInstance().get(MEMORY_CACHE).save("userName", text);
// Navigator.push(context, CustomRoute(HomePage()));
Resp.getInstance().login(text, text2).listen((value) {
Navigator.pop(context);
if (value != null && value.token != null) {
CacheManager.getInstance().get(MEMORY_CACHE).save("token", value.token);
CacheManager.getInstance().get(MEMORY_CACHE).save("userName", text);
CacheManager.getInstance().get(MEMORY_CACHE).save("userWorld", text2);
Toast.show(context, "登入成功");
// Navigator.push(context, CustomRoute(PicPage()));
// Navigator.push(context,
// CustomRoute(RouterCenterImpl().findHomeRouter()?.getHomePage()));
Navigator.push(context, CustomRoute(HomePage()));
} else {
Toast.show(context, "接口请求错误 ==> login");
}
CacheManager.getInstance()
.get(MEMORY_CACHE)
.save("token", value.token);
CacheManager.getInstance().get(MEMORY_CACHE).save("userName", text);
CacheManager.getInstance().get(MEMORY_CACHE).save("userWorld", text2);
Resp.getInstance().getUserInfo().listen((info) {
CacheManager.getInstance().get(MEMORY_CACHE).save("uid", info.uid);
print("UID ${info.uid}");
Resp.getInstance().checkUser(info.uid).listen((check){
CacheManager.getInstance().get(MEMORY_CACHE).save("checkId", check.power);
Navigator.pop(context);
if (value != null && value.token != null) {
Toast.show(context, "登入成功");
Navigator.push(context, CustomRoute(HomePage()));
} else {
Toast.show(context, "接口请求错误 ==> login");
}
}).onError((error){
Toast.show(context, error.toString());
print(error.toString());
Navigator.pop(context);
});
}).onError((error) {
Toast.show(context, error.toString());
print(error.toString());
Navigator.pop(context);
});
}).onError((error) {
Navigator.pop(context);
Toast.show(context, error.toString());
......
......@@ -5,11 +5,17 @@
import 'dart:convert';
import 'dart:io';
import 'package:dio/dio.dart';
import 'package:example_flutter/UserModel/service/remote/api/UserApi.serv.dart';
import 'package:example_flutter/UserModel/service/remote/entity/UserBean.dart';
import 'package:example_flutter/UserModel/service/remote/entity/UserCheckBean.dart';
import 'package:example_flutter/UserModel/service/remote/entity/UserToken.dart';
import 'package:example_flutter/commonModel/GMBase.dart';
import 'package:flutter/foundation.dart';
import 'package:rxdart/rxdart.dart';
import 'remote/entity/UserInfoBean.dart';
class Resp {
static Resp _resp;
......@@ -29,4 +35,24 @@ class Resp {
Observable<UserBean> resign(String userName, String userWord) {
return UserApiImpl().resign(userName, userWord);
}
Observable<UserInfoBean> getUserInfo() {
return UserApiImpl().getUserInfo();
}
Observable<UserCheckBean> checkUser(int id) {
return Observable.fromFuture(DioUtil().getDio().get("check/${id}/"))
.flatMap((value) {
if (value != null &&
(value.statusCode >= 200 && value.statusCode < 300)) {
return Observable.fromFuture(compute(parseCheckBean, value.toString()));
} else {
return Observable.fromFuture(null);
}
});
}
}
UserCheckBean parseCheckBean(String value) {
return UserCheckBean.fromJson(json.decode(value));
}
......@@ -23,4 +23,5 @@ abstract class UserApi {
@Get("userinfo/")
UserInfoBean getUserInfo();
}
/*
* @author lsy
* @date 2019-12-09
**/
class UserCheckBean {
int userId;
int power;
UserCheckBean({this.userId, this.power});
UserCheckBean.fromJson(Map<String, dynamic> json) {
userId = json['user_id'];
power = json['power'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['user_id'] = this.userId;
data['power'] = this.power;
return data;
}
}
......@@ -21,8 +21,8 @@ Future<bool> saveString(String key, String value) {
return channel.invokeMethod("setString", {"key": key, "value": value});
}
void getString(BuildContext context,String key, Function(String str) fun) {
channel.invokeMethod("getString",{"key": key}).then((value) {
void getString(BuildContext context, String key, Function(String str) fun) {
channel.invokeMethod("getString", {"key": key}).then((value) {
fun(value);
}).catchError((error) {
Toast.show(context, error.toString());
......@@ -141,3 +141,49 @@ Widget loadingItem() {
Widget netErrorItem() {}
//TODO
Widget baseFlatButtonItem(VoidCallback callback, String text) {
return FlatButton(
padding: EdgeInsets.only(top: 2, bottom: 2),
color: Color.fromARGB(255, 236, 236, 236),
onPressed: callback,
child: baseText(text, 13, Colors.black),
);
}
Widget baseButton(VoidCallback press, EdgeInsetsGeometry margin, String text) {
return FlatButton(
onPressed: press,
child: Container(
margin: margin,
alignment: Alignment.center,
width: 100,
height: 39,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(2),
color: Colors.purple,
gradient: LinearGradient(colors: [
Color.fromARGB(255, 253, 113, 34),
Color.fromARGB(255, 253, 166, 41)
], begin: Alignment.centerRight, end: Alignment.centerLeft),
),
child: baseText(text, 15, Colors.white),
),
);
}
Widget baseDivideRow() {
return Container(
width: 1,
height: double.maxFinite,
color: Colors.black38,
);
}
Widget baseDivideColumn() {
return Container(
width: double.maxFinite,
height: 1,
color: Colors.black38,
);
}
/*
* @author lsy
* @date 2019-12-09
**/
class ExecManager {
int _maxExecOnecCount;
int nowExecOnceCount=0;
int allExecCount=0;
int nowExecCount=0;
Function(int completeIndex) callBack;
ExecManager(this._maxExecOnecCount,this.callBack);
List<IRunner> runner = new List();
void exec(IRunner iRunner) {
runner.add(iRunner);
allExecCount=runner.length;
int recordIndex= nowExecCount;
}
void realExec(int execIndex){
if(nowExecOnceCount<_maxExecOnecCount){
nowExecOnceCount++;
//exec
runner[execIndex].run();
callBack(execIndex);
nowExecCount++;
if(nowExecCount<allExecCount){
int recordCount=nowExecCount;
realExec(recordCount);
}
}
}
}
class ExecBean{
IRunner runner;
}
abstract class IRunner {
void run();
}
\ No newline at end of file
......@@ -64,7 +64,6 @@ class BaseDrawPickerState extends State<BaseDrawPicker>
alp = "0$alp";
}
String colorString = "0x${alp}000000";
print(colorString);
liveData.notifyView(int.parse(colorString));
});
controller.forward();
......
......@@ -7,14 +7,14 @@ PODS:
DEPENDENCIES:
- file_chooser (from `Flutter/ephemeral/.symlinks/plugins/file_chooser/macos`)
- FlutterMacOS (from `Flutter/ephemeral/.symlinks/flutter/darwin-x64`)
- FlutterMacOS (from `Flutter/ephemeral/.symlinks/flutter/darwin-x64-release`)
- path_provider_fde (from `Flutter/ephemeral/.symlinks/plugins/path_provider_fde/macos`)
EXTERNAL SOURCES:
file_chooser:
:path: Flutter/ephemeral/.symlinks/plugins/file_chooser/macos
FlutterMacOS:
:path: Flutter/ephemeral/.symlinks/flutter/darwin-x64
:path: Flutter/ephemeral/.symlinks/flutter/darwin-x64-release
path_provider_fde:
:path: Flutter/ephemeral/.symlinks/plugins/path_provider_fde/macos
......
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