splash.dart 1.1KB

1234567891011121314151617181920212223242526272829303132333435
  1. import 'package:card_swiper/card_swiper.dart';
  2. import 'package:get/get.dart';
  3. import 'package:flutter/material.dart';
  4. import 'package:get_storage/get_storage.dart';
  5. import 'package:farmer_client/utils/tool.dart';
  6. class SplashScreen extends StatelessWidget {
  7. const SplashScreen({Key? key}) : super(key: key);
  8. @override
  9. Widget build(BuildContext context) {
  10. GetStorage box = GetStorage();
  11. var pg = isLogin() ? '/home' : '/login';
  12. box.write("not-first-load", true);
  13. return Scaffold (
  14. body: Swiper (
  15. itemBuilder: (BuildContext context,int index){
  16. var adImg = "https://dz-machinery.oss-cn-nanjing.aliyuncs.com/images/nonghu_launch_image_" + (index + 1).toString() + ".png";
  17. return Image.network(adImg,fit: BoxFit.fill,);
  18. },
  19. loop: false,
  20. itemCount: 3,
  21. pagination: const SwiperPagination(),
  22. // control: SwiperControl(),
  23. onTap: (index) {
  24. if (index == 2) {
  25. Get.offNamed(pg);
  26. }
  27. // foo
  28. },
  29. )
  30. );
  31. }
  32. }