admin
2021-12-03 f092e392700f68cdbfc545c9801f530d19fd39fa
lib/main.dart
@@ -5,8 +5,12 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:locations/api/http.dart';
import 'package:locations/utils/ad_util.dart';
import 'package:locations/utils/app_util.dart';
import 'package:locations/utils/config_util.dart';
import 'package:locations/utils/pageutils.dart';
import 'package:locations/utils/permission_util.dart';
import 'package:locations/utils/ui_utils.dart';
import 'package:locations/utils/user_util.dart';
import 'package:permission_handler/permission_handler.dart';
@@ -14,6 +18,7 @@
import 'ui/main/main.dart';
import 'ui/widget/dialog.dart';
import 'utils/ui_constant.dart';
import 'utils/global.dart';
void main() {
  if (Platform.isAndroid) {
@@ -34,21 +39,21 @@
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
          // This is the theme of your application.
          //
          // Try running your application with "flutter run". You'll see the
          // application has a blue toolbar. Then, without quitting the app, try
          // changing the primarySwatch below to Colors.green and then invoke
          // "hot reload" (press "r" in the console where you ran "flutter run",
          // or simply save your changes to "hot reload" in a Flutter IDE).
          // Notice that the counter didn't reset back to zero; the application
          // is not restarted.
        title: 'Flutter Demo',
        theme: ThemeData(
            // This is the theme of your application.
            //
            // Try running your application with "flutter run". You'll see the
            // application has a blue toolbar. Then, without quitting the app, try
            // changing the primarySwatch below to Colors.green and then invoke
            // "hot reload" (press "r" in the console where you ran "flutter run",
            // or simply save your changes to "hot reload" in a Flutter IDE).
            // Notice that the counter didn't reset back to zero; the application
            // is not restarted.
          primaryColor: Color(0xFFFFFFFF)),
      home: SplashPage(title: ''),
    );
            primaryColor: Color(0xFFFFFFFF)),
        home: SplashPage(title: ''),
        navigatorKey: navigatorKey);
  }
}
@@ -73,51 +78,41 @@
class _SplashPageState extends State<SplashPage>
    with SingleTickerProviderStateMixin {
  int selectIndex = 1;
  Widget? _splash;
  @override
  void initState() {
    super.initState();
    // Timer(const Duration(seconds: 5), () {
    //   Navigator.of(context).push(CustomRouteSlide(MainPage(title: "")));
    // });
    Timer(const Duration(seconds: 2), () {
      // Navigator.of(context).push(CustomRouteSlide(MainPage(title: "")));
      // showGeneralDialog(context: context,
      //     pageBuilder: (BuildContext buildContext, Animation<double> animation,
      //         Animation<double> secondaryAnimation) {
      //       return PermissionNotifyDialog(() {
      //         Navigator.of(context).pop();
      //         Navigator.of(context).push(CustomRouteSlide(MainPage(title: "")));
      //       });
      //     });
    });
    // showDialog(
    //     context: context,
    //     builder: (context) => PermissionNotifyDialog((){
    //       Navigator.of(context).push(CustomRouteSlide(MainPage(title: "")));
    //     }));
// String content="欢迎您使用百度地图服务!<a href='http://www.baidu.com'> http://www.baidu.com </a> 我们非常重视您的隐私保护和个人信息保护。本隐私政策适用于您通过任何方式对百度地图各项服务的访问和使用。您可以利用百度地图搜索路况信息、商家信息、定位您所在的位置,进行路径规划、导航您想去的地址,搜索周边的服务等(以下统称“百度地图产品或服务”)。您具体获得的百度地图服务内容可能因为您使用的百度地图的版本及搭载设备不同而有所差异,如果在部分版本或搭载设备中不涵盖某些服务内容或未提供特定功能(例如:部分版本不支持登录,我们可能无法为您提供第三方服务以及其他登录后才能使用的功能;手表等穿戴设备暂时只支持步骑行的路线规划及导航,所以我们在穿戴设备上搭载的地图无法为您提供如驾车路线规划及导航等其他功能),本隐私政策中涉及到上述服务/功能及相关个人信息的内容将不适用。您可以通过多种不同的方式来使用我们的产品和服务,包括百度地图的网站、软件、供第三方网站和应用程序使用的百度地图软件开发工具包(SDK)和应用程序编程接口(API)、车载导航仪、智能后视镜等智能硬件设备。";
//       showDialog(
//           context: context,
//           builder: (context) => NotifyDialog("用户协议&隐私政策", content, () {}, () {},richText: true,height: 400,));
  }
  void init() {
    AppUtil.initApp(context).then((value) {
      //TODO 显示开屏广告
  void init() async {
    //请求配置信息
    var value = await ConfigApiUtil.getConfig();
    if (value != null) {
      ConfigUtil.saveConfig(value["data"]);
    }
    bool result = await AppUtil.initApp(context);
    double width = MediaQuery.of(context).size.width;
    double height = MediaQuery.of(context).size.height;
    Widget? splash = CSJAdUtil.loadSplash("887634894",width,height-94, (success, msg) {
      NavigatorUtil.navigateToNextPageWithFinish(context,
          MaterialPageRoute(builder: (context) {
        return MainPage(title: "");
      }));
    });
    setState(() {
      _splash = splash;
    });
  }
  Future requestPermission() async {
    await Permission.phone.request();
    await Permission.storage.request();
    await Permission.location.request();
    await PermissionUtil.openPermission(Permission.phone);
    await PermissionUtil.openPermission(Permission.locationAlways);
    return;
  }
@@ -168,20 +163,23 @@
              direction: Axis.vertical,
              children: [
                Expanded(
                    child: Container(
                  alignment: Alignment.center,
                  padding: EdgeInsets.all(72),
                  color: Colors.white,
                  child: Image.asset("assets/images/ic_splash.png"),
                )),
                    child: Stack(children: [
                  Container(
                    alignment: Alignment.center,
                    padding: const EdgeInsets.all(72),
                    color: Colors.white,
                    child: Image.asset("assets/images/ic_splash.png"),
                  ),
                  _splash != null ? _splash! : Container()
                ])),
                Container(
                  alignment: Alignment.center,
                  color: Color(0xFFF8F8F8),
                  color: const Color(0xFFF8F8F8),
                  height: 94,
                  child: Flex(
                    direction: Axis.vertical,
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: [
                    children: const [
                      Text(
                        "定位追踪轨迹",
                        style: