CPラベルが1文字しか出ない、起動が遅い
This commit is contained in:
69
lib/widgets/bottom_sheets/bottom_sheet_goal.dart
Normal file
69
lib/widgets/bottom_sheets/bottom_sheet_goal.dart
Normal file
@ -0,0 +1,69 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rogapp/model/destination.dart';
|
||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||
import 'package:rogapp/widgets/bottom_sheets/bottom_sheet_base.dart';
|
||||
import 'package:latlong2/latlong.dart';
|
||||
import 'package:rogapp/pages/camera/camera_page.dart';
|
||||
import 'dart:ui' as ui;
|
||||
|
||||
class BottomSheetGoal extends BottomSheetBase {
|
||||
BottomSheetGoal({super.key, required super.destination});
|
||||
|
||||
final DestinationController destinationController = Get.find<DestinationController>();
|
||||
|
||||
@override
|
||||
List<Widget> buildWidgets(BuildContext context) {
|
||||
// super.buildWidgets(context) を継承して、追加のウィジェットをリストに組み込む
|
||||
return [
|
||||
...super.buildWidgets(context),
|
||||
ElevatedButton(
|
||||
onPressed: destinationController.distanceToStart() <= 100
|
||||
? () async {
|
||||
// 「ゴール時間撮影」ボタンがタップされた際の処理
|
||||
Destination cdest = destinationController.festuretoDestination(indexController.currentFeature[0]);
|
||||
var distance = const Distance();
|
||||
double distanceToDest = distance.as(
|
||||
LengthUnit.Meter,
|
||||
LatLng(
|
||||
destinationController.currentLat, destinationController.currentLon),
|
||||
LatLng(cdest.lat!, cdest.lon!));
|
||||
|
||||
if (destinationController.rogainingCounted.value == true &&
|
||||
// destinationController.distanceToStart() <= 500 && ... GPS信号が弱い時でもOKとする。
|
||||
(destinationController.distanceToStart() <= 500 || destinationController.isGpsSignalWeak() ) &&
|
||||
destination.cp == -1 &&
|
||||
DestinationController.ready_for_goal == true) {
|
||||
|
||||
destinationController.isAtGoal.value = true;
|
||||
destinationController.photos.clear();
|
||||
await showModalBottomSheet(
|
||||
constraints: BoxConstraints.loose(
|
||||
ui.Size(Get.width, Get.height * 0.75)),
|
||||
context: Get.context!,
|
||||
isScrollControlled: true,
|
||||
builder: ((context) => CameraPage(
|
||||
destination: destination,
|
||||
))).whenComplete(() {
|
||||
destinationController.skipGps = false;
|
||||
destinationController.chekcs = 0;
|
||||
destinationController.isAtGoal.value = false;
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
: null,
|
||||
child: const Text('ゴール時間撮影'),
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: buildWidgets(context),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user