Files
2023-11-22 14:53:35 +04:30

138 lines
4.9 KiB
Dart
Executable File

import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
class TestResultAddSelectorBox extends StatefulWidget {
const TestResultAddSelectorBox({
Key? key,
required double deviceBlockSize,
required this.dataCTRL,
required this.dataVals,
required String label,
}) : _deviceBlockSize = deviceBlockSize,
_label = label,
super(key: key);
final double _deviceBlockSize;
final TextEditingController dataCTRL;
final List<String> dataVals;
final String _label;
@override
_TestResultAddSelectorBoxState createState() =>
_TestResultAddSelectorBoxState();
}
class _TestResultAddSelectorBoxState extends State<TestResultAddSelectorBox> {
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.symmetric(vertical: 5),
// height: 65,
child: Row(
// width: double.infinity,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Icon(
FontAwesomeIcons.alignLeft,
color: Colors.grey,
size: 6 * widget._deviceBlockSize,
),
SizedBox(
width: 4 * widget._deviceBlockSize,
),
Expanded(
// width: MediaQuery.of(context).size.width - 70,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
children: <Widget>[
Text(
widget._label,
style: TextStyle(
fontSize: 3 * widget._deviceBlockSize,
color: Colors.grey,
fontWeight: FontWeight.w100,
),
),
],
),
Container(
height: 40,
child: DropdownButtonFormField(
decoration: InputDecoration(
contentPadding: EdgeInsets.only(left: 0),
// border: InputBorder.none,
),
iconSize: 7 * widget._deviceBlockSize,
icon: Icon(
FontAwesomeIcons.angleDown,
color: Colors.black,
),
isExpanded: true,
hint: Container(
// width: 100,
height: 70,
padding: const EdgeInsets.symmetric(horizontal: 0),
child: Text(
widget.dataCTRL.text,
// textDirection: TextDirection.rtl,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontWeight: FontWeight.w700,
color: Colors.black,
fontSize: 3 * widget._deviceBlockSize,
),
),
// TextFormField(
// controller: widget.dataCTRL,
// decoration: InputDecoration(
// contentPadding: EdgeInsets.only(bottom: 15),
// isDense: true,
// ),
// style: TextStyle(
// fontWeight: FontWeight.w700,
// color: Colors.black,
// ),
// // minLines: 1,
// // maxLines: 3,
// ),
),
isDense: true,
items: widget.dataVals.map(
(val) {
return new DropdownMenuItem<String>(
value: val,
child: Container(
child: Text(
val,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontWeight: FontWeight.w700,
color: Colors.black,
fontSize: 3 * widget._deviceBlockSize,
),
),
),
);
},
).toList(),
onChanged: (val) {
setState(
() {
widget.dataCTRL.text = val!;
},
);
},
),
),
],
),
),
],
),
);
}
}