138 lines
4.6 KiB
Dart
138 lines
4.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:flutter_svg/svg.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:path/path.dart' as path;
|
|
import 'package:remove_emoji_input_formatter/remove_emoji_input_formatter.dart';
|
|
|
|
|
|
class TextInputField extends StatefulWidget {
|
|
TextInputField({Key? key, this.hinttext, this.controller, this.validator})
|
|
: super(key: key);
|
|
final String? hinttext;
|
|
final TextEditingController? controller;
|
|
dynamic validator;
|
|
|
|
@override
|
|
State<TextInputField> createState() => _TextInputFieldState();
|
|
}
|
|
|
|
class _TextInputFieldState extends State<TextInputField> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
width: double.infinity,
|
|
height: 46.h,
|
|
child: TextFormField(
|
|
inputFormatters: [
|
|
RemoveEmojiInputFormatter(),
|
|
],
|
|
controller: widget.controller,
|
|
validator: widget.validator ??
|
|
(value) {
|
|
if (value == null || value.isEmpty) {
|
|
return "Empty value";
|
|
}
|
|
return null;
|
|
},
|
|
decoration: InputDecoration(
|
|
contentPadding: const EdgeInsets.symmetric(
|
|
vertical: 12.0,
|
|
horizontal: 16), //<-- Adjust the vertical padding as needed
|
|
|
|
hintText: widget.hinttext,
|
|
focusedBorder: OutlineInputBorder(
|
|
borderSide: const BorderSide(
|
|
width: 1, color: Color(0x7FE8C69F)), //<-- SEE HERE
|
|
borderRadius: BorderRadius.circular(5.0),
|
|
),
|
|
border: OutlineInputBorder(
|
|
borderSide: const BorderSide(
|
|
width: 1, color: Color(0x7FE8C69F)), //<-- SEE HERE
|
|
borderRadius: BorderRadius.circular(5.0),
|
|
),
|
|
enabledBorder: OutlineInputBorder(
|
|
borderSide: const BorderSide(
|
|
width: 1, color: Color(0x7FE8C69F)), //<-- SEE HERE
|
|
borderRadius: BorderRadius.circular(5.0),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
Widget MessageTextInputField(
|
|
String hinttext, TextEditingController controller, dynamic validator) {
|
|
return TextFormField(
|
|
inputFormatters: [
|
|
RemoveEmojiInputFormatter()
|
|
],
|
|
// maxLength: 5,
|
|
autovalidateMode: AutovalidateMode.onUserInteraction,
|
|
maxLines: 5,
|
|
validator: validator,
|
|
controller: controller,
|
|
decoration: InputDecoration(
|
|
labelStyle: const TextStyle(color: Colors.black),
|
|
errorStyle: TextStyle(
|
|
fontSize: 13.sp,
|
|
color: Color.fromARGB(255, 245, 130, 122),
|
|
),
|
|
contentPadding: const EdgeInsets.symmetric(
|
|
vertical: 12.0,
|
|
horizontal: 16), //<-- Adjust the vertical padding as needed
|
|
filled: true,
|
|
fillColor: Color(0xFFFFF3E4),
|
|
border: OutlineInputBorder(
|
|
borderRadius: BorderRadius.circular(5),
|
|
borderSide: const BorderSide(color: Color(0xFFE8C69F80), width: 1),
|
|
),
|
|
enabledBorder: OutlineInputBorder(
|
|
borderRadius: BorderRadius.circular(5),
|
|
borderSide: const BorderSide(color: Color(0xFFE8C69F80), width: 1),
|
|
),
|
|
focusedBorder: OutlineInputBorder(
|
|
borderRadius: BorderRadius.circular(5),
|
|
borderSide: const BorderSide(color: Color(0xFFE8C69F80), width: 1),
|
|
),
|
|
errorBorder: OutlineInputBorder(
|
|
borderRadius: BorderRadius.circular(5),
|
|
borderSide: const BorderSide(color: Colors.red, width: 1),
|
|
),
|
|
focusedErrorBorder: OutlineInputBorder(
|
|
borderRadius: BorderRadius.circular(5),
|
|
borderSide: const BorderSide(color: Colors.red, width: 1),
|
|
),
|
|
hintText: hinttext,
|
|
hintStyle: const TextStyle(
|
|
color: Color(0xFF737373),
|
|
fontSize: 14,
|
|
fontWeight: FontWeight.w400,
|
|
fontFamily: "DM Sans"),
|
|
|
|
// focusedBorder: const OutlineInputBorder(borderSide: BorderSide.none),
|
|
// border: const OutlineInputBorder(borderSide: BorderSide.none),
|
|
// enabledBorder: const OutlineInputBorder(borderSide: BorderSide.none),
|
|
),
|
|
keyboardType: TextInputType.text,
|
|
);
|
|
}
|
|
|
|
Widget commonDivider(){
|
|
return Container(
|
|
height: 1.5.h,
|
|
width: double.infinity,
|
|
decoration: BoxDecoration(
|
|
gradient: LinearGradient(
|
|
begin: Alignment.topLeft,
|
|
end: Alignment.bottomRight,
|
|
colors: [
|
|
Color.fromRGBO(255, 255, 255, 0.07),
|
|
Color.fromRGBO(255, 255, 255, 0.09),
|
|
],
|
|
transform: GradientRotation(1.78),
|
|
),
|
|
),
|
|
);
|
|
} |