123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- import 'package:fis_i18n/i18n.dart';
- import 'package:fis_measure/define.dart';
- import 'package:fis_measure/interfaces/process/items/item_metas.dart';
- import 'package:fis_measure/interfaces/process/workspace/application.dart';
- import 'package:fis_measure/process/primitives/combos/pisa.dart';
- import 'package:fis_measure/process/primitives/rvsp.dart';
- import 'package:fis_measure/utils/prompt_box.dart';
- import 'package:fis_ui/index.dart';
- import 'package:fis_ui/interface/interactive_container.dart';
- import 'package:flutter/material.dart';
- import 'package:get/get.dart';
- import 'normal_child.dart';
- import 'widgets.dart';
- class AlsVelItemButton extends FStatefulWidget {
- const AlsVelItemButton({super.key});
- @override
- FState<FStatefulWidget> createState() => _AlsVelItemButtonState();
- }
- class _AlsVelItemButtonState extends FState<AlsVelItemButton> {
- double _customAlsVelValue = 0;
- @override
- void initState() {
- _initState();
- super.initState();
- }
- @override
- FWidget build(BuildContext context) {
- return NormalChildButton(
- businessParent: const FPlaceHolderInteractiveContainer(),
- activeIndex: -1,
- index: 0,
- itemMeta: ItemMeta(
- "Als.Vel",
- measureType: '',
- description: 'Als.Vel',
- outputs: [],
- ),
- onClick: () {
- Get.dialog(_buildDialog());
- },
- );
- }
- void _initState() {
- final activeMeasureItem = Get.find<IApplication>().activeMeasureItem;
- if (activeMeasureItem == null) {
- return;
- }
- _customAlsVelValue = (activeMeasureItem as Pisa).alsVel.value!;
- }
- FWidget _buildDialog() {
- final children = <Widget>[];
- children.add(_buildInputButton());
- return FSimpleDialog(
- title: const FText("Als.Vel", style: TextStyle(color: Colors.white)),
- okString: i18nBook.common.confirm.t,
- cancelString: i18nBook.common.cancel.t,
- isDefault: true,
- children: children,
- onOk: () {
- _onValueConfrim();
- Get.back();
- },
- onCancel: () {
- Get.back();
- },
- onClose: () {
- Get.back();
- },
- );
- }
- void _onValueConfrim() {
- final activeMeasureItem = Get.find<IApplication>().activeMeasureItem;
- if (activeMeasureItem == null) {
- return;
- }
- double alsVel = _customAlsVelValue;
- (activeMeasureItem as Pisa).updateAlsVel(alsVel);
- }
- Widget _buildInputButton() {
- return CustomChildInputOptionWidget(
- isActive: false,
- value: _customAlsVelValue.toString(),
- suffixWidget: const Text(" cm/s"),
- onClick: () {
- //
- },
- onInputChanged: (String value) {
- final doubleValue = double.tryParse(value);
- if (doubleValue == null) {
- PromptBox.toast("请输入正确的Als.Vel数值");
- } else {
- _customAlsVelValue = doubleValue;
- }
- },
- );
- }
- }
|