2024-07-24 08:23:02 +00:00
|
|
|
// import 'package:flutter/material.dart';
|
|
|
|
// import 'package:flutter/services.dart';
|
|
|
|
|
|
|
|
// // ignore: must_be_immutable
|
|
|
|
// class InteractionTextField extends StatelessWidget {
|
|
|
|
// String labelText;
|
|
|
|
// TextEditingController controller;
|
|
|
|
// String? hintText;
|
|
|
|
// IconButton? suffixIcon;
|
|
|
|
// bool? enabled = true;
|
|
|
|
// bool? obscure = false;
|
|
|
|
// Function onChanged;
|
|
|
|
// TextInputType? inputType;
|
|
|
|
// int? maxchars = 0;
|
|
|
|
// int? maxlines = 1;
|
|
|
|
// int? minlines = 0;
|
|
|
|
// InteractionTextField(
|
|
|
|
// {super.key,
|
|
|
|
// required this.controller,
|
|
|
|
// this.hintText,
|
|
|
|
// required this.labelText,
|
|
|
|
// this.suffixIcon,
|
|
|
|
// this.enabled,
|
|
|
|
// this.maxchars,
|
|
|
|
// this.maxlines,
|
|
|
|
// this.inputType,
|
|
|
|
// this.minlines,
|
|
|
|
// required this.onChanged,
|
|
|
|
// this.obscure});
|
|
|
|
|
|
|
|
// @override
|
|
|
|
// Widget build(BuildContext context) {
|
|
|
|
// return TextField(
|
|
|
|
// controller: controller,
|
|
|
|
// style: const TextStyle(fontSize: 16),
|
|
|
|
// enabled: enabled,
|
|
|
|
// obscureText: obscure ?? false,
|
|
|
|
// onTap: () {},
|
|
|
|
// maxLines: maxlines ?? 1,
|
|
|
|
// minLines: minlines,
|
|
|
|
// keyboardType: inputType ?? TextInputType.name,
|
|
|
|
// onChanged: (value) {
|
|
|
|
// onChanged(value);
|
|
|
|
// },
|
|
|
|
// onSubmitted: (value) {
|
|
|
|
// onChanged(value);
|
|
|
|
// },
|
|
|
|
// inputFormatters: [
|
|
|
|
// inputType == TextInputType.number
|
|
|
|
// ? FilteringTextInputFormatter.digitsOnly
|
|
|
|
// : maxchars == 0
|
|
|
|
// ? LengthLimitingTextInputFormatter(100)
|
|
|
|
// : LengthLimitingTextInputFormatter(maxchars),
|
|
|
|
// ],
|
|
|
|
// decoration: InputDecoration(
|
|
|
|
// isDense: true,
|
|
|
|
// // contentPadding: const EdgeInsets.symmetric(
|
|
|
|
// // horizontal: 10,
|
|
|
|
// // vertical: 18,
|
|
|
|
// // ),
|
|
|
|
// contentPadding: EdgeInsets.all(13.0),
|
|
|
|
// border: OutlineInputBorder(
|
|
|
|
// borderRadius: BorderRadius.circular(10.0),
|
|
|
|
// ),
|
|
|
|
// suffixIcon: suffixIcon,
|
|
|
|
// hintText: hintText,
|
|
|
|
// ),
|
|
|
|
// );
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
2024-05-20 10:29:02 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
|
|
|
|
// ignore: must_be_immutable
|
|
|
|
class InteractionTextField extends StatelessWidget {
|
|
|
|
String labelText;
|
|
|
|
TextEditingController controller;
|
|
|
|
String? hintText;
|
|
|
|
IconButton? suffixIcon;
|
|
|
|
bool? enabled = true;
|
|
|
|
bool? obscure = false;
|
|
|
|
Function onChanged;
|
|
|
|
TextInputType? inputType;
|
|
|
|
int? maxchars = 0;
|
|
|
|
int? maxlines = 1;
|
|
|
|
int? minlines = 0;
|
|
|
|
InteractionTextField(
|
|
|
|
{super.key,
|
|
|
|
required this.controller,
|
|
|
|
this.hintText,
|
|
|
|
required this.labelText,
|
|
|
|
this.suffixIcon,
|
|
|
|
this.enabled,
|
|
|
|
this.maxchars,
|
|
|
|
this.maxlines,
|
|
|
|
this.inputType,
|
|
|
|
this.minlines,
|
|
|
|
required this.onChanged,
|
|
|
|
this.obscure});
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return TextField(
|
|
|
|
controller: controller,
|
|
|
|
style: const TextStyle(fontSize: 16),
|
|
|
|
enabled: enabled,
|
|
|
|
obscureText: obscure ?? false,
|
|
|
|
onTap: () {},
|
|
|
|
maxLines: maxlines ?? 1,
|
|
|
|
minLines: minlines,
|
|
|
|
keyboardType: inputType ?? TextInputType.name,
|
|
|
|
onChanged: (value) {
|
|
|
|
onChanged(value);
|
|
|
|
},
|
2024-06-10 11:11:00 +00:00
|
|
|
onSubmitted: (value) {
|
|
|
|
onChanged(value);
|
|
|
|
},
|
2024-05-20 10:29:02 +00:00
|
|
|
inputFormatters: [
|
|
|
|
inputType == TextInputType.number
|
|
|
|
? FilteringTextInputFormatter.digitsOnly
|
|
|
|
: maxchars == 0
|
|
|
|
? LengthLimitingTextInputFormatter(100)
|
|
|
|
: LengthLimitingTextInputFormatter(maxchars),
|
|
|
|
],
|
|
|
|
decoration: InputDecoration(
|
|
|
|
isDense: true,
|
2024-07-05 08:48:29 +00:00
|
|
|
// contentPadding: const EdgeInsets.symmetric(
|
|
|
|
// horizontal: 10,
|
|
|
|
// vertical: 18,
|
|
|
|
// ),
|
|
|
|
contentPadding: EdgeInsets.all(13.0),
|
2024-05-20 10:29:02 +00:00
|
|
|
border: OutlineInputBorder(
|
|
|
|
borderRadius: BorderRadius.circular(10.0),
|
|
|
|
),
|
|
|
|
suffixIcon: suffixIcon,
|
|
|
|
hintText: hintText,
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|