print_info_dialog.dart 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter/services.dart';
  3. import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
  4. import 'package:widgets/ext/ex_widget.dart';
  5. import '../my_text_view.dart';
  6. import 'package:cs_resources/constants/color_constants.dart';
  7. /// 打印调试信息,点击可以复制弹窗的文本
  8. class PrintInfoDialog extends StatelessWidget {
  9. String? message;
  10. PrintInfoDialog(this.message);
  11. @override
  12. Widget build(BuildContext context) {
  13. GlobalKey _textKey = GlobalKey();
  14. return Container(
  15. decoration: const BoxDecoration(
  16. color: Colors.white,
  17. borderRadius: BorderRadius.all(Radius.circular(5)),
  18. ),
  19. child: SingleChildScrollView(
  20. child: RepaintBoundary(
  21. key: _textKey,
  22. child: MyTextView(
  23. message ?? '',
  24. fontSize: 14,
  25. textColor: const Color(0xff333333),
  26. isFontRegular: true,
  27. textAlign: TextAlign.center,
  28. paddingLeft: 30,
  29. paddingRight: 30,
  30. paddingBottom: 35,
  31. marginTop: 35,
  32. onClick: () {
  33. Clipboard.setData(ClipboardData(text: message ?? ''));
  34. SmartDialog.showToast('复制成功');
  35. },
  36. ),
  37. ),
  38. ),
  39. ).constrained(width: 300, maxHeight: 500);
  40. }
  41. //取消弹框
  42. void onCancel() async {
  43. SmartDialog.dismiss();
  44. }
  45. }