unconnected_view.dart 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. import 'package:app_settings/app_settings.dart';
  2. import 'package:eitc_erm_dental_flutter/funcs.dart';
  3. import 'package:eitc_erm_dental_flutter/generated/assets.dart';
  4. import 'package:eitc_erm_dental_flutter/widget/main_button.dart';
  5. import 'package:flutter/material.dart';
  6. import 'package:flutter_screenutil/flutter_screenutil.dart';
  7. ///未连接界面
  8. class UnconnectedView extends StatelessWidget {
  9. const UnconnectedView({super.key});
  10. @override
  11. Widget build(BuildContext context) {
  12. return Column(
  13. children: [
  14. Expanded(
  15. child: SingleChildScrollView(
  16. child: Column(
  17. children: [
  18. _getTitleText(context),
  19. SizedBox(
  20. height: 20.h,
  21. ),
  22. _getDesc(context, getS().notConnectDesc1, [
  23. Assets.imagesUnconnectDescImg11,
  24. Assets.imagesUnconnectDescImg12,
  25. Assets.imagesUnconnectDescImg13,
  26. ]),
  27. SizedBox(
  28. height: 16.h,
  29. ),
  30. _getDesc(context, getS().notConnectDesc2, [
  31. Assets.imagesUnconnectDescImg21,
  32. Assets.imagesUnconnectDescImg22,
  33. Assets.imagesUnconnectDescImg23,
  34. ]),
  35. ],
  36. ),
  37. )),
  38. Container(
  39. padding: EdgeInsets.fromLTRB(16.w, 20.h, 16.w, 34.h),
  40. width: double.infinity,
  41. child: MainButton(
  42. onPressed: () => _onConnect(context),
  43. text: getS().clickToConnect,
  44. ),
  45. ),
  46. ],
  47. );
  48. }
  49. Widget _getTitleText(BuildContext context) {
  50. return Column(
  51. children: [
  52. SizedBox(
  53. height: 16.h,
  54. ),
  55. Image.asset(
  56. Assets.imagesUnconnectIcon,
  57. width: 120.w,
  58. height: 88.h,
  59. ),
  60. SizedBox(
  61. height: 8.h,
  62. ),
  63. Text(
  64. getS().waitingConnectDevice,
  65. style: TextStyle(color: const Color(0xFF999999), fontSize: 12.sp),
  66. ),
  67. ],
  68. );
  69. }
  70. Widget _getDesc(BuildContext context, String text, List<String> imgs) {
  71. return Padding(
  72. padding: EdgeInsets.symmetric(horizontal: 16.w),
  73. child: Column(
  74. children: [
  75. Text(text),
  76. SizedBox(
  77. height: 12.h,
  78. ),
  79. Row(
  80. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  81. children: imgs
  82. .map((s) => Image.asset(
  83. s,
  84. width: 104.w,
  85. height: 136.h,
  86. fit: BoxFit.fill,
  87. ))
  88. .toList(),
  89. )
  90. ],
  91. ),
  92. );
  93. }
  94. void _onConnect(BuildContext context) async {
  95. AppSettings.openAppSettings(
  96. type: AppSettingsType.wifi, asAnotherTask: true);
  97. }
  98. }