53 lines
1.5 KiB
Dart
53 lines
1.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:manager_app/Components/rounded_input_field.dart';
|
|
import 'package:manager_app/constants.dart';
|
|
|
|
/// Champ numérique étiqueté.
|
|
///
|
|
/// ⚠️ Il calculait sa largeur sur celle de l'écran (`size.width * 0.1`), ce qui
|
|
/// débordait dès qu'on le posait dans une colonne étroite — le rail « Diffusion »
|
|
/// par exemple. Comme les autres champs : libellé au-dessus, largeur au parent.
|
|
class NumberInputContainer extends StatelessWidget {
|
|
final Color color;
|
|
final String label;
|
|
final int initialValue;
|
|
final ValueChanged<String> onChanged;
|
|
final bool isUrl;
|
|
final bool isSmall;
|
|
final int maxLength;
|
|
final double fontSize;
|
|
final double fontSizeText;
|
|
const NumberInputContainer({
|
|
Key? key,
|
|
this.color = kSurface2,
|
|
required this.label,
|
|
required this.initialValue,
|
|
required this.onChanged,
|
|
this.isUrl = false,
|
|
this.isSmall = false,
|
|
this.maxLength = 50,
|
|
this.fontSize = 18.0,
|
|
this.fontSizeText = 13,
|
|
}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(label, style: kLabelField),
|
|
const SizedBox(height: kSpace2),
|
|
RoundedInputField(
|
|
color: color,
|
|
fontSize: fontSizeText,
|
|
initialValue: initialValue.toString(),
|
|
onChanged: onChanged,
|
|
maxLength: maxLength,
|
|
isInt: true,
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|