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

67 lines
1.7 KiB
Dart

import 'package:flutter/material.dart';
import '../../core/theme/design_tokens.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,
filled: true,
fillColor: colorScheme.surfaceContainerLow,
contentPadding: const EdgeInsets.symmetric(
horizontal: AppSpacing.lg,
vertical: AppSpacing.lg,
),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(AppRadius.lg),
borderSide: BorderSide.none,
),
),
),
],
);
}
}