zoukankan      html  css  js  c++  java
  • 欢迎页

    import 'package:flutter/material.dart';
    import 'package:intro_slider/intro_slider.dart';
    import 'package:shared_preferences/shared_preferences.dart';
    main()=> runApp(MaterialApp(
      home: SplashScreen(),
    ));
    
    class SplashScreen extends StatefulWidget {
      @override
      State<StatefulWidget> createState() {
        return new SplashScreenState() ;
      }
    }
    class SplashScreenState extends State<SplashScreen> {
      List<Slide> slides = new List();
      @override
      void initState() {
        super.initState();
        slides.add(
          new Slide(
            title: "Flutter",
            description:
            "Flutter是谷歌的移动UI框架,可以快速在iOS和Android上构建高质量的原生用户界面。 Flutter可以与现有的代码一起工作。在全世界,Flutter正在被越来越多的开发者和组织使用,并且Flutter是完全免费、开源的。",
            styleDescription: TextStyle(
                color: Colors.white,
                fontSize: 20.0,
                fontFamily: 'Raleway'),
            marginDescription: EdgeInsets.only(left: 20.0, right: 20.0, top: 20.0, bottom: 70.0),
            colorBegin: Color(0xffFFDAB9),
            colorEnd: Color(0xff40E0D0),
            directionColorBegin: Alignment.topLeft,
            directionColorEnd: Alignment.bottomRight,
          ),
        );
        slides.add(
          new Slide(
            title: "Wanandroid",
            description:
            "这是一款使用Flutter写的WanAndroid客户端应用,在Android和IOS都完美运行,可以用来入门Flutter,简单明了,适合初学者,项目完全开源,如果本项目确实能够帮助到你学习Flutter,谢谢start,有问题请提交Issues,我会及时回复。",
            styleDescription: TextStyle(
                color: Colors.white,
                fontSize: 20.0,
                fontFamily: 'Raleway'),
            marginDescription: EdgeInsets.only(left: 20.0, right: 20.0, top: 20.0, bottom: 70.0),
            colorBegin: Color(0xffFFFACD),
            colorEnd: Color(0xffFF6347),
            directionColorBegin: Alignment.topLeft,
            directionColorEnd: Alignment.bottomRight,
          ),
        );
        slides.add(
          new Slide(
            title: "Welcome",
            description:
            "赠人玫瑰,手有余香;
    分享技术,传递快乐。",
            styleDescription: TextStyle(
                color: Colors.white,
                fontSize: 20.0,
                fontFamily: 'Raleway'),
            marginDescription: EdgeInsets.only(left: 20.0, right: 20.0, top: 20.0, bottom: 70.0),
            colorBegin: Color(0xffFFA500),
            colorEnd: Color(0xff7FFFD4),
            directionColorBegin: Alignment.topLeft,
            directionColorEnd: Alignment.bottomRight,
          ),
        );
      }
      void onDonePress() {
        _setHasSkip();
        Navigator.of(context).pushAndRemoveUntil(
            new MaterialPageRoute(
                builder: (context) => App()),
                (route) => route == null);
      }
    
      void _setHasSkip ()async {
        SharedPreferences prefs = await SharedPreferences.getInstance();
        await prefs.setBool("hasSkip", true);
      }
      @override
      Widget build(BuildContext context) {
        return IntroSlider(
          slides: this.slides,
          onDonePress: this.onDonePress,
          nameSkipBtn: "跳过",
          nameNextBtn: "下一页",
          nameDoneBtn: "进入",
        );
      }
    }
    
    
    class App extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
        // TODO: implement build
        return Scaffold(
          appBar: AppBar(title: Text('sss'),),
          body: Text('sss'),
        );
      }
    }
    

      

  • 相关阅读:
    微信小程序 阻止冒泡事件
    vant/weapp goodsaction 显示样式不正常问题
    微信小程序图表工具wxcharts
    webstorm 不识别 rpx 格式化出错
    小程序自定义 tabbar 以vant weapp 调试工具不显示,但是在真机显示
    小程序自定义 tabbar 以vant weapp为例
    TypeScript之环境搭建
    模块化打包工具webpack
    【纪中受难记】——Day2.感觉冤的慌
    计算机精英协会考核题 —— 第三题:斐波那契数
  • 原文地址:https://www.cnblogs.com/pythonClub/p/10827739.html
Copyright © 2011-2022 走看看