account_replace_dialog.dart 3.2 KB

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