| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- import 'dart:math';
- import 'package:bubble/bubble.dart';
- import 'package:trackoffical_app/screen.dart';
- import 'game_std_controller.dart';
- class LayerCPStartBubble extends LayerView<GameStdController> {
- const LayerCPStartBubble({super.key});
- @override
- Widget build(BuildContext context) {
- return Obx(() {
- final model = viewModel.instance.model;
- var points = model.controlPointWantSequence;
- if (model.startAt != null || points.isEmpty) {
- return const SizedBox();
- }
- final start = points[0];
- var xy = viewModel
- .mapOffsetToScreen(Offset(start.onMap.dx, start.onMap.dy));
- var x = xy.dx;
- var y = xy.dy;
- var h0 = viewModel
- .mapOffsetToScreen(const Offset(0, 0));
- var h1 = viewModel
- .mapOffsetToScreen(const Offset(0, 60));
- final dx = h1.dx - h0.dx;
- final dy = h1.dy - h0.dy;
- var h = sqrt(dx * dx + dy * dy);
- return Positioned(
- top: y,
- left: x + h + 1.0.wp,
- child: Bubble(
- nip: BubbleNip.leftTop,
- alignment: Alignment.topRight,
- child: const Text('打开始点后计时', style: TextStyle(color: Colors.red)),
- ),
- );
- });
- }
- }
|