75 lines
2.1 KiB
Dart
75 lines
2.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:rkm/widgets/text_default.dart';
|
|
import '../utils/color_palette.dart';
|
|
import 'error_default.dart';
|
|
import 'input_text.dart';
|
|
|
|
class InputWithSubtitle extends StatelessWidget {
|
|
String subtitle;
|
|
String hintInput;
|
|
String errorInput;
|
|
String labelInput;
|
|
double widthSubtitle;
|
|
double widthInput;
|
|
double widthError;
|
|
var controller;
|
|
var onChanged;
|
|
bool enable;
|
|
bool mandatory;
|
|
TextInputType textInputType;
|
|
int maxLines;
|
|
Color colorBorder;
|
|
String typeInput;
|
|
|
|
InputWithSubtitle({
|
|
required this.subtitle,
|
|
required this.hintInput,
|
|
required this.errorInput,
|
|
required this.labelInput,
|
|
required this.widthSubtitle,
|
|
required this.widthInput,
|
|
required this.controller,
|
|
this.typeInput = 'normal',
|
|
this.enable = true,
|
|
this.mandatory = true,
|
|
this.textInputType = TextInputType.text,
|
|
this.maxLines = 1,
|
|
this.colorBorder = ColorPalette.black54,
|
|
required this.onChanged,
|
|
this.widthError = 0.7
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
// Container(
|
|
// width: widthSubtitle,
|
|
// padding: const EdgeInsets.symmetric(horizontal: 8.0,vertical: 3),
|
|
// child: TextDefault(
|
|
// text: subtitle,
|
|
// color: ColorPalette.black54,
|
|
// fontSize: 18,
|
|
// fontWeigth: FontWeight.bold,
|
|
// ),
|
|
// ),
|
|
InputText(
|
|
controller: controller,
|
|
width: widthInput,
|
|
hint: hintInput,
|
|
label: labelInput,
|
|
enable: enable,
|
|
textInputType: textInputType,
|
|
maxLines:maxLines,
|
|
colorBorder: colorBorder,
|
|
onChanged: onChanged,
|
|
),
|
|
typeInput=='normal'&& controller.text=='' &&(enable&&mandatory)?ErrorDefault(widthDefault: widthError,error: errorInput,):Container(),
|
|
typeInput!='normal'&&(enable&&mandatory)&& errorInput!=''?ErrorDefault(widthDefault: widthError,error: errorInput,):Container(),
|
|
Divider(color: ColorPalette.black54,height: 5,endIndent: 10,)
|
|
],
|
|
);
|
|
}
|
|
}
|