import 'package:get/get.dart'; import 'package:trackoffical_app/service/game/game.dart'; import '../../model/m_control_point.dart'; import '../../service/game/game_model.dart'; import 'in_game_controller.dart'; import 'package:flutter/material.dart'; import 'button_bar.dart'; import 'bottom_bar.dart'; import 'package:trackoffical_app/appcore/ffi.dart' as ffi; class LayerFrontUI extends GetView { LayerFrontUI({super.key}); final service = Get.find(); final _model = Get.find(); @override Widget build(BuildContext context) { return Column( children: [ Container( width: context.width, height: context.mediaQueryPadding.top, decoration: BoxDecoration(color: Colors.grey.withAlpha(150)), ), // _TopBar(), Expanded( child: Container( padding: const EdgeInsets.only(top: 12), width: double.infinity, child: Stack( alignment: AlignmentDirectional.center, children: [ Obx(() { final next = service.getNextWantPoint(0); final nextPlan = _model.nextPlanPoint; var isShowCheckCPButton = controller.isNfcScanUseDialog || next?.type == MControlPointType.gps || nextPlan?.type == MControlPointType.gps; return MButtonBar( isShowCheckCPButton: isShowCheckCPButton, isCheckCPButtonEnable: controller.isCheckCPButtonEnable, ); }), // _PhoneHorizontalWarn(), ], ))), // _BottomBar(), BottomBar(), ], ); } } class _PhoneHorizontalWarn extends GetView { @override Widget build(BuildContext context) { final model = Get.find(); return Obx(() { String? warn; if(controller.isShowPhoneHorizontalWarn){ warn = '请水平放置手机\n以获取准确方向'; } final zone = model.zone.value; switch (zone){ case ffi.ZoneType.Road: warn = '正在穿过道路\n请小心车辆'; break; case ffi.ZoneType.River: warn = '正在经过河流\n请小心'; break; default: break; } return warn != null ? Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ const SizedBox(height: 20), Container( padding: const EdgeInsets.all(6), decoration: BoxDecoration( color: Colors.orangeAccent.withAlpha(80), borderRadius: BorderRadius.circular(7)), child: Text( warn, style: context.textTheme.bodyLarge ?.copyWith(color: context.theme.colorScheme.error), ), ) ], ) : const Positioned(child: SizedBox()); }); // return Obx(() => controller.isShowPhoneHorizontalWarn // ? Column( // crossAxisAlignment: CrossAxisAlignment.center, // children: [ // const SizedBox(height: 20), // Container( // padding: const EdgeInsets.all(6), // decoration: BoxDecoration( // color: Colors.orangeAccent.withAlpha(80), // borderRadius: BorderRadius.circular(7)), // child: Text( // '请水平放置手机\n以获取准确方向', // style: context.textTheme.bodyLarge // ?.copyWith(color: context.theme.colorScheme.error), // ), // ) // ], // ) // : const Positioned(child: SizedBox())); } } class _InWantControlPointAreaShow extends GetView { @override Widget build(BuildContext context) { final InGameController service = Get.find(); return Obx(() { if (!controller.isInWantControlPointArea) { return const SizedBox(); } return Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ const SizedBox(height: 220), SizedBox( height: 120, width: 120, child: ElevatedButton( onPressed: service.onCheckGpsControlPoint, child: const Text( '打卡', style: TextStyle(fontSize: 30), )), ) ], ); }); } }