Files
social-app/apps/lib/shared/widgets/app_input.dart
T

52 lines
1.2 KiB
Dart
Raw Normal View History

import 'package:flutter/material.dart';
class AppInput extends StatelessWidget {
final String label;
final String hint;
final TextEditingController? controller;
final bool obscureText;
final TextInputType? keyboardType;
final Widget? suffix;
final int? maxLines;
final bool enabled;
const AppInput({
super.key,
required this.label,
required this.hint,
this.controller,
this.obscureText = false,
this.keyboardType,
this.suffix,
this.maxLines = 1,
this.enabled = true,
});
@override
Widget build(BuildContext context) {
final colorScheme = Theme.of(context).colorScheme;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
label,
style: TextStyle(
fontSize: 13,
fontWeight: FontWeight.w500,
color: colorScheme.onSurfaceVariant,
),
),
const SizedBox(height: 6),
TextField(
controller: controller,
obscureText: obscureText,
keyboardType: keyboardType,
maxLines: maxLines,
enabled: enabled,
decoration: InputDecoration(hintText: hint, suffixIcon: suffix),
),
],
);
}
}