keyboard_generating_dialog.dart 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter_screenutil/flutter_screenutil.dart';
  3. import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
  4. import 'package:lottie/lottie.dart';
  5. import '../resource/assets.gen.dart';
  6. class KeyboardGeneratingDialog {
  7. static const tag = "KeyboardGeneratingDialog";
  8. static void show({text = "生成中..."}) {
  9. SmartDialog.show(
  10. tag: tag,
  11. backType: SmartBackType.block,
  12. clickMaskDismiss: false,
  13. alignment: Alignment.center,
  14. animationType: SmartAnimationType.centerScale_otherSlide,
  15. builder: (_) {
  16. return Container(
  17. width: 298.w,
  18. height: 234.w,
  19. decoration: ShapeDecoration(
  20. gradient: LinearGradient(
  21. begin: Alignment(0.50, 0.00),
  22. end: Alignment(0.50, 1.00),
  23. colors: [const Color(0xFFE0D5FD), Colors.white],
  24. ),
  25. shape: RoundedRectangleBorder(
  26. borderRadius: BorderRadius.circular(20.r),
  27. ),
  28. ),
  29. child: Stack(
  30. alignment: Alignment.center,
  31. children: [
  32. Lottie.asset(
  33. Assets.anim.animKeyboardGeneratingData,
  34. repeat: true,
  35. width: 196.w,
  36. fit: BoxFit.contain,
  37. ),
  38. Positioned(
  39. bottom: 20.w,
  40. child: Text(
  41. text,
  42. textAlign: TextAlign.center,
  43. style: TextStyle(
  44. color: Colors.black.withAlpha(204),
  45. fontSize: 16.sp,
  46. fontWeight: FontWeight.w500,
  47. ),
  48. ),
  49. ),
  50. ],
  51. ),
  52. );
  53. },
  54. );
  55. }
  56. static void hide() {
  57. SmartDialog.dismiss(tag: tag);
  58. }
  59. }