/*
 * @author lsy
 * @date   2019-10-08
 **/
import 'dart:ui';

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:gmalpha_flutter/Annotations/RouterCenterRestore.mark.dart';

abstract class BasePage<T extends StatefulWidget> extends State<T> {
  var startTime;

  double screenWidth = window.physicalSize.width;
  double screenHeight = window.physicalSize.height;

  String pageName();

  String referrer();

  @override
  void initState() {
    super.initState();
    startTime = DateTime.now().millisecondsSinceEpoch;
  }

  void pageStop(){
    RouterCenterImpl().findBuriedRouter()?.onPageEnd(
        pageName(), "$startTime", "${DateTime.now().millisecondsSinceEpoch}",
        referrer: referrer());
  }

  @override
  void dispose() {
    super.dispose();
    print("lsy SENDDDD  ");
    RouterCenterImpl().findBuriedRouter()?.onPageEnd(
        pageName(), "$startTime", "${DateTime.now().millisecondsSinceEpoch}",
        referrer: referrer());
  }
}
