117 lines
4.4 KiB
Dart
117 lines
4.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:google_fonts/google_fonts.dart';
|
|
import 'package:hub/components/atomic_components/shared_components_atoms/tabview.dart';
|
|
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
|
|
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
|
|
|
class CustomInputUtil extends StatelessWidget {
|
|
final TextEditingController? controller;
|
|
final String? labelText;
|
|
final String? hintText;
|
|
final bool? obscureText;
|
|
final IconData? suffixIcon;
|
|
final bool autoFocus;
|
|
final TextInputAction textInputAction;
|
|
final TextInputType keyboardType;
|
|
final int maxLength;
|
|
final FormFieldValidator<String>? validator;
|
|
final bool haveMaxLength;
|
|
|
|
CustomInputUtil(
|
|
{Key? key,
|
|
this.controller,
|
|
required this.labelText,
|
|
required this.hintText,
|
|
required this.suffixIcon,
|
|
this.autoFocus = false,
|
|
this.textInputAction = TextInputAction.next,
|
|
this.keyboardType = TextInputType.text,
|
|
this.maxLength = 80,
|
|
this.validator,
|
|
this.obscureText,
|
|
required this.haveMaxLength})
|
|
: super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Padding(
|
|
padding: const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 10.0),
|
|
child: Column(
|
|
children: [
|
|
TextFormField(
|
|
controller: controller,
|
|
autovalidateMode: AutovalidateMode.onUserInteraction,
|
|
autofocus: autoFocus,
|
|
textInputAction: textInputAction,
|
|
obscureText: false,
|
|
decoration: InputDecoration(
|
|
isDense: true,
|
|
labelText: labelText,
|
|
labelStyle: FlutterFlowTheme.of(context).labelMedium.override(
|
|
fontFamily: FlutterFlowTheme.of(context).labelMediumFamily,
|
|
color: FlutterFlowTheme.of(context).primaryText,
|
|
letterSpacing: 0.0,
|
|
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
|
FlutterFlowTheme.of(context).labelMediumFamily),
|
|
),
|
|
hintText: hintText,
|
|
hintStyle: FlutterFlowTheme.of(context).labelMedium.override(
|
|
fontFamily: FlutterFlowTheme.of(context).labelMediumFamily,
|
|
color: FlutterFlowTheme.of(context).primaryText,
|
|
letterSpacing: 0.0,
|
|
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
|
FlutterFlowTheme.of(context).labelMediumFamily),
|
|
),
|
|
enabledBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: FlutterFlowTheme.of(context).customColor6,
|
|
width: 0.5,
|
|
),
|
|
borderRadius: BorderRadius.circular(10.0),
|
|
),
|
|
focusedBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: FlutterFlowTheme.of(context).primary,
|
|
width: 0.5,
|
|
),
|
|
borderRadius: BorderRadius.circular(10.0),
|
|
),
|
|
errorBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: FlutterFlowTheme.of(context).error,
|
|
width: 0.5,
|
|
),
|
|
borderRadius: BorderRadius.circular(10.0),
|
|
),
|
|
focusedErrorBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: FlutterFlowTheme.of(context).error,
|
|
width: 0.5,
|
|
),
|
|
borderRadius: BorderRadius.circular(10.0),
|
|
),
|
|
suffixIcon: Icon(
|
|
suffixIcon,
|
|
color: FlutterFlowTheme.of(context).accent1,
|
|
),
|
|
),
|
|
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
|
fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily,
|
|
color: FlutterFlowTheme.of(context).primaryText,
|
|
letterSpacing: 0.0,
|
|
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
|
FlutterFlowTheme.of(context).bodyMediumFamily),
|
|
),
|
|
maxLines: null,
|
|
maxLength: haveMaxLength ? maxLength : null,
|
|
keyboardType: keyboardType,
|
|
inputFormatters: [LengthLimitingTextInputFormatter(maxLength)],
|
|
validator: validator,
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|