123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- import 'package:flutter/material.dart';
- import 'package:flutter/cupertino.dart';
- import 'package:flutter/services.dart';
- import 'package:flutter_screenutil/screenutil.dart';
- import 'package:flutter_swiper/flutter_swiper.dart';
- import 'package:ysairplane2/code/YSTabbar.dart';
- import 'package:ysairplane2/tools/YSNetWorking.dart';
- import 'package:ysairplane2/tools/YSTools.dart';
- class YSWelcome extends StatefulWidget {
- @override
- _YSWelcomeState createState() => _YSWelcomeState();
- }
- class _YSWelcomeState extends State<YSWelcome> {
- List _images = ['lib/images/1.png','lib/images/2.png','lib/images/3.png'];
- @override
- void initState() {
- Future.delayed(Duration(seconds: 0)).then((value){
- _getPrivacyAgreement();
- });
- super.initState();
- }
- _getPrivacyAgreement() async{
- ScreenUtil.init(context,designSize: Size(750, 1624),allowFontScaling: false);
- var dict = await ysRequestHttp(context, type: requestType.get, api: '/app/applets/dic/dtDic/getPrivacyAgreement', parameter: {},isLoading: false);
- if(dict!=null){
- showAgreeAlert(context,title: '用户协议与隐私政策',content: dict['data']['value'],agree: (value){
- if(value==false){
- SystemChannels.platform.invokeMethod('SystemNavigator.pop');
- }else{
- Navigator.pop(context);
- }
- },isWelcome: true);
- }
- }
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- backgroundColor: Colors.white,
- body: Container(
- height: MediaQuery.of(context).size.height,
- width: MediaQuery.of(context).size.width,
- child: Swiper(
- itemBuilder: (BuildContext context, int index) {
- return Stack(
- children: [
- Image(
- height: MediaQuery.of(context).size.height,
- width: MediaQuery.of(context).size.width,
- fit: BoxFit.fill,
- image: AssetImage(_images[index]),
- ),
- if(index==_images.length-1)GestureDetector(
- onTap: (){
- Navigator.of(context).pushAndRemoveUntil(
- CupertinoPageRoute(
- builder: (context){
- return YSTabbar();
- }
- ),(route) => false);
- },
- child: Container(
- margin: EdgeInsets.only(top: MediaQuery.of(context).size.height-60,left: MediaQuery.of(context).size.width/2-50),
- height: 35,
- width: 100,
- decoration: BoxDecoration(
- color: Color(0xFF3676EC),
- borderRadius: BorderRadius.all(Radius.circular(50))
- ),
- alignment: Alignment.center,
- child: Text('立即体验',style: TextStyle(color: Colors.white,fontSize: 14,fontWeight: FontWeight.bold),),
- ),
- )
- ],
- );
- },
- itemCount: _images.length,
- scrollDirection: Axis.horizontal,
- loop: false,
- duration: 300,
- autoplay: false,
- pagination: SwiperPagination(
- alignment: Alignment.bottomCenter,
- builder: DotSwiperPaginationBuilder(
- color: Color(0xFCE1E1E1),
- activeColor: Color(0xFF3676EC),
- size: 5.0,
- activeSize: 10.0,
- ),
- margin: EdgeInsets.only(bottom: 80)
- ),
- autoplayDisableOnInteraction : true,
- ),
- ),
- );
- }
- }
|