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),
|
),
|
],
|
),
|
)
|
],
|
)));
|
}
|
}
|