69 lines
2.3 KiB
Dart
69 lines
2.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:manager_app/Components/rounded_input_field.dart';
|
|
import 'package:manager_app/constants.dart';
|
|
|
|
class TextFormInputContainer extends StatelessWidget {
|
|
final Color color;
|
|
final String label;
|
|
final String initialValue;
|
|
final bool isTitle;
|
|
final ValueChanged<String> onChanged;
|
|
const TextFormInputContainer({
|
|
Key key,
|
|
this.color = kSecond,
|
|
this.label,
|
|
this.initialValue,
|
|
this.isTitle,
|
|
this.onChanged
|
|
}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
Size size = MediaQuery.of(context).size;
|
|
return Container(
|
|
child: Row(
|
|
children: [
|
|
Align(
|
|
alignment: AlignmentDirectional.centerStart,
|
|
child: Text(label, style: TextStyle(fontSize: 20, fontWeight: FontWeight.w300))
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.all(10.0),
|
|
child: Container(
|
|
decoration: BoxDecoration(
|
|
color: color,
|
|
borderRadius: BorderRadius.circular(5),
|
|
border: Border.all(width: 0.5, color: kSecond)
|
|
),
|
|
width: size.width *0.3,
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(10.0),
|
|
child: TextFormField (
|
|
keyboardType: TextInputType.multiline,
|
|
textInputAction: TextInputAction.newline,
|
|
minLines: 1,
|
|
maxLines: 5,
|
|
initialValue: initialValue,
|
|
onChanged: onChanged,
|
|
maxLength: isTitle ? 50 : 2000,
|
|
cursorColor: kPrimaryColor,
|
|
decoration: InputDecoration(
|
|
enabledBorder: UnderlineInputBorder(
|
|
borderSide: BorderSide(color: kPrimaryColor),
|
|
),
|
|
focusedBorder: UnderlineInputBorder(
|
|
borderSide: BorderSide(color: kSecond),
|
|
),
|
|
border: UnderlineInputBorder(
|
|
borderSide: BorderSide(color: kPrimaryColor),
|
|
),
|
|
)
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
} |