| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- 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<InGameController> {
- LayerFrontUI({super.key});
- final service = Get.find<GameService>();
- final _model = Get.find<GameModel>();
- @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<InGameController> {
- @override
- Widget build(BuildContext context) {
- final model = Get.find<GameModel>();
- 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<GameModel> {
- @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),
- )),
- )
- ],
- );
- });
- }
- }
|