/*
*@Author: XianKaiQun
*@Date: 2020-04-20 17:49:13
 * @LastEditors: XianKaiQun
 * @LastEditTime: 2020-08-19 19:25:38
*@Descripttion: 
*/
import 'dart:async';
import 'dart:ui' as ui;

import 'package:flutter/widgets.dart';

///屏幕适配
///在main中调用这个异步函数 init()   务必要await 后再runApp（）
class WisAdaptUtil {
  static Future init() async {
    Completer<bool> completer = Completer<bool>();
    Timer.periodic(
      Duration(microseconds: 1),
      (timer) {
        if (ui.window.physicalSize != Size.zero) {
          timer.cancel();
          completer.complete(true);
        } else {}
      },
    );
    return completer.future;
  }
}
