align hint to start

This commit is contained in:
2025-06-09 14:11:43 +02:00
parent c286635d85
commit 7184f4bb7e

View File

@@ -44,142 +44,161 @@ class _MihNumericStepperState extends State<MihNumericStepper> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Row( return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.end,
children: [ children: [
Column( Row(
children: [ children: [
Container( Text(
// color: Colors.white, widget.hintText,
decoration: BoxDecoration( style: TextStyle(
borderRadius: fontWeight: FontWeight.bold,
BorderRadius.circular(25), // Optional: rounds the corners color: widget.fillColor,
boxShadow: const [ fontSize: 15,
BoxShadow(
color: Color.fromARGB(
60, 0, 0, 0), // 0.2 opacity = 51 in alpha (255 * 0.2)
spreadRadius: -2,
blurRadius: 10,
offset: Offset(0, 5),
),
],
),
child: Padding(
padding: const EdgeInsets.only(
top: 2.0,
left: 5.0,
),
child: SizedBox(
width: 40,
child: IconButton.filled(
style: ButtonStyle(
backgroundColor:
WidgetStateProperty.all<Color>(widget.fillColor),
),
color: widget.inputColor,
iconSize: 20,
onPressed: () {
print("Current Value: $_currentValue");
if (_currentValue >= (widget.minValue ?? 0)) {
setState(() {
widget.controller.text =
(_currentValue - 1).toString();
_currentValue = int.tryParse(widget.controller.text)!;
});
}
print("New Current Value: $_currentValue");
},
icon: const Icon(
Icons.remove,
),
),
),
),
),
Visibility(
visible: _currentValue < (widget.minValue ?? 0),
child: const SizedBox(
height: 21,
), ),
), ),
], ],
), ),
const SizedBox(width: 5), const SizedBox(height: 4),
Expanded( Row(
child: MihTextFormField( mainAxisSize: MainAxisSize.min,
width: widget.width, crossAxisAlignment: CrossAxisAlignment.end,
fillColor: widget.fillColor,
inputColor: widget.inputColor,
controller: widget.controller,
hintText: widget.hintText,
requiredText: widget.requiredText,
readOnly: true,
numberMode: true,
validator: (value) {
if (widget.validationOn) {
return MihValidationServices()
.validateNumber(value, widget.minValue, widget.maxValue);
}
return null;
},
),
),
Column(
children: [ children: [
Container( Column(
// color: Colors.white, children: [
decoration: BoxDecoration( Container(
borderRadius: // color: Colors.white,
BorderRadius.circular(25), // Optional: rounds the corners decoration: BoxDecoration(
boxShadow: const [ borderRadius: BorderRadius.circular(
BoxShadow( 25), // Optional: rounds the corners
color: Color.fromARGB( boxShadow: const [
60, 0, 0, 0), // 0.2 opacity = 51 in alpha (255 * 0.2) BoxShadow(
spreadRadius: -2, color: Color.fromARGB(60, 0, 0,
blurRadius: 10, 0), // 0.2 opacity = 51 in alpha (255 * 0.2)
offset: Offset(0, 5), spreadRadius: -2,
blurRadius: 10,
offset: Offset(0, 5),
),
],
), ),
], child: Padding(
), padding: const EdgeInsets.only(
child: Padding( top: 2.0,
padding: const EdgeInsets.only( left: 5.0,
top: 2.0,
left: 5.0,
),
child: SizedBox(
width: 40,
child: IconButton.filled(
style: ButtonStyle(
backgroundColor:
WidgetStateProperty.all<Color>(widget.fillColor),
), ),
color: widget.inputColor, child: SizedBox(
iconSize: 20, width: 40,
onPressed: () { child: IconButton.filled(
print("Current Value: $_currentValue"); style: ButtonStyle(
if (widget.maxValue == null || backgroundColor:
_currentValue <= widget.maxValue!) { WidgetStateProperty.all<Color>(widget.fillColor),
setState(() { ),
widget.controller.text = color: widget.inputColor,
(_currentValue + 1).toString(); iconSize: 20,
_currentValue = int.tryParse(widget.controller.text)!; onPressed: () {
}); print("Current Value: $_currentValue");
} if (_currentValue >= (widget.minValue ?? 0)) {
print("New Current Value: $_currentValue"); setState(() {
}, widget.controller.text =
icon: const Icon( (_currentValue - 1).toString();
Icons.add, _currentValue =
int.tryParse(widget.controller.text)!;
});
}
print("New Current Value: $_currentValue");
},
icon: const Icon(
Icons.remove,
),
),
), ),
), ),
), ),
Visibility(
visible: _currentValue < (widget.minValue ?? 0),
child: const SizedBox(
height: 21,
),
),
],
),
const SizedBox(width: 5),
Expanded(
child: MihTextFormField(
width: widget.width,
fillColor: widget.fillColor,
inputColor: widget.inputColor,
controller: widget.controller,
hintText: null,
requiredText: widget.requiredText,
readOnly: true,
numberMode: true,
validator: (value) {
if (widget.validationOn) {
return MihValidationServices().validateNumber(
value, widget.minValue, widget.maxValue);
}
return null;
},
), ),
), ),
Visibility( Column(
visible: _currentValue < (widget.minValue ?? 0), children: [
child: const SizedBox( Container(
height: 20, // color: Colors.white,
), decoration: BoxDecoration(
borderRadius: BorderRadius.circular(
25), // Optional: rounds the corners
boxShadow: const [
BoxShadow(
color: Color.fromARGB(60, 0, 0,
0), // 0.2 opacity = 51 in alpha (255 * 0.2)
spreadRadius: -2,
blurRadius: 10,
offset: Offset(0, 5),
),
],
),
child: Padding(
padding: const EdgeInsets.only(
top: 2.0,
left: 5.0,
),
child: SizedBox(
width: 40,
child: IconButton.filled(
style: ButtonStyle(
backgroundColor:
WidgetStateProperty.all<Color>(widget.fillColor),
),
color: widget.inputColor,
iconSize: 20,
onPressed: () {
print("Current Value: $_currentValue");
if (widget.maxValue == null ||
_currentValue <= widget.maxValue!) {
setState(() {
widget.controller.text =
(_currentValue + 1).toString();
_currentValue =
int.tryParse(widget.controller.text)!;
});
}
print("New Current Value: $_currentValue");
},
icon: const Icon(
Icons.add,
),
),
),
),
),
Visibility(
visible: _currentValue < (widget.minValue ?? 0),
child: const SizedBox(
height: 20,
),
),
],
), ),
], ],
), ),