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

fix

parent 01eaf28b
......@@ -60,6 +60,13 @@ function android_apk(){
rm -rf /Users/apple/lsy/gengmei_alpha/alpha/src/main/assets/flutter_assets
cp -r /Users/apple/lsy/gmalpha_flutter/build/app/outputs/apk/${suff}/assets/flutter_assets /Users/apple/lsy/gengmei_alpha/alpha/src/main/assets/
cp -r /Users/apple/lsy/gmalpha_flutter/build/flutter_boost/outputs/aar/flutter_boost-${suff}.aar /Users/apple/lsy/MergeTest/app/libs/flutter_boost.aar
cp -r /Users/apple/lsy/gmalpha_flutter/build/gengmei_flutter_plugin/outputs/aar/gengmei_flutter_plugin-${suff}.aar /Users/apple/lsy/MergeTest/app/libs/gengmei_flutter_plugin.aar
cp -r /Users/apple/lsy/gmalpha_flutter/build/path_provider/outputs/aar/path_provider-${suff}.aar /Users/apple/lsy/MergeTest/app/libs/path_provider.aar
cp -r /Users/apple/lsy/gmalpha_flutter/build/sqflite/outputs/aar/sqflite-${suff}.aar /Users/apple/lsy/MergeTest/app/libs/sqflite.aar
cp -r /Users/apple/lsy/gmalpha_flutter/build/xservice_kit/outputs/aar/xservice_kit-${suff}.aar /Users/apple/lsy/MergeTest/app/libs/xservice_kit.aar
# cp -r /Users/apple/lsy/gmalpha_flutter/build/app/outputs/aar/app-${suff}.aar /Users/apple/lsy/MergeTest/app/libs/app.aar
# cp -r /Users/apple/lsy/gmalpha_flutter/build/flutter_boost/outputs/aar/flutter_boost-${suff}.aar /Users/apple/lsy/MergeTest/app/libs/flutter_boost.aar
# cp -r /Users/apple/lsy/gmalpha_flutter/build/gengmei_flutter_plugin/outputs/aar/gengmei_flutter_plugin-${suff}.aar /Users/apple/lsy/MergeTest/app/libs/gengmei_flutter_plugin.aar
......@@ -243,11 +250,11 @@ mkdir /Users/apple/lsy/aar_update/androd${message}/
mkdir /Users/apple/lsy/aar_update/ios${message}/
clean
#android_apk
android_apk
#android
#android_publish
#upload_android_aar
ios
#ios
#ios_publish
#notifyDingDing
......
......@@ -5,6 +5,7 @@ import 'package:flutter_svg/flutter_svg.dart';
import 'package:gmalpha_flutter/NewMessageModel/page/AttentionModel.dart';
import 'package:gmalpha_flutter/NewMessageModel/page/AttentionListItem.dart';
import 'package:gmalpha_flutter/NewMessageModel/service/remote/entity/AttentionEntity.dart';
import 'package:gmalpha_flutter/commonModel/base/BaseComponent.dart';
import 'package:gmalpha_flutter/commonModel/base/BasePage.dart';
import 'package:gmalpha_flutter/res/value/ALColors.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
......@@ -151,23 +152,10 @@ class _AttentionPageState extends BasePage<AttentionPage> {
ScreenUtil.instance = ScreenUtil(width: 375.0, height: 667.0)..init(context);
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
elevation: 0.0,
leading: GestureDetector(
onTap: () {
Navigator.pop(context);
},
child: Padding(
padding: EdgeInsets.only(
top: height10,
right: width10,
bottom: height10
),
child: Center(
child: SvgPicture.asset("images/left_arrow.svg", color: Color(0xff323232)),
),
)
),
appBar: baseAppBar(
backClick: (){
Navigator.pop(context);
}
),
body: SmartRefresher(
enablePullDown: false,
......
......@@ -4,6 +4,7 @@ import 'package:flutter_svg/flutter_svg.dart';
import 'package:gmalpha_flutter/NewMessageModel/page/focusPage/FocusListItem.dart';
import 'package:gmalpha_flutter/NewMessageModel/page/focusPage/FocusModel.dart';
import 'package:gmalpha_flutter/NewMessageModel/service/remote/entity/FocusPageEntity.dart';
import 'package:gmalpha_flutter/commonModel/GMBase.dart';
import 'package:gmalpha_flutter/commonModel/base/BasePage.dart';
import 'package:gmalpha_flutter/res/value/ALColors.dart';
......@@ -18,6 +19,7 @@ double height20 = ScreenUtil().setHeight(20.0);
class FocusPage extends StatefulWidget {
final FocusModel _model;
FocusPage(String fromPage) : _model = FocusModel(1, fromPage);
@override
......@@ -28,9 +30,11 @@ class _FocusState extends BasePage<FocusPage> {
List<Followers> _focusLists = [];
bool noData = false;
FocusModel _model;
_FocusState(this._model);
RefreshController _refreshController = RefreshController(initialRefresh: false);
RefreshController _refreshController =
RefreshController(initialRefresh: false);
// 热更新代码
@override
......@@ -46,7 +50,6 @@ class _FocusState extends BasePage<FocusPage> {
_model.init(context);
}
@override
String pageName() {
return 'focus_list';
......@@ -58,63 +61,57 @@ class _FocusState extends BasePage<FocusPage> {
}
Widget buildFocusitem(BuildContext context, int index) {
return Padding(
padding: EdgeInsets.only(bottom: height16, top: height16, left: width15, right: width15),
return Padding(
padding: EdgeInsets.only(
bottom: height16, top: height16, left: width15, right: width15),
child: FocusListItem(_focusLists[index]),
);
}
Widget _buildProgressIndicator({LoadStatus mode, String text}) {
Widget _buildProgressIndicator({LoadStatus mode, String text}) {
Widget loadText = Text(
text,
textAlign: TextAlign.center,
style: TextStyle(
color: ALColors.Color999999,
fontSize: ScreenUtil().setSp(14.0),
height: 1.07
),
color: ALColors.Color999999,
fontSize: ScreenUtil().setSp(14.0),
height: 1.07),
);
if (mode == LoadStatus.loading || mode == LoadStatus.canLoading) {
return Container(
color: Color(0xFFF4F3F8),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Container(
width: 15.0,
height: 15.0,
child: CircularProgressIndicator(strokeWidth: 2.0),
),
Padding(
padding: EdgeInsets.only(
left: ScreenUtil().setWidth(6.0),
top: height20,
bottom: height20
color: Color(0xFFF4F3F8),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Container(
width: 15.0,
height: 15.0,
child: CircularProgressIndicator(strokeWidth: 2.0),
),
child: loadText
)
],
)
);
Padding(
padding: EdgeInsets.only(
left: ScreenUtil().setWidth(6.0),
top: height20,
bottom: height20),
child: loadText)
],
));
} else {
return Opacity(
opacity: 1.0,
child: Container(
color: Color(0xFFF4F3F8),
padding: EdgeInsets.only(
left: ScreenUtil().setWidth(6.0),
top: height20,
bottom: height20
),
child: loadText
),
color: Color(0xFFF4F3F8),
padding: EdgeInsets.only(
left: ScreenUtil().setWidth(6.0),
top: height20,
bottom: height20),
child: loadText),
);
}
}
Widget loadingItem() {
Widget loadingItem() {
Widget loadCircle = Column(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
......@@ -124,84 +121,61 @@ class _FocusState extends BasePage<FocusPage> {
),
Padding(
padding: EdgeInsets.only(
left: width10,
right: width10,
top: height10,
bottom: height10
),
left: width10, right: width10, top: height10, bottom: height10),
child: Text('加载中...'),
)
],
);
return SliverFillViewport(
delegate: SliverChildListDelegate([loadCircle])
);
return SliverFillViewport(delegate: SliverChildListDelegate([loadCircle]));
}
Widget errorItem(String reason) {
return SliverFillViewport(
delegate: SliverChildListDelegate([
Center(
child: Text("$reason"),
)
])
);
delegate: SliverChildListDelegate([
Center(
child: Text("$reason"),
)
]));
}
@override
Widget build(BuildContext context) {
ScreenUtil.instance = ScreenUtil(width: 375.0, height: 667.0)..init(context);
ScreenUtil.instance = ScreenUtil(width: 375.0, height: 667.0)
..init(context);
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
elevation: 0.0,
leading: GestureDetector(
onTap: () {
Navigator.pop(context);
},
child: Padding(
padding: EdgeInsets.only(
top: height10,
right: width10,
bottom: height10
),
child: Center(
child: SvgPicture.asset("images/left_arrow.svg", color: Color(0xff323232)),
),
)
),
),
appBar: baseAppBar(backClick: () {
Navigator.pop(context);
}),
body: SmartRefresher(
enablePullDown: false,
enablePullUp: true,
footer: CustomFooter(
builder: (BuildContext context,LoadStatus mode){
String body ;
if (mode == LoadStatus.idle){
body = '上拉加载';
} else if (mode==LoadStatus.loading || mode == LoadStatus.canLoading){
body = '加载中...';
} else if (mode == LoadStatus.failed){
body = '加载失败!点击重试!';
} else if (mode == LoadStatus.noMore) {
body = '暂时无更多数据!';
}
return _buildProgressIndicator(mode: mode, text: body);
},
),
controller: _refreshController,
onLoading: _onLoading,
child: CustomScrollView(
slivers: <Widget>[
SliverToBoxAdapter(
child: topTitle(),
),
renderList()
],
)
),
enablePullDown: false,
enablePullUp: true,
footer: CustomFooter(
builder: (BuildContext context, LoadStatus mode) {
String body;
if (mode == LoadStatus.idle) {
body = '上拉加载';
} else if (mode == LoadStatus.loading ||
mode == LoadStatus.canLoading) {
body = '加载中...';
} else if (mode == LoadStatus.failed) {
body = '加载失败!点击重试!';
} else if (mode == LoadStatus.noMore) {
body = '暂时无更多数据!';
}
return _buildProgressIndicator(mode: mode, text: body);
},
),
controller: _refreshController,
onLoading: _onLoading,
child: CustomScrollView(
slivers: <Widget>[
SliverToBoxAdapter(
child: topTitle(),
),
renderList()
],
)),
);
}
......@@ -216,7 +190,7 @@ class _FocusState extends BasePage<FocusPage> {
if (data.data.error != 0 || data.data.data.followers == null) {
return errorItem(data.data.message);
}
if(data.data != null){
if (data.data != null) {
_focusLists = data.data.data.followers;
}
return SliverList(
......@@ -224,11 +198,10 @@ class _FocusState extends BasePage<FocusPage> {
(BuildContext context, int index) {
return Container(
padding: EdgeInsets.only(
bottom: height16,
top: height16,
left: width15,
right: width15
),
bottom: height16,
top: height16,
left: width15,
right: width15),
child: FocusListItem(_focusLists[index]),
);
},
......@@ -241,7 +214,7 @@ class _FocusState extends BasePage<FocusPage> {
void _onLoading() {
_model.more(context, (value) {
if(value == DataStatus.NODATA) {
if (value == DataStatus.NODATA) {
_refreshController.loadNoData();
} else {
_refreshController.loadComplete();
......@@ -255,14 +228,15 @@ class _FocusState extends BasePage<FocusPage> {
children: <Widget>[
Padding(
padding: EdgeInsets.only(
top: ScreenUtil().setHeight(5.0),
left: width16,
right: width16,
bottom: ScreenUtil().setHeight(19.0)
),
top: ScreenUtil().setHeight(5.0),
left: width16,
right: width16,
bottom: ScreenUtil.instance.setHeight(19.0)),
child: Text(
'关注',
style: TextStyle(fontSize: ScreenUtil().setSp(20.0), color: ALColors.Color323232),
style: TextStyle(
fontSize: ScreenUtil.instance.setSp(20.0),
color: ALColors.Color323232),
),
),
Container(
......@@ -273,7 +247,7 @@ class _FocusState extends BasePage<FocusPage> {
),
)
],
);
);
}
@override
......@@ -282,5 +256,3 @@ class _FocusState extends BasePage<FocusPage> {
_model.dispose();
}
}
......@@ -4,6 +4,7 @@ import 'package:flutter_svg/flutter_svg.dart';
import 'package:gmalpha_flutter/NewMessageModel/page/likePage/LikeListItem.dart';
import 'package:gmalpha_flutter/NewMessageModel/page/likePage/LikeModel.dart';
import 'package:gmalpha_flutter/NewMessageModel/service/remote/entity/LikePageEntity.dart';
import 'package:gmalpha_flutter/commonModel/base/BaseComponent.dart';
import 'package:gmalpha_flutter/commonModel/base/BasePage.dart';
import 'package:gmalpha_flutter/res/value/ALColors.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
......@@ -17,6 +18,7 @@ double height20 = ScreenUtil().setHeight(20.0);
class LikePage extends StatefulWidget {
final LikeModel _model;
LikePage(String fromPage) : _model = LikeModel(1, fromPage);
@override
......@@ -27,9 +29,11 @@ class _LikePageState extends BasePage<LikePage> {
List<Data> _likeLists = [];
bool noData = false;
LikeModel _model;
_LikePageState(this._model);
RefreshController _refreshController = RefreshController(initialRefresh: false);
RefreshController _refreshController =
RefreshController(initialRefresh: false);
// 热更新代码
@override
......@@ -45,7 +49,6 @@ class _LikePageState extends BasePage<LikePage> {
_model.init(context);
}
@override
String pageName() {
return 'like_list';
......@@ -57,63 +60,57 @@ class _LikePageState extends BasePage<LikePage> {
}
Widget buildLikeitem(BuildContext context, int index) {
return Padding(
padding: EdgeInsets.only(bottom: height16, top: height16, left: width15, right: width15),
return Padding(
padding: EdgeInsets.only(
bottom: height16, top: height16, left: width15, right: width15),
child: LikeListItem(_likeLists[index]),
);
}
Widget _buildProgressIndicator({LoadStatus mode, String text}) {
Widget _buildProgressIndicator({LoadStatus mode, String text}) {
Widget loadText = Text(
text,
textAlign: TextAlign.center,
style: TextStyle(
color: ALColors.Color999999,
fontSize: ScreenUtil().setSp(14.0),
height: 1.07
),
color: ALColors.Color999999,
fontSize: ScreenUtil().setSp(14.0),
height: 1.07),
);
if (mode == LoadStatus.loading || mode == LoadStatus.canLoading) {
return Container(
color: Color(0xFFF4F3F8),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Container(
width: 15.0,
height: 15.0,
child: CircularProgressIndicator(strokeWidth: 2.0),
),
Padding(
padding: EdgeInsets.only(
left: ScreenUtil().setWidth(6.0),
top: height20,
bottom: height20
color: Color(0xFFF4F3F8),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Container(
width: 15.0,
height: 15.0,
child: CircularProgressIndicator(strokeWidth: 2.0),
),
child: loadText
)
],
)
);
Padding(
padding: EdgeInsets.only(
left: ScreenUtil().setWidth(6.0),
top: height20,
bottom: height20),
child: loadText)
],
));
} else {
return Opacity(
opacity: 1.0,
child: Container(
color: Color(0xFFF4F3F8),
padding: EdgeInsets.only(
left: ScreenUtil().setWidth(6.0),
top: height20,
bottom: height20
),
child: loadText
),
color: Color(0xFFF4F3F8),
padding: EdgeInsets.only(
left: ScreenUtil().setWidth(6.0),
top: height20,
bottom: height20),
child: loadText),
);
}
}
Widget loadingItem() {
Widget loadingItem() {
Widget loadCircle = Column(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
......@@ -123,83 +120,61 @@ class _LikePageState extends BasePage<LikePage> {
),
Padding(
padding: EdgeInsets.only(
left: width10,
right: width10,
top: height10,
bottom: height10
),
left: width10, right: width10, top: height10, bottom: height10),
child: Text('加载中...'),
)
],
);
return SliverFillViewport(
delegate: SliverChildListDelegate([loadCircle])
);
return SliverFillViewport(delegate: SliverChildListDelegate([loadCircle]));
}
Widget errorItem(String reason) {
return SliverFillViewport(
delegate: SliverChildListDelegate([
Center(
child: Text("$reason"),
)
])
);
delegate: SliverChildListDelegate([
Center(
child: Text("$reason"),
)
]));
}
@override
Widget build(BuildContext context) {
ScreenUtil.instance = ScreenUtil(width: 375.0, height: 667.0)..init(context);
ScreenUtil.instance = ScreenUtil(width: 375.0, height: 667.0)
..init(context);
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
elevation: 0.0,
leading: GestureDetector(
onTap: () {
Navigator.pop(context);
},
child: Padding(
padding: EdgeInsets.only(
top: height10,
right: width10,
bottom: height10
),
child: Center(
child: SvgPicture.asset("images/left_arrow.svg", color: Color(0xff323232)),
),
)
),
),
appBar: baseAppBar(backClick: () {
Navigator.pop(context);
}),
body: SmartRefresher(
enablePullDown: false,
enablePullUp: true,
footer: CustomFooter(
builder: (BuildContext context,LoadStatus mode){
String body ;
if (mode == LoadStatus.idle){
body = '上拉加载';
} else if (mode==LoadStatus.loading || mode == LoadStatus.canLoading){
body = '加载中...';
} else if (mode == LoadStatus.failed){
body = '加载失败!点击重试!';
} else if (mode == LoadStatus.noMore) {
body = '暂时无更多数据!';
}
return _buildProgressIndicator(mode: mode, text: body);
},
),
controller: _refreshController,
onLoading: _onLoading,
child: CustomScrollView(
slivers: <Widget>[
SliverToBoxAdapter(
child: topTitle(),
),
renderList()
],
)
),
enablePullDown: false,
enablePullUp: true,
footer: CustomFooter(
builder: (BuildContext context, LoadStatus mode) {
String body;
if (mode == LoadStatus.idle) {
body = '上拉加载';
} else if (mode == LoadStatus.loading ||
mode == LoadStatus.canLoading) {
body = '加载中...';
} else if (mode == LoadStatus.failed) {
body = '加载失败!点击重试!';
} else if (mode == LoadStatus.noMore) {
body = '暂时无更多数据!';
}
return _buildProgressIndicator(mode: mode, text: body);
},
),
controller: _refreshController,
onLoading: _onLoading,
child: CustomScrollView(
slivers: <Widget>[
SliverToBoxAdapter(
child: topTitle(),
),
renderList()
],
)),
);
}
......@@ -214,7 +189,7 @@ class _LikePageState extends BasePage<LikePage> {
if (data.data.error != 0 || data.data.data == null) {
return errorItem(data.data.message);
}
if(data.data != null){
if (data.data != null) {
_likeLists = data.data.data;
}
return SliverList(
......@@ -222,11 +197,10 @@ class _LikePageState extends BasePage<LikePage> {
(BuildContext context, int index) {
return Container(
padding: EdgeInsets.only(
bottom: height16,
top: height16,
left: width15,
right: width15
),
bottom: height16,
top: height16,
left: width15,
right: width15),
child: LikeListItem(_likeLists[index]),
);
},
......@@ -239,7 +213,7 @@ class _LikePageState extends BasePage<LikePage> {
void _onLoading() {
_model.more(context, (value) {
if(value == DataStatus.NODATA) {
if (value == DataStatus.NODATA) {
_refreshController.loadNoData();
} else {
_refreshController.loadComplete();
......@@ -253,14 +227,15 @@ class _LikePageState extends BasePage<LikePage> {
children: <Widget>[
Padding(
padding: EdgeInsets.only(
top: ScreenUtil().setHeight(5.0),
left: width16,
right: width16,
bottom: ScreenUtil().setHeight(19.0)
),
top: ScreenUtil().setHeight(5.0),
left: width16,
right: width16,
bottom: ScreenUtil().setHeight(19.0)),
child: Text(
'Like!',
style: TextStyle(fontSize: ScreenUtil().setSp(20.0), color: ALColors.Color323232),
style: TextStyle(
fontSize: ScreenUtil().setSp(20.0),
color: ALColors.Color323232),
),
),
Container(
......@@ -271,7 +246,7 @@ class _LikePageState extends BasePage<LikePage> {
),
)
],
);
);
}
@override
......@@ -280,5 +255,3 @@ class _LikePageState extends BasePage<LikePage> {
_model.dispose();
}
}
import 'dart:async';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
......@@ -10,6 +12,7 @@ import 'package:gmalpha_flutter/NewMessageModel/util/Jump.dart';
import 'package:gmalpha_flutter/commonModel/GMBase.dart';
import 'package:gmalpha_flutter/commonModel/eventbus/GlobalEventBus.dart';
import 'package:gmalpha_flutter/commonModel/eventbus/event/LoginEvent.dart';
import 'package:gmalpha_flutter/commonModel/eventbus/event/SyncMessageEvent.dart';
import 'package:gmalpha_flutter/res/value/ALColors.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
......@@ -29,6 +32,8 @@ class _MessagePageState extends BasePage<MessagePage> {
MessageModel _messageModel;
static int pageCount = 10;
static int pageNo = 2;
StreamSubscription<LoginEvent> eventBusListener;
StreamSubscription<SyncMessageEvent> eventBusListenerSync;
RefreshController _refreshController =
RefreshController(initialRefresh: false);
......@@ -38,10 +43,15 @@ class _MessagePageState extends BasePage<MessagePage> {
void initState() {
super.initState();
_messageModel.init(context);
GlobalEventBus().event.on<LoginEvent>().listen((event) {
eventBusListener = GlobalEventBus().event.on<LoginEvent>().listen((event) {
print("flutter EVENT BUS LoginEvent ${event}");
_messageModel.init(context);
});
eventBusListenerSync =
GlobalEventBus().event.on<SyncMessageEvent>().listen((event) {
print("flutter EVENT BUS SyncMessageEvent ${event}");
_messageModel.init(context);
});
}
void _onLoading(BuildContext context) async {
......@@ -67,10 +77,8 @@ class _MessagePageState extends BasePage<MessagePage> {
ScreenUtil.instance = ScreenUtil(width: 375, height: 667)..init(context);
return Scaffold(
appBar: AppBar(
centerTitle: false,
title: messageTitle('消息'),
elevation: 0,
backgroundColor: ALColors.ColorFFFFFF,
leading: baseText(
"消息", ScreenUtil.instance.setSp(20.0), ALColors.Color323232),
),
body: SmartRefresher(
enablePullDown: false,
......@@ -234,7 +242,8 @@ class _MessagePageState extends BasePage<MessagePage> {
void dispose() {
super.dispose();
_refreshController.dispose();
GlobalEventBus().event.destroy();
eventBusListener?.cancel();
eventBusListenerSync?.cancel();
pageNo = 2;
}
......
......@@ -11,6 +11,7 @@ import 'package:gmalpha_flutter/Annotations/RouterCenterRestore.mark.dart';
import 'package:gmalpha_flutter/commonModel/cache/CacheManager.dart';
import 'package:gmalpha_flutter/commonModel/eventbus/GlobalEventBus.dart';
import 'package:gmalpha_flutter/commonModel/eventbus/event/LoginEvent.dart';
import 'package:gmalpha_flutter/commonModel/eventbus/event/SyncMessageEvent.dart';
import 'package:gmalpha_flutter/commonModel/net/Api.dart';
import 'package:gmalpha_flutter/commonModel/net/DioUtil.dart';
import 'package:rxdart/rxdart.dart';
......@@ -87,6 +88,12 @@ void _onEvent(Object event) {
if (event == null) {
return;
}
Map map = event as Map;
if (map["syncMessage"] != null && map["syncMessage"]) {
GlobalEventBus().event.fire(SyncMessageEvent());
return;
}
String cookie = (event as Map)["Cookie"];
if (cookie != null) {
......
/*
* @author lsy
* @date 2019-10-24
**/
class SyncMessageEvent {
SyncMessageEvent();
}
import 'dart:convert';
import 'dart:io';
import 'package:dio/dio.dart';
import 'package:gmalpha_flutter/commonModel/cache/CacheManager.dart';
import 'package:gmalpha_flutter/commonModel/net/Api.dart';
import 'package:gmalpha_flutter/commonModel/toast/toast.dart';
......@@ -105,15 +106,57 @@ class DioUtil {
}
static var interceptor = InterceptorsWrapper(onRequest: (opt) {
var headers = opt.headers;
if (addHeadMap != null) {
print("请求之前");
print("BASEURL!! ${opt.baseUrl}");
addHeadMap.forEach((k, v) {
headers.putIfAbsent(k, () => v);
print("HEADDD ${k} ${v}");
});
var queryParameters = opt.queryParameters;
Map<String, dynamic> map;
if (queryParameters != null) {
map = queryParameters;
} else {
map = new Map<String, dynamic>();
}
map.putIfAbsent(
"app_name",
() =>
CacheManager.getInstance().get(MEMORY_CACHE).get("app_name") ?? "");
map.putIfAbsent(
"version",
() =>
CacheManager.getInstance().get(MEMORY_CACHE).get("version") ?? "");
map.putIfAbsent("platform", () => Platform.isAndroid ? "android" : "ios");
map.putIfAbsent(
"device_id",
() =>
CacheManager.getInstance().get(MEMORY_CACHE).get("device_id") ??
"");
map.putIfAbsent(
"os_version",
() =>
CacheManager.getInstance().get(MEMORY_CACHE).get("os_version") ??
"");
map.putIfAbsent("model",
() => CacheManager.getInstance().get(MEMORY_CACHE).get("model") ?? "");
map.putIfAbsent("lat",
() => CacheManager.getInstance().get(MEMORY_CACHE).get("lat") ?? "");
map.putIfAbsent("lng",
() => CacheManager.getInstance().get(MEMORY_CACHE).get("lng") ?? "");
map.putIfAbsent(
"channel",
() =>
CacheManager.getInstance().get(MEMORY_CACHE).get("channel") ?? "");
map.putIfAbsent(
"current_city_id",
() =>
CacheManager.getInstance()
.get(MEMORY_CACHE)
.get("current_city_id") ??
"");
map.putIfAbsent(
"manufacturer",
() =>
CacheManager.getInstance().get(MEMORY_CACHE).get("manufacturer") ??
"");
map.putIfAbsent("uuid",
() => CacheManager.getInstance().get(MEMORY_CACHE).get("uuid") ?? "");
opt.queryParameters = map;
}, onResponse: (response) {
print("响应之前 response${response}");
}, onError: (e) {
......@@ -125,12 +168,6 @@ class DioUtil {
_dio.interceptors.add(interceptor);
}
set addHead(Map<String, dynamic> map) {
if (map != null) {
addHeadMap = map;
}
}
void setProxy(String proxy) {
(_dio.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate =
(client) {
......
......@@ -2,6 +2,7 @@
* @author lsy
* @date 2019-10-18
**/
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:gmalpha_flutter/ActivityReportModel/page/ActivityReportPage.dart';
......@@ -12,7 +13,6 @@ class BaseCenterPicker extends StatefulWidget {
ICenterPicker picker;
bool cancelOutSide = true;
setPicker(ICenterPicker picker) {
this.picker = picker;
centerState?.setState(() {});
......@@ -39,12 +39,11 @@ class BaseCenterPicker extends StatefulWidget {
}
class BaseCenterPickerState extends State<BaseCenterPicker> {
@override
Widget build(BuildContext context) {
ScreenUtil.instance = ScreenUtil(width: 375, height: 667)..init(context);
return Container(
return CupertinoFullscreenDialogTransition(
child: Container(
color: Colors.black54,
width: double.maxFinite,
height: double.maxFinite,
......@@ -64,7 +63,7 @@ class BaseCenterPickerState extends State<BaseCenterPicker> {
))
],
),
);
));
}
}
......
......@@ -45,20 +45,12 @@ class _MyAppState extends State<MyApp> {
super.initState();
FlutterBoost.singleton.registerPageBuilders({
'comment_suggest': (pageName, params, _) {
// if (!Api.getInstance().setDioCookie(params) ||
// params["fromPage"] == null) {
// return ErrorPage("出错:需要传递的参数为空");
// }
return RouterCenterImpl()
.findUserRouter()
?.getCommentPage(params["fromPage"]);
},
'message_home': (pageName, params, _) {
print("PARAMS!! ${params}");
// if (!Api.getInstance().setDioCookie(params) ||
// params["fromPage"] == null) {
// return ErrorPage("出错:需要传递的参数为空");
// }
return RouterCenterImpl()
.findNewMessageRouter()
?.getMessagePage(params["fromPage"]);
......@@ -80,30 +72,18 @@ class _MyAppState extends State<MyApp> {
},
"prestige": (pageName, params, _) {
print("PARAMS!! ${params}");
// if (!Api.getInstance().setDioCookie(params) ||
// params["fromPage"] == null) {
// return ErrorPage("出错:需要传递的参数为空");
// }
int userId = int.parse(params["userId"]);
return RouterCenterImpl().findPrestigeRouter()?.getReputationsPage(
userId, params["userName"], params["fromPage"]);
},
"user_setting": (pageName, params, _) {
print("PARAMS!! ${params}");
// if (!Api.getInstance().setDioCookie(params) ||
// params["fromPage"] == null) {
// return ErrorPage("出错:需要传递的参数为空");
// }
return RouterCenterImpl()
.findUserRouter()
?.getUserSettingPage(params["userId"] ?? "", params["fromPage"]);
},
"activity_report": (pageName, params, _) {
print("PARAMS!! ${params}");
// if (!Api.getInstance().setDioCookie(params) ||
// params["fromPage"] == null) {
// return ErrorPage("出错:需要传递的参数为空");
// }
return RouterCenterImpl()
.findActivityReportRouter()
?.getActivityReportPage(
......@@ -116,28 +96,16 @@ class _MyAppState extends State<MyApp> {
params["fromPage"]);
},
"message_focus": (pageName, params, _) {
// if (!Api.getInstance().setDioCookie(params) ||
// params["fromPage"] == null) {
// return ErrorPage("出错:需要传递的参数为空");
// }
return RouterCenterImpl()
.findNewMessageRouter()
?.getFocusPage(params["fromPage"]);
},
"message_attention": (pageName, params, _) {
// if (!Api.getInstance().setDioCookie(params) ||
// params["fromPage"] == null) {
// return ErrorPage("出错:需要传递的参数为空");
// }
return RouterCenterImpl()
.findNewMessageRouter()
?.getAttentionPage(params["fromPage"]);
},
"message_like": (pageName, params, _) {
// if (!Api.getInstance().setDioCookie(params) ||
// params["fromPage"] == null) {
// return ErrorPage("出错:需要传递的参数为空");
// }
return RouterCenterImpl()
.findNewMessageRouter()
?.getLikePage(params["fromPage"]);
......
......@@ -24,10 +24,6 @@ class UserRouterImpl implements UserRouter {
@override
void loginChangeUserID(String userId) {
UserEntityImpl().getuserId().listen((value) {
if (value != userId) {
UserEntityImpl().saveuserId("");
}
});
UserEntityImpl().saveuserId("");
}
}
......@@ -59,6 +59,7 @@ class UserState extends BasePage<UserSettingPage> {
}, () {
logoutPicker.dismiss(context);
});
logoutPicker.setPicker(userLogoutPicker);
}
@override
......@@ -93,8 +94,8 @@ class UserState extends BasePage<UserSettingPage> {
} else {
return GestureDetector(
onTap: () {
logoutPicker.setPicker(baseLoadingItem);
logoutPicker.show(context);
BaseCenterPicker()..setPicker(BaseLoadingItem("加载中"))
..setCancelOutside(true)..show(context);
_model.save(context);
},
child: Padding(
......@@ -245,7 +246,6 @@ class UserState extends BasePage<UserSettingPage> {
right: ScreenUtil.instance.setWidth(30)),
child: OutlineButton(
onPressed: () {
logoutPicker.setPicker(userLogoutPicker);
logoutPicker.show(context);
},
child: baseText("退出登入", 14, ALColors.Color323232),
......
......@@ -44,7 +44,7 @@ class Data {
String profilePic;
int gender;
String age;
Null cityId;
String cityId;
String countryId;
double birth;
bool isBind;
......
......@@ -52,7 +52,7 @@ class Data {
bool logined;
bool hasAnswered;
bool hasScanFace;
Null insBindId;
String insBindId;
String questionUrl;
bool detailSetted;
CountryInfo countryInfo;
......
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