| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- import 'package:flutter/material.dart';
- import 'package:dio/dio.dart';
- import '../showAlert.dart';
- import 'package:intl/intl.dart';
- bool isNotError(BuildContext context,json){
- //print('-----------'+json+'----------');
- if(json is DioError){
- alertError(context, json.toString());
- return false;
- }else if( json.data['success']&& json.data['code']==1){
- return true;
- }else{
- alertError(context, json.data['msg']);
- return false;
- }
- }
- alertError(BuildContext context,String str){
- showDialog < Null > (
- context: context, //BuildContext对象
- barrierDismissible: false,
- builder: (BuildContext context) {
- return MyAlertDialog( //调用对话框
- text: str, childCallback: (val) {
-
- },
- );
- });
- }
- bool isChinaPhoneLegal(String str) {
- return new RegExp('^((13[0-9])|(15[^4])|(166)|(17[0-8])|(18[0-9])|(19[8-9])|(147,145))\\d{8}\$').hasMatch(str);
- }
- String fromatDate(int myDate){
- var now = DateTime.fromMicrosecondsSinceEpoch(myDate*1000);
- var formatter = new DateFormat('yyyy-MM-dd HH:mm:ss');
- String date = formatter.format(now);
- return date;
- }
|