account_replace_dialog.dart 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. import 'package:flutter/cupertino.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:flutter_screenutil/flutter_screenutil.dart';
  4. import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
  5. import 'package:get/get.dart';
  6. import 'package:get/get_core/src/get_main.dart';
  7. import 'package:location/module/main/main_page.dart';
  8. import 'package:location/resource/string.gen.dart';
  9. import 'package:location/utils/common_expand.dart';
  10. import '../resource/assets.gen.dart';
  11. import '../resource/colors.gen.dart';
  12. class AccountReplaceDialog {
  13. static const String _tag = 'AccountReplaceDialog';
  14. static void show() {
  15. SmartDialog.show(
  16. builder: (_) => _AccountReplaceView(),
  17. tag: _tag,
  18. clickMaskDismiss: false);
  19. }
  20. static void dismiss() {
  21. SmartDialog.dismiss(tag: _tag);
  22. }
  23. }
  24. class _AccountReplaceView extends StatelessWidget {
  25. @override
  26. Widget build(BuildContext context) {
  27. return Container(
  28. width: 274.w,
  29. decoration: BoxDecoration(
  30. borderRadius: BorderRadius.circular(16.r),
  31. border: Border.all(
  32. color: Colors.white,
  33. width: 2.w,
  34. ),
  35. gradient: LinearGradient(
  36. begin: Alignment.topCenter,
  37. end: Alignment.bottomCenter,
  38. colors: [
  39. '#E4E4FF'.color,
  40. '#FFFFFF'.color,
  41. ])),
  42. child: Stack(
  43. alignment: Alignment.center,
  44. children: [
  45. Positioned(
  46. top: 16.w,
  47. right: 16.w,
  48. child: GestureDetector(
  49. onTap: onCloseClick,
  50. child: Assets.images.iconDialogClose2
  51. .image(width: 20.w, height: 20.w),
  52. )),
  53. buildAccountReplaceContent(),
  54. ],
  55. ),
  56. );
  57. }
  58. Widget buildAccountReplaceContent() {
  59. return IntrinsicHeight(
  60. child: Column(
  61. children: [
  62. SizedBox(height: 33.w),
  63. Assets.images.iconAccountReplaceLogo.image(height: 76.w),
  64. SizedBox(height: 29.w),
  65. Text(StringName.accountReplaceTitle,
  66. style: TextStyle(
  67. fontSize: 17.sp,
  68. color: '#333333'.color,
  69. fontWeight: FontWeight.bold)),
  70. SizedBox(height: 8.w),
  71. Text(StringName.accountReplaceDesc,
  72. style: TextStyle(fontSize: 14.sp, color: '#999999'.color)),
  73. SizedBox(height: 20.w),
  74. GestureDetector(
  75. onTap: onKnowClick,
  76. child: Container(
  77. width: 229.w,
  78. height: 43.w,
  79. decoration: BoxDecoration(
  80. color: ColorName.colorPrimary,
  81. borderRadius: BorderRadius.circular(100.r),
  82. ),
  83. child: Center(
  84. child: Text(StringName.accountReplaceBtnTxt,
  85. style: TextStyle(
  86. fontSize: 14.sp,
  87. color: Colors.white,
  88. fontWeight: FontWeight.w500)),
  89. ),
  90. ),
  91. ),
  92. SizedBox(height: 20.w),
  93. ],
  94. ),
  95. );
  96. }
  97. void onCloseClick() {
  98. AccountReplaceDialog.dismiss();
  99. }
  100. void onKnowClick() {
  101. //清空至首页
  102. Get.offAll(() => MainPage());
  103. AccountReplaceDialog.dismiss();
  104. }
  105. }