12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- import 'package:flutter/material.dart';
- import 'package:vitalapp/components/dialog_number.dart';
- import 'package:vitalapp/pages/check/models/form.dart';
- import 'package:vitalapp/pages/check/widgets/exam_configurable/exam_card.dart';
- // ignore: must_be_immutable
- class ExamBodyTemperature extends StatefulWidget {
- ExamBodyTemperature({
- super.key,
- required this.currentFormObject,
- required this.currentInputValue,
- this.bodyTemperatureInput,
- });
- FormObject currentFormObject;
- String currentInputValue;
- Function(String value)? bodyTemperatureInput;
- @override
- State<ExamBodyTemperature> createState() => _ExamBodyTemperatureState();
- }
- class _ExamBodyTemperatureState extends State<ExamBodyTemperature> {
- @override
- void initState() {
- super.initState();
- }
- @override
- void dispose() {
- super.dispose();
- }
- @override
- Widget build(BuildContext context) {
- return Stack(
- children: [
- _buildTemperature(),
- ],
- );
- }
- Widget _buildTemperature() {
- return ExamCard(
- title: widget.currentFormObject.label ?? '',
- clickCard: () {
- _inputTemperature();
- },
- content: Container(
- alignment: Alignment.bottomRight,
- padding: const EdgeInsets.only(
- bottom: 20,
- right: 30,
- left: 40,
- ),
- constraints: const BoxConstraints(minHeight: 50),
- child: FittedBox(
- child: Row(
- mainAxisAlignment: MainAxisAlignment.end,
- crossAxisAlignment: CrossAxisAlignment.end,
- children: [
- RichText(
- text: TextSpan(
- style: TextStyle(
- fontSize: 26,
- color: Colors.black,
- fontFamily: "NotoSansSC",
- fontFamilyFallback: const ["NotoSansSC"],
- ),
- text: widget.currentInputValue,
- children: [
- TextSpan(
- text: widget.currentFormObject.append ?? '',
- style: const TextStyle(fontSize: 26),
- )
- ],
- ),
- ),
- ],
- ),
- ),
- ),
- );
- }
- Future<void> _inputTemperature() async {
- String? result = await VDialogNumber(
- title: widget.currentFormObject.label,
- initialValue: widget.currentInputValue,
- ).show();
- if (result?.isNotEmpty ?? false) {
- widget.currentInputValue = result ?? '';
- widget.bodyTemperatureInput!.call(widget.currentInputValue);
- } else {
- widget.bodyTemperatureInput!.call('');
- }
- }
- }
|