guide_page.dart 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter_2048/pages/index_page.dart';
  3. import 'package:intro_slider/intro_slider.dart';
  4. /// Description: 新手引导页
  5. /// Time : 04/30/2023 Sunday
  6. /// Author : liuyuqi.gov@msn.cn
  7. class GuidePage extends StatelessWidget {
  8. GuidePage({super.key});
  9. List<ContentConfig> listContentConfig = [
  10. ContentConfig(
  11. title: "2048小游戏好玩",
  12. description: "点击查看",
  13. // pathImage: "assest/image/facebook.jpg",
  14. backgroundColor: Color(0xff203152),
  15. ),
  16. ContentConfig(
  17. title: "有趣",
  18. description: "点击查看",
  19. // pathImage: "assest/image/google.jpg",
  20. backgroundColor: Color(0xff203152),
  21. ),
  22. ContentConfig(
  23. title: "不沉迷",
  24. description: "点击查看",
  25. // pathImage: "assets/image/twitter.jpg",
  26. backgroundColor: Color(0xff203152),
  27. ),
  28. ];
  29. @override
  30. Widget build(BuildContext context) {
  31. return IntroSlider(
  32. key: UniqueKey(),
  33. listContentConfig: listContentConfig,
  34. onDonePress: () => onDonePress(context),
  35. onSkipPress: () => onDonePress(context),
  36. );
  37. }
  38. /// 完成之后到首页
  39. void onDonePress(BuildContext context) {
  40. Navigator.push(context, MaterialPageRoute(builder: (context) {
  41. return IndexPage();
  42. }));
  43. }
  44. }