privacy_lock_dialog.dart 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. import 'package:clean/utils/expand.dart';
  2. import 'package:flutter/Material.dart';
  3. import 'package:flutter_screenutil/flutter_screenutil.dart';
  4. import '../resource/assets.gen.dart';
  5. class PrivacyLockDialog extends StatelessWidget {
  6. final bool isPrivacyOn;
  7. final VoidCallback? onResetPassword;
  8. final VoidCallback? onSetPublic;
  9. const PrivacyLockDialog({
  10. super.key,
  11. required this.isPrivacyOn,
  12. this.onResetPassword,
  13. this.onSetPublic,
  14. });
  15. @override
  16. Widget build(BuildContext context) {
  17. return Dialog(
  18. backgroundColor: "#23232A".color,
  19. shape: RoundedRectangleBorder(
  20. borderRadius: BorderRadius.circular(26.r),
  21. ),
  22. child: Container(
  23. width: 285.w,
  24. padding: EdgeInsets.all(20),
  25. child: Column(
  26. mainAxisSize: MainAxisSize.min,
  27. children: [
  28. // 锁图标
  29. isPrivacyOn
  30. ? Assets.images.iconPrivacyLock.image(width: 76.w, height: 76.w)
  31. : Assets.images.iconPrivacyUnlock
  32. .image(width: 76.w, height: 76.w),
  33. SizedBox(height: 16),
  34. // 标题文本
  35. Text(
  36. 'Privacy Mode ${isPrivacyOn ? "On" : "Off"}',
  37. style: TextStyle(
  38. color: Colors.white,
  39. fontSize: 20.sp,
  40. fontWeight: FontWeight.w700,
  41. ),
  42. ),
  43. SizedBox(height: 24),
  44. // 重置密码按钮
  45. GestureDetector(
  46. onTap: () {
  47. onResetPassword!();
  48. },
  49. child: Container(
  50. width: 180.w,
  51. height: 48.h,
  52. decoration: BoxDecoration(
  53. color: "#0279FB".color,
  54. borderRadius: BorderRadius.circular(10.r),
  55. ),
  56. child: Center(
  57. child: Text(
  58. isPrivacyOn ? 'Reset Password' : 'Set Password',
  59. style: TextStyle(
  60. fontSize: 16.sp,
  61. fontWeight: FontWeight.w500,
  62. color: Colors.white,
  63. ),
  64. ),
  65. ),
  66. ),
  67. ),
  68. SizedBox(height: 15.h),
  69. // 设为公开按钮
  70. Visibility(
  71. visible: isPrivacyOn,
  72. child: TextButton(
  73. onPressed: onSetPublic,
  74. child: Text(
  75. 'Set as Public',
  76. style: TextStyle(
  77. color: Colors.white.withOpacity(0.7),
  78. fontSize: 16,
  79. fontWeight: FontWeight.w500,
  80. ),
  81. ),
  82. ),
  83. ),
  84. ],
  85. ),
  86. ),
  87. );
  88. }
  89. }