welcome_view.dart 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import 'dart:ffi';
  2. import 'package:flutter/material.dart';
  3. import 'package:get/get.dart';
  4. import '../../../controller/controllers.dart';
  5. import '../controllers/welcome_controller.dart';
  6. class WelcomeView extends GetView<WelcomeController> {
  7. const WelcomeView({Key? key}) : super(key: key);
  8. @override
  9. Widget build(BuildContext context) {
  10. return Scaffold(
  11. backgroundColor: Colors.white,
  12. body: Obx(() {
  13. if(controller.error.value.isNotEmpty) {
  14. String mess = controller.error.value;
  15. controller.error.value = '';
  16. Future.delayed(Duration.zero, () async {
  17. bool? result = await controllers.dialog.showNormalDialog(
  18. title: "提示",
  19. content: mess,
  20. cancelText: "取消",
  21. enterText: "确认",
  22. );
  23. if (result != null && result) {
  24. // User pressed "确认"
  25. await controller.fetchSysConfig();
  26. } else {
  27. // User pressed "取消" or dismissed the dialog
  28. }
  29. });
  30. }
  31. return const Center(
  32. child: Column(
  33. mainAxisAlignment: MainAxisAlignment.center,
  34. children: <Widget>[
  35. CircularProgressIndicator(), // 菊花加载指示器
  36. SizedBox(height: 20), // 用于给加载指示器和文字之间增加一些空间
  37. Text(
  38. '正在获取系统配置',
  39. style: TextStyle(
  40. fontSize: 16,
  41. fontWeight: FontWeight.w600,
  42. ),
  43. ),
  44. ],
  45. ), // 当不在加载时,你可能想要显示其他的 Widget
  46. );
  47. }),
  48. );
  49. }
  50. }