64 lines
1.7 KiB
Dart
64 lines
1.7 KiB
Dart
import 'package:auto_size_text/auto_size_text.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:manager_app/Components/rounded_input_field.dart';
|
|
import 'package:manager_app/constants.dart';
|
|
|
|
class StringInputContainer extends StatelessWidget {
|
|
final Color? color;
|
|
final String label;
|
|
final String? initialValue;
|
|
final ValueChanged<String> onChanged;
|
|
final bool isUrl;
|
|
final bool isSmall;
|
|
final int maxLength;
|
|
final double fontSize;
|
|
final double fontSizeText;
|
|
const StringInputContainer({
|
|
Key? key,
|
|
this.color = kSecond,
|
|
required this.label,
|
|
this.initialValue = "",
|
|
required this.onChanged,
|
|
this.isUrl = false,
|
|
this.isSmall = false,
|
|
this.maxLength = 50,
|
|
this.fontSize = 25,
|
|
this.fontSizeText = 20,
|
|
}) : 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: const TextStyle(
|
|
fontWeight: FontWeight.w400,
|
|
fontSize: 16,
|
|
),
|
|
),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: Container(
|
|
width: isUrl ? size.width *0.6 : isSmall ? size.width *0.1 : size.width *0.25,
|
|
child: RoundedInputField(
|
|
color: color!,
|
|
textColor: kBlack,
|
|
fontSize: fontSizeText,
|
|
initialValue: initialValue,
|
|
onChanged: onChanged,
|
|
maxLength: maxLength,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
} |