import 'package:fast/utils/global.dart'; import 'package:fast/utils/size_fit.dart'; import 'package:flutter/material.dart'; class Guide extends StatefulWidget { double endLeft, endTop, left, top; Guide( {Key? key, required this.endLeft, required this.endTop, required this.left, required this.top}) : super(key: key); @override State createState() => _GuideState(); } class _GuideState extends State { int index = 0; @override Widget build(BuildContext context) { SizeFit.initialize(context); var size = MediaQuery.of(context).size; var top = 180.px + size.height > 667.px ? 30.px : 10.px; var isBig = size.height > 667.px; double left1 = widget.left - 16.px; double top1 = widget.top + top + 60.px; double left2 = widget.endLeft - 74.px + 40.px; double top2 = widget.endTop + 40.px; double top3 = Global().circleWidth / 2.0 + top; if (!isBig) { left1 -= 6.px; top1 -= 45.px; top2 -= 20.px; top3 -= 30.px; } return Stack( children: [ if (index == 0) Positioned( left: left1, top: top1, child: Image.asset( 'assets/images/tip0.png', width: 118.px, height: 118.px, )), if (index == 1) Positioned( left: left2, top: top2, child: Image.asset( 'assets/images/tip1.png', width: 148.px, height: 190.px, )), if (index == 2) Positioned( left: 375.px / 2.0 - 93.px, top: top3, child: Image.asset( 'assets/images/tip2.png', width: 186.px, height: 138.px, )), Positioned( child: GestureDetector( onTap: () => touchBtn(), onVerticalDragStart: (details) => touchBtn(), onHorizontalDragStart: (details) => touchBtn(), onLongPress: ()=>touchBtn(), )) ], ); } touchBtn() { setState(() { index = index + 1; if (index > 2) { Navigator.of(context).pop(); } }); } }