admin
2021-11-25 70a344485bd0c9b68ac91f72ed23ec5bfa998b09
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
import 'dart:async';
import 'dart:io';
import 'dart:ui';
 
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:locations/utils/app_util.dart';
import 'package:locations/utils/pageutils.dart';
import 'package:locations/utils/user_util.dart';
import 'package:permission_handler/permission_handler.dart';
 
import 'ui/main/main.dart';
import 'ui/widget/dialog.dart';
import 'utils/ui_constant.dart';
 
void main() {
  if (Platform.isAndroid) {
    SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
      statusBarColor: Colors.transparent,
      systemNavigationBarColor: Color(0xFF000000),
      systemNavigationBarDividerColor: null,
      systemNavigationBarIconBrightness: Brightness.light,
      statusBarIconBrightness: Brightness.dark,
      statusBarBrightness: Brightness.light,
    ));
  }
  runApp(MyApp());
}
 
class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @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.
 
          primaryColor: Color(0xFFFFFFFF)),
      home: SplashPage(title: ''),
    );
  }
}
 
class SplashPage extends StatefulWidget {
  SplashPage({Key? key, required this.title}) : super(key: key);
 
  // This widget is the home page of your application. It is stateful, meaning
  // that it has a State object (defined below) that contains fields that affect
  // how it looks.
 
  // This class is the configuration for the state. It holds the values (in this
  // case the title) provided by the parent (in this case the App widget) and
  // used by the build method of the State. Fields in a Widget subclass are
  // always marked "final".
 
  final String title;
 
  @override
  _SplashPageState createState() => _SplashPageState();
}
 
class _SplashPageState extends State<SplashPage>
    with SingleTickerProviderStateMixin {
  int selectIndex = 1;
 
  @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 显示开屏广告
      NavigatorUtil.navigateToNextPageWithFinish(context,
          MaterialPageRoute(builder: (context) {
        return MainPage(title: "");
      }));
    });
  }
 
 
 
 
  Future requestPermission() async {
    await Permission.phone.request();
    await Permission.storage.request();
    await Permission.location.request();
    return;
  }
 
  @override
  Widget build(BuildContext context) {
    UserUtil.isAgreeProtocol().then((value) {
      if (!value) {
        //弹出用户协议框
        String content =
            "欢迎您使用百度地图服务!<a href='${Constant.PROTOCOL_URL}'> 用户协议 </a>和<a href='${Constant.PRIVACY_URL}'>隐私政策</a>   我们非常重视您的隐私保护和个人信息保护。本隐私政策适用于您通过任何方式对百度地图各项服务的访问和使用。您可以利用百度地图搜索路况信息、商家信息、定位您所在的位置,进行路径规划、导航您想去的地址,搜索周边的服务等(以下统称“百度地图产品或服务”)。您具体获得的百度地图服务内容可能因为您使用的百度地图的版本及搭载设备不同而有所差异,如果在部分版本或搭载设备中不涵盖某些服务内容或未提供特定功能(例如:部分版本不支持登录,我们可能无法为您提供第三方服务以及其他登录后才能使用的功能;手表等穿戴设备暂时只支持步骑行的路线规划及导航,所以我们在穿戴设备上搭载的地图无法为您提供如驾车路线规划及导航等其他功能),本隐私政策中涉及到上述服务/功能及相关个人信息的内容将不适用。您可以通过多种不同的方式来使用我们的产品和服务,包括百度地图的网站、软件、供第三方网站和应用程序使用的百度地图软件开发工具包(SDK)和应用程序编程接口(API)、车载导航仪、智能后视镜等智能硬件设备。";
        showGeneralDialog(
            context: context,
            pageBuilder: (BuildContext buildContext,
                    Animation<double> animation,
                    Animation<double> secondaryAnimation) =>
                NotifyDialog(
                  "用户协议&隐私政策",
                  content,
                  () {
                    Navigator.of(context).pop();
                  },
                  () {
                    UserUtil.setAgreeProtocol().then((value) {
                      if (value) {
                        //弹出权限框
                        showGeneralDialog(
                            context: context,
                            pageBuilder: (BuildContext buildContext,
                                Animation<double> animation,
                                Animation<double> secondaryAnimation) {
                              return PermissionNotifyDialog(() {
                                Navigator.of(context).pop();
                                requestPermission().then((value) {
                                  init();
                                });
                              });
                            });
                      } else {}
                    });
                  },
                  richText: true,
                  height: 400,
                ));
      } else {
        //已经同意了
        init();
      }
    });
 
    return WillPopScope(
        onWillPop: () async {
          return false;
        },
        child: Scaffold(
            backgroundColor: Colors.white,
            body: Flex(
              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"),
                )),
                Container(
                  alignment: Alignment.center,
                  color: Color(0xFFF8F8F8),
                  height: 94,
                  child: Flex(
                    direction: Axis.vertical,
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: [
                      Text(
                        "定位追踪轨迹",
                        style:
                            TextStyle(color: Color(0xFF03B5FF), fontSize: 23),
                      ),
                      SizedBox(
                        height: 15,
                      ),
                      Text(
                        "腾讯云提供网络服务",
                        style: TextStyle(color: Color(0xFF999999), fontSize: 9),
                      ),
                    ],
                  ),
                )
              ],
            )));
  }
}