add_friend_locate_result_dialog.dart 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. import 'package:flutter/cupertino.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:flutter_screenutil/flutter_screenutil.dart';
  4. import 'package:get/get.dart';
  5. import 'package:get/get_core/src/get_main.dart';
  6. import 'package:location/resource/colors.gen.dart';
  7. import 'package:location/utils/common_expand.dart';
  8. import '../../resource/assets.gen.dart';
  9. class AddFriendLocateResultDialog {
  10. static void show({
  11. VoidCallback? cancelOnTap,
  12. VoidCallback? confirmOnTap,}) {
  13. Get.dialog(
  14. SimpleDialog(
  15. titlePadding: EdgeInsets.zero,
  16. contentPadding: EdgeInsets.zero,
  17. insetPadding: EdgeInsets.zero,
  18. backgroundColor:Colors.transparent,
  19. children: [
  20. AddFriendLocateResultTipView(
  21. cancelOnTap: () {
  22. Get.back();
  23. },
  24. confirmOnTap: confirmOnTap)
  25. ],
  26. )
  27. );
  28. }
  29. }
  30. class AddFriendLocateResultTipView extends StatefulWidget {
  31. final VoidCallback? cancelOnTap;
  32. final VoidCallback? confirmOnTap;
  33. const AddFriendLocateResultTipView({
  34. super.key,
  35. this.cancelOnTap,
  36. required this.confirmOnTap,
  37. });
  38. @override
  39. State<AddFriendLocateResultTipView> createState() => _AddFriendLocateResultTipViewState();
  40. }
  41. class _AddFriendLocateResultTipViewState extends State<AddFriendLocateResultTipView> {
  42. @override
  43. Widget build(BuildContext context) {
  44. // TODO: implement build
  45. return Container(
  46. width: 1.sw,
  47. margin: EdgeInsets.symmetric(horizontal: 42.w),
  48. child: IntrinsicHeight(
  49. child: Column(
  50. children: [
  51. SizedBox(
  52. height: 35.w,
  53. ),
  54. Container(
  55. decoration: BoxDecoration(
  56. color: Colors.transparent,
  57. image: DecorationImage(
  58. image: Assets.images.iconAddFriendBackGround.provider(),
  59. fit: BoxFit.fill,
  60. )
  61. ),
  62. child: Column(
  63. children: [
  64. SizedBox(
  65. height: 152.w,
  66. ),
  67. Text("您已成功定位到好友!",
  68. style: TextStyle(
  69. fontSize: 20.sp,
  70. color: "#333333".color,
  71. fontWeight: FontWeight.bold)),
  72. SizedBox(height: 32.w,),
  73. GestureDetector(
  74. onTap: () {
  75. Get.back();
  76. widget.confirmOnTap!();
  77. },
  78. child: Container(
  79. decoration: BoxDecoration(
  80. gradient: LinearGradient(
  81. begin: Alignment.centerLeft, // 90度相当于从左到右
  82. end: Alignment.centerRight,
  83. colors: [
  84. Color(0xFF7B7DFF), // #7B7DFF
  85. Color(0xFF6365FF), // #6365FF
  86. ],
  87. stops: [0.0, 1.0],
  88. // 从0%到100%
  89. ),
  90. borderRadius: BorderRadius.circular(40.w / 2.0),
  91. ),
  92. margin: EdgeInsets.symmetric(horizontal: 20.w),
  93. height: 40.w,
  94. alignment: Alignment.center,
  95. child: Text("立即查看",
  96. style: TextStyle(
  97. fontSize: 14.sp,
  98. color: '#FFFFFF'.color,
  99. fontWeight: FontWeight.w500)
  100. ),
  101. ),
  102. ),
  103. SizedBox(
  104. height: 10.w,
  105. ),
  106. GestureDetector(
  107. onTap: widget.cancelOnTap,
  108. child: Container(
  109. height: 20.w,
  110. child: Text("下次再说",
  111. style: TextStyle(
  112. fontSize: 11.sp,
  113. color: '#898996'.color,
  114. fontWeight: FontWeight.w500)
  115. ),
  116. ),
  117. ),
  118. SizedBox(
  119. height: 12.w,
  120. ),
  121. ],
  122. ),
  123. )
  124. ],
  125. ),
  126. ),
  127. );
  128. }
  129. }