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