Commit 6b776015bb161fe63d8a70f8777c3bd7341c1889

Authored by “gaiyaguang”
2 parents cc1b4797 4dd4bae7

合并

  1 +import 'dart:io';
  2 +
1 import 'package:dio/dio.dart'; 3 import 'package:dio/dio.dart';
2 import 'package:fluro/fluro.dart'; 4 import 'package:fluro/fluro.dart';
3 import 'package:flutter/material.dart'; 5 import 'package:flutter/material.dart';
@@ -10,6 +12,7 @@ import 'package:one_key/pages/detail/handle_online_page.dart'; @@ -10,6 +12,7 @@ import 'package:one_key/pages/detail/handle_online_page.dart';
10 import 'package:one_key/provider/message_dialog_model.dart'; 12 import 'package:one_key/provider/message_dialog_model.dart';
11 import 'package:intl/date_symbol_data_local.dart'; 13 import 'package:intl/date_symbol_data_local.dart';
12 import 'package:one_key/provider/tools.dart'; 14 import 'package:one_key/provider/tools.dart';
  15 +import 'package:one_key/utils/navigator_util.dart';
13 import 'package:one_key/utils/utils.dart'; 16 import 'package:one_key/utils/utils.dart';
14 import 'package:provider/provider.dart'; 17 import 'package:provider/provider.dart';
15 import 'package:tpns_flutter_plugin/tpns_flutter_plugin.dart'; 18 import 'package:tpns_flutter_plugin/tpns_flutter_plugin.dart';
@@ -64,6 +67,8 @@ class MyApp extends StatefulWidget { @@ -64,6 +67,8 @@ class MyApp extends StatefulWidget {
64 67
65 class MyAppState extends State<MyApp> { 68 class MyAppState extends State<MyApp> {
66 69
  70 + int xgCount=1;//注册信鸽次数,最多5次
  71 +
67 @override 72 @override
68 void initState() { 73 void initState() {
69 // TODO: implement initState 74 // TODO: implement initState
@@ -177,6 +177,13 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { @@ -177,6 +177,13 @@ class HandleOnlinePageState extends State<HandleOnlinePage> {
177 MyAppBar( 177 MyAppBar(
178 "在线预订详情", 178 "在线预订详情",
179 showBack: true, 179 showBack: true,
  180 + callback: (){
  181 + if(widget.fromNotify){
  182 + NavigatorUtil.goHomePage(context,initialIndex: 0);
  183 + }else{
  184 + Navigator.of(context).pop();
  185 + }
  186 + },
180 ), 187 ),
181 Expanded( 188 Expanded(
182 child: DefaultTextStyle( 189 child: DefaultTextStyle(
@@ -391,6 +391,13 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { @@ -391,6 +391,13 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
391 MyAppBar( 391 MyAppBar(
392 "订座详情", 392 "订座详情",
393 showBack: true, 393 showBack: true,
  394 + callback: (){
  395 + if(widget.fromNotify){
  396 + NavigatorUtil.goHomePage(context,initialIndex: 0);
  397 + }else{
  398 + Navigator.of(context).pop();
  399 + }
  400 + },
394 ), 401 ),
395 Expanded( 402 Expanded(
396 child: DefaultTextStyle( 403 child: DefaultTextStyle(
1 import 'dart:async'; 1 import 'dart:async';
  2 +import 'dart:convert';
2 import 'dart:io'; 3 import 'dart:io';
3 import 'package:flutter/cupertino.dart'; 4 import 'package:flutter/cupertino.dart';
4 import 'package:flutter/material.dart'; 5 import 'package:flutter/material.dart';
@@ -65,10 +66,12 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { @@ -65,10 +66,12 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
65 create: (_) => MyModel(), 66 create: (_) => MyModel(),
66 child: MyPage(), 67 child: MyPage(),
67 )); 68 ));
68 - WidgetsBinding.instance.addPostFrameCallback((_) {  
69 - if (widget.initialIndex == 0) return;  
70 - _getIntent();  
71 - Future.delayed(Duration(milliseconds: 300), () { 69 + WidgetsBinding.instance.addPostFrameCallback((_){
  70 + if(widget.initialIndex==0)return;
  71 + if(Platform.isAndroid){
  72 + _getIntent();
  73 + }
  74 + Future.delayed(Duration(milliseconds: 300),(){
72 initPlatformState(); 75 initPlatformState();
73 }); 76 });
74 Future.delayed(Duration(milliseconds: 30000), () { 77 Future.delayed(Duration(milliseconds: 30000), () {
@@ -159,9 +162,9 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { @@ -159,9 +162,9 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
159 }, 162 },
160 xgPushClickAction: (Map<String, dynamic> msg) async { 163 xgPushClickAction: (Map<String, dynamic> msg) async {
161 print("flutter xgPushClickAction ${msg['custom']}"); 164 print("flutter xgPushClickAction ${msg['custom']}");
162 - if (Platform.isIOS && msg != null && msg['custom'] != null) {  
163 - Map<String, dynamic> custom = msg['custom'];  
164 - switch (custom["messageType"].toString()) { 165 + if(Platform.isIOS&&msg!=null&&msg['custom']!=null){
  166 + Map<String,dynamic> custom=jsonDecode(msg['custom'].toString());
  167 + switch(custom["messageType"].toString()){
165 case "10": 168 case "10":
166 NavigatorUtil.goNotebookDetailPage( 169 NavigatorUtil.goNotebookDetailPage(
167 context, custom['rid'].toString(), 170 context, custom['rid'].toString(),
@@ -250,14 +250,20 @@ class NoteBookPageState extends State<NoteBookPage> { @@ -250,14 +250,20 @@ class NoteBookPageState extends State<NoteBookPage> {
250 if (Utils.isOneDay(day, dateTime)) return; //日期没变 250 if (Utils.isOneDay(day, dateTime)) return; //日期没变
251 setState(() { 251 setState(() {
252 DateTime dateNow = DateTime.now(); 252 DateTime dateNow = DateTime.now();
  253 + dateText =
  254 + Utils.addZeroNumber(day.month) + "-" +Utils.addZeroNumber(day.day);
253 if (Utils.isOneDay(day, dateNow)) { 255 if (Utils.isOneDay(day, dateNow)) {
254 - dateText = Utils.addZeroNumber(dateNow.month) +  
255 - "-" +  
256 - Utils.addZeroNumber(dateNow.day) + 256 + dateText +=
257 " 今天"; 257 " 今天";
258 - } else {  
259 - dateText =  
260 - Utils.addZeroNumber(day.month) + "-" + Utils.addZeroNumber(day.day); 258 + } else if(Utils.isOneDay(day,dateNow.add(Duration(days: 1)))){
  259 + dateText +=
  260 + " 明天";
  261 + }else if(Utils.isOneDay(day,dateNow.add(Duration(days: 2)))){
  262 + dateText +=
  263 + " 后天";
  264 + }else{
  265 + dateText +=
  266 + " 周${Utils.formatWeekDayNum(day.weekday)}";
261 } 267 }
262 dateTime = day; 268 dateTime = day;
263 }); 269 });
@@ -142,6 +142,20 @@ class DialogUtil { @@ -142,6 +142,20 @@ class DialogUtil {
142 messageModel.showMessageDialog=false; 142 messageModel.showMessageDialog=false;
143 } 143 }
144 144
  145 + //解析返回显示的日期
  146 + static String _parseDateDay(DateTime dateTime){
  147 + DateTime now=DateTime.now();
  148 + if(Utils.isOneDay(dateTime,now)){
  149 + return "今";
  150 + }else if(Utils.isOneDay(dateTime,now.add(Duration(days: 1)))){
  151 + return "明";
  152 + }else if(Utils.isOneDay(dateTime,now.add(Duration(days: 2)))){
  153 + return "后";
  154 + }else{
  155 + return dateTime.day.toString();
  156 + }
  157 + }
  158 +
145 //显示日历弹框 159 //显示日历弹框
146 static Future<DateTime> showCalendarDialog(BuildContext context,DateTime selectDateTime) { 160 static Future<DateTime> showCalendarDialog(BuildContext context,DateTime selectDateTime) {
147 CalendarController _calendarController = CalendarController(); 161 CalendarController _calendarController = CalendarController();
@@ -214,6 +228,23 @@ class DialogUtil { @@ -214,6 +228,23 @@ class DialogUtil {
214 ), 228 ),
215 ); 229 );
216 }, 230 },
  231 + dayBuilder: (context,date,_){
  232 + return Container(
  233 + decoration: BoxDecoration(
  234 + shape: BoxShape.circle,
  235 + ),
  236 + alignment: Alignment.center,
  237 + margin: const EdgeInsets.all(6.0),
  238 + padding: const EdgeInsets.only(
  239 + bottom: 4.0, left: 8.0, right: 8.0, top: 4.0),
  240 + child: Text(
  241 + "${_parseDateDay(date)}",
  242 + style: TextStyle().copyWith(
  243 + fontSize: ScreenUtil().setSp(32),
  244 + color: MyColours.color_353535),
  245 + ),
  246 + );
  247 + },
217 selectedDayBuilder: (context, date, _) { 248 selectedDayBuilder: (context, date, _) {
218 return Container( 249 return Container(
219 decoration: BoxDecoration( 250 decoration: BoxDecoration(
@@ -225,9 +256,7 @@ class DialogUtil { @@ -225,9 +256,7 @@ class DialogUtil {
225 padding: const EdgeInsets.only( 256 padding: const EdgeInsets.only(
226 bottom: 4.0, left: 8.0, right: 8.0, top: 4.0), 257 bottom: 4.0, left: 8.0, right: 8.0, top: 4.0),
227 child: Text( 258 child: Text(
228 - date.day == DateTime  
229 - .now()  
230 - .day ? '今' : date.day.toString(), 259 + "${_parseDateDay(date)}",
231 style: TextStyle().copyWith( 260 style: TextStyle().copyWith(
232 fontSize: ScreenUtil().setSp(32), 261 fontSize: ScreenUtil().setSp(32),
233 color: MyColours.color_ffffff), 262 color: MyColours.color_ffffff),
  1 +
1 import 'package:flutter/material.dart'; 2 import 'package:flutter/material.dart';
2 import 'package:flutter_screenutil/flutter_screenutil.dart'; 3 import 'package:flutter_screenutil/flutter_screenutil.dart';
3 import 'package:one_key/res/colors.dart'; 4 import 'package:one_key/res/colors.dart';
4 5
5 class MyAppBar extends StatelessWidget { 6 class MyAppBar extends StatelessWidget {
6 - MyAppBar(this.title, {this.showBack = true,this.backgroundColor=MyColours.color_ffffff,this.fontColor=MyColours.color_131313});  
7 7
  8 + MyAppBar(this.title, {this.showBack = true,this.backgroundColor=MyColours.color_ffffff,this.fontColor=MyColours.color_131313, this.callback});
  9 + final VoidCallback callback;//返回回调
8 final String title;//标题文字 10 final String title;//标题文字
9 final bool showBack;//是否显示返回按钮 11 final bool showBack;//是否显示返回按钮
10 final Color backgroundColor;//背景色 12 final Color backgroundColor;//背景色
@@ -24,7 +26,11 @@ class MyAppBar extends StatelessWidget { @@ -24,7 +26,11 @@ class MyAppBar extends StatelessWidget {
24 left: 0, 26 left: 0,
25 child: showBack?GestureDetector( 27 child: showBack?GestureDetector(
26 onTap: () { 28 onTap: () {
27 - Navigator.of(context).pop(); 29 + if(this.callback!=null){
  30 + this.callback();
  31 + }else{
  32 + Navigator.of(context).pop();
  33 + }
28 }, 34 },
29 behavior: HitTestBehavior.opaque, 35 behavior: HitTestBehavior.opaque,
30 child: Padding( 36 child: Padding(