Commit 1feec80ff0252f99b14a521a2f0e903d82aea87c

Authored by gaiyaguang
1 parent f4b98757

OneKey-debug-v1.0.5

@@ -69,11 +69,11 @@ class MyAppState extends State<MyApp>{ @@ -69,11 +69,11 @@ class MyAppState extends State<MyApp>{
69 await registerWxApi( 69 await registerWxApi(
70 appId: "wx85aa3cdd0f791e65", 70 appId: "wx85aa3cdd0f791e65",
71 doOnAndroid: true, 71 doOnAndroid: true,
72 - doOnIOS: true,  
73 - universalLink: "https://your.univerallink.com/link/");  
74 - var result = await isWeChatInstalled;  
75 - LogUtil.v("is installed $result");  
76 - } 72 + doOnIOS: true,
  73 + universalLink: "https://your.univerallink.com/link/");
  74 + var result = await isWeChatInstalled;
  75 + LogUtil.v("is installed $result");
  76 +}
77 77
78 initDio() { 78 initDio() {
79 DioUtil.openDebug(); 79 DioUtil.openDebug();
@@ -17,6 +17,7 @@ import 'package:one_key/provider/user_model.dart'; @@ -17,6 +17,7 @@ import 'package:one_key/provider/user_model.dart';
17 import 'package:one_key/res/colors.dart'; 17 import 'package:one_key/res/colors.dart';
18 import 'package:one_key/route/navigate_service.dart'; 18 import 'package:one_key/route/navigate_service.dart';
19 import 'package:one_key/utils/log_util.dart'; 19 import 'package:one_key/utils/log_util.dart';
  20 +import 'package:one_key/utils/navigator_util.dart';
20 import 'package:one_key/utils/utils.dart'; 21 import 'package:one_key/utils/utils.dart';
21 import 'package:provider/provider.dart'; 22 import 'package:provider/provider.dart';
22 import 'package:flutter/services.dart'; 23 import 'package:flutter/services.dart';
@@ -71,7 +72,6 @@ class HomePageState extends State<HomePage>{ @@ -71,7 +72,6 @@ class HomePageState extends State<HomePage>{
71 72
72 Future<void> initJPush() async { 73 Future<void> initJPush() async {
73 try { 74 try {
74 - jpush.resumePush();  
75 jpush.addEventHandler( 75 jpush.addEventHandler(
76 onReceiveNotification: (Map<String, dynamic> message) async { 76 onReceiveNotification: (Map<String, dynamic> message) async {
77 LogUtil.v("flutter onReceiveNotification: $message"); 77 LogUtil.v("flutter onReceiveNotification: $message");
@@ -79,6 +79,7 @@ class HomePageState extends State<HomePage>{ @@ -79,6 +79,7 @@ class HomePageState extends State<HomePage>{
79 Provider.of<MessageDialogModel>(context,listen: false).addMessage(context,Message.fromJson(messageMap)); 79 Provider.of<MessageDialogModel>(context,listen: false).addMessage(context,Message.fromJson(messageMap));
80 }, onOpenNotification: (Map<String, dynamic> message) async { 80 }, onOpenNotification: (Map<String, dynamic> message) async {
81 LogUtil.v("flutter onOpenNotification: $message"); 81 LogUtil.v("flutter onOpenNotification: $message");
  82 + NavigatorUtil.goHomePage(context,initialIndex: 0);
82 }, onReceiveMessage: (Map<String, dynamic> message) async { 83 }, onReceiveMessage: (Map<String, dynamic> message) async {
83 LogUtil.v("flutter onReceiveMessage: $message"); 84 LogUtil.v("flutter onReceiveMessage: $message");
84 }, onReceiveNotificationAuthorization: 85 }, onReceiveNotificationAuthorization:
@@ -102,6 +103,7 @@ class HomePageState extends State<HomePage>{ @@ -102,6 +103,7 @@ class HomePageState extends State<HomePage>{
102 LogUtil.v("flutter get registration id : $rid"); 103 LogUtil.v("flutter get registration id : $rid");
103 userTokenInit(rid); 104 userTokenInit(rid);
104 }); 105 });
  106 + jpush.openSettingsForNotification();
105 jpush.isNotificationEnabled().then((bool value) { 107 jpush.isNotificationEnabled().then((bool value) {
106 if (!value) { 108 if (!value) {
107 //没有打开通知 109 //没有打开通知
@@ -135,7 +137,7 @@ class HomePageState extends State<HomePage>{ @@ -135,7 +137,7 @@ class HomePageState extends State<HomePage>{
135 MessageDialogModel messageModel=Provider.of<MessageDialogModel>(context,listen: false); 137 MessageDialogModel messageModel=Provider.of<MessageDialogModel>(context,listen: false);
136 messageModel.getUntreatedMsg(context, params); 138 messageModel.getUntreatedMsg(context, params);
137 } 139 }
138 - 140 +
139 @override 141 @override
140 Widget build(BuildContext context) { 142 Widget build(BuildContext context) {
141 // TODO: implement build 143 // TODO: implement build
@@ -219,6 +221,5 @@ class HomePageState extends State<HomePage>{ @@ -219,6 +221,5 @@ class HomePageState extends State<HomePage>{
219 // TODO: implement dispose 221 // TODO: implement dispose
220 super.dispose(); 222 super.dispose();
221 LogUtil.v("home_dispose"); 223 LogUtil.v("home_dispose");
222 - jpush.stopPush();  
223 } 224 }
224 } 225 }
1 import 'dart:convert'; 1 import 'dart:convert';
2 2
3 import 'package:flutter/material.dart'; 3 import 'package:flutter/material.dart';
  4 +import 'package:jpush_flutter/jpush_flutter.dart';
4 import 'package:one_key/constant/constant.dart'; 5 import 'package:one_key/constant/constant.dart';
5 import 'package:one_key/models/user.dart'; 6 import 'package:one_key/models/user.dart';
6 import 'package:one_key/net/base_resp.dart'; 7 import 'package:one_key/net/base_resp.dart';
@@ -91,6 +92,7 @@ class UserModel with ChangeNotifier { @@ -91,6 +92,7 @@ class UserModel with ChangeNotifier {
91 user['night'] = daily['night']; 92 user['night'] = daily['night'];
92 _saveUserInfo(User.fromJson(user)); 93 _saveUserInfo(User.fromJson(user));
93 App.sp.setBool("isLogin", true); 94 App.sp.setBool("isLogin", true);
  95 + new JPush().resumePush();
94 NavigatorUtil.goHomePage(context); 96 NavigatorUtil.goHomePage(context);
95 return null; 97 return null;
96 } 98 }
@@ -119,6 +121,7 @@ class UserModel with ChangeNotifier { @@ -119,6 +121,7 @@ class UserModel with ChangeNotifier {
119 Utils.showToast(baseResp.msg ?? "退出登录失败,请稍后重试"); 121 Utils.showToast(baseResp.msg ?? "退出登录失败,请稍后重试");
120 } else { 122 } else {
121 App.sp.setBool("isLogin", false); 123 App.sp.setBool("isLogin", false);
  124 + new JPush().stopPush();
122 NavigatorUtil.goLoginPage(context); 125 NavigatorUtil.goLoginPage(context);
123 } 126 }
124 } 127 }
@@ -145,12 +145,13 @@ class DialogUtil { @@ -145,12 +145,13 @@ class DialogUtil {
145 messageModel.showMessageDialog=false; 145 messageModel.showMessageDialog=false;
146 } 146 }
147 147
148 - //显示消息弹框 148 + //显示日历弹框
149 static Future<DateTime> showCalendarDialog(BuildContext context,DateTime selectDateTime) { 149 static Future<DateTime> showCalendarDialog(BuildContext context,DateTime selectDateTime) {
150 CalendarController _calendarController = CalendarController(); 150 CalendarController _calendarController = CalendarController();
151 Map<DateTime, List> _events = {}; 151 Map<DateTime, List> _events = {};
152 return showModalBottomSheet<DateTime>( 152 return showModalBottomSheet<DateTime>(
153 context: context, 153 context: context,
  154 + isScrollControlled:true,
154 builder: (BuildContext context) { 155 builder: (BuildContext context) {
155 BuildContext dialogContext = context; 156 BuildContext dialogContext = context;
156 Widget widget = StatefulBuilder(builder: (context, _setState) { 157 Widget widget = StatefulBuilder(builder: (context, _setState) {
@@ -173,6 +174,7 @@ class DialogUtil { @@ -173,6 +174,7 @@ class DialogUtil {
173 headerStyle: HeaderStyle( 174 headerStyle: HeaderStyle(
174 decoration: BoxDecoration( 175 decoration: BoxDecoration(
175 color: MyColours.color_2bb5b7), 176 color: MyColours.color_2bb5b7),
  177 + headerPadding: EdgeInsets.zero,
176 formatButtonVisible: false, 178 formatButtonVisible: false,
177 centerHeaderTitle: true, 179 centerHeaderTitle: true,
178 titleTextBuilder: (dateTime, _) { 180 titleTextBuilder: (dateTime, _) {
@@ -271,34 +273,40 @@ class DialogUtil { @@ -271,34 +273,40 @@ class DialogUtil {
271 ), 273 ),
272 ), 274 ),
273 Positioned( 275 Positioned(
274 - bottom: ScreenUtil().setHeight(7),  
275 right: ScreenUtil().setWidth(62), 276 right: ScreenUtil().setWidth(62),
276 - child: GestureDetector(  
277 - onTap: () {  
278 - _calendarController.setSelectedDay(DateTime.now());  
279 - _setState(() {});  
280 - },  
281 - child: Container(  
282 - child: ClipOval(  
283 - child: Container(  
284 - width: ScreenUtil().setWidth(95),  
285 - height: ScreenUtil().setWidth(95),  
286 - alignment: Alignment.center,  
287 - color: MyColours.color_2bb5b7,  
288 - child: Text(  
289 - "回到\n今天",  
290 - style: TextStyle(  
291 - color: MyColours.color_ffffff,  
292 - fontSize: ScreenUtil().setSp(26)),  
293 - ),  
294 - )), 277 + bottom: ScreenUtil().setHeight(7),
  278 + child: Container(
  279 + child: GestureDetector(
  280 + onTap: () {
  281 + _calendarController.setSelectedDay(DateTime.now());
  282 + _setState(() {});
  283 + },
  284 + child: Container(
  285 + child: ClipOval(
  286 + child: Container(
  287 + width: ScreenUtil().setWidth(95),
  288 + height: ScreenUtil().setWidth(95),
  289 + alignment: Alignment.center,
  290 + color: MyColours.color_2bb5b7,
  291 + child: Text(
  292 + "回到\n今天",
  293 + style: TextStyle(
  294 + color: MyColours.color_ffffff,
  295 + fontSize: ScreenUtil().setSp(26)),
  296 + ),
  297 + )),
  298 + ),
295 ), 299 ),
296 ), 300 ),
297 ) 301 )
298 ], 302 ],
299 ); 303 );
300 }); 304 });
301 - return widget; 305 + return SizedBox(
  306 + width: double.infinity,
  307 + height: ScreenUtil().setWidth(935),
  308 + child: widget,
  309 + );
302 }); 310 });
303 } 311 }
304 312
@@ -51,10 +51,10 @@ class AreaItemState extends State<AreaItem>{ @@ -51,10 +51,10 @@ class AreaItemState extends State<AreaItem>{
51 height: ScreenUtil().setHeight(37), 51 height: ScreenUtil().setHeight(37),
52 alignment: Alignment.center, 52 alignment: Alignment.center,
53 decoration: BoxDecoration( 53 decoration: BoxDecoration(
54 - color: MyColours.color_63a6d1, 54 + color: area.count<=0?MyColours.color_999999:MyColours.color_63a6d1,
55 borderRadius: BorderRadius.only(topRight: Radius.circular(ScreenUtil().setWidth(8)),bottomRight: Radius.circular(ScreenUtil().setWidth(8))) 55 borderRadius: BorderRadius.only(topRight: Radius.circular(ScreenUtil().setWidth(8)),bottomRight: Radius.circular(ScreenUtil().setWidth(8)))
56 ), 56 ),
57 - child: Text("余${area.count}",style: TextStyle(color: MyColours.color_ffffff,fontSize: ScreenUtil().setSp(22),decoration: TextDecoration.none)), 57 + child: Text(area.count<=0?"满座":"余${area.count}",style: TextStyle(color: MyColours.color_ffffff,fontSize: ScreenUtil().setSp(22),decoration: TextDecoration.none)),
58 ), 58 ),
59 ), 59 ),
60 ], 60 ],