dialog_special_warn.dart 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. import 'package:flutter/material.dart';
  2. import 'package:get/get.dart';
  3. import 'package:trackoffical_app/generated/assets.dart';
  4. import 'package:trackoffical_app/screen.dart';
  5. import 'package:trackoffical_app/service/app.dart';
  6. import 'package:trackoffical_app/service/mock.dart';
  7. import 'package:trackoffical_app/view/ingame/dialog/dialog_base.dart';
  8. import '../../../styles/theme.dart';
  9. import '../ingame/dialog/dialog_button.dart';
  10. class DialogSpecialWarn extends StatefulWidget {
  11. const DialogSpecialWarn({super.key});
  12. @override
  13. State<StatefulWidget> createState() {
  14. return DialogSpecialWarnState();
  15. }
  16. }
  17. class DialogSpecialWarnState extends State<DialogSpecialWarn> {
  18. @override
  19. Widget build(BuildContext context) {
  20. const title = '特别提醒';
  21. const titleColor = Color(0xFFce0000);
  22. return dialogTitle(
  23. title,
  24. titleColor,
  25. Column(children: [
  26. Card(
  27. color: Colors.white,
  28. surfaceTintColor: Colors.white,
  29. child: Padding(
  30. padding: EdgeInsets.all(5.86.wp),
  31. child: Column(
  32. children: [
  33. Text('未成年人需在家长陪护下参与', style: TextStyle(fontSize: 4.58.wp)),
  34. SizedBox(height: 7.89.wp),
  35. Image.asset(Assets.imagesIcSpecialWarn, height: 34.93.wp),
  36. ],
  37. )
  38. ) ,
  39. ),
  40. GestureDetector(
  41. onTap: () {
  42. setState(() {
  43. App.to.userProfile.isEnableHomeSpecialWarn.val =
  44. !App.to.userProfile.isEnableHomeSpecialWarn.val;
  45. });
  46. },
  47. child: Row(children: [
  48. Container(
  49. width: 10.36.wp,
  50. height: 10.36.wp,
  51. padding: EdgeInsets.all(2.0.wp),
  52. child: Stack(
  53. children: [
  54. Image.asset(Assets.imagesIcSelectRect),
  55. !App.to.userProfile.isEnableHomeSpecialWarn.val
  56. ? Image.asset(Assets.imagesIcSelectRectSelected)
  57. : const SizedBox()
  58. ],
  59. )),
  60. Text('下次不再提醒', style: TextStyle(fontSize: 3.58.wp),),
  61. ])),
  62. SizedBox(height: 4.0.wp),
  63. dialogButton('我已阅读', () {
  64. Get.back();
  65. })
  66. ]));
  67. }
  68. }
  69. Future<void> dialogHomeSpecialWarn() async{
  70. await Get.dialog(const DialogSpecialWarn(), barrierDismissible: true);
  71. return;
  72. }
  73. class _Empty extends StatelessWidget {
  74. @override
  75. Widget build(BuildContext context) {
  76. SizeFit.screenInit(context);
  77. return Scaffold(
  78. floatingActionButton: FloatingActionButton(onPressed: () {
  79. dialogHomeSpecialWarn();
  80. }),
  81. );
  82. }
  83. }
  84. void main() async {
  85. Mock.initServices();
  86. runApp(GetMaterialApp(theme: appThemeData(), home: _Empty()));
  87. }