2026-02-25 10:52:18 +08:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
2026-03-30 09:07:30 +08:00
|
|
|
import '../../core/theme/design_tokens.dart';
|
|
|
|
|
|
2026-02-25 10:52:18 +08:00
|
|
|
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) {
|
2026-03-27 19:07:39 +08:00
|
|
|
final colorScheme = Theme.of(context).colorScheme;
|
2026-02-25 10:52:18 +08:00
|
|
|
return Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
label,
|
2026-03-27 19:07:39 +08:00
|
|
|
style: TextStyle(
|
2026-02-25 10:52:18 +08:00
|
|
|
fontSize: 13,
|
|
|
|
|
fontWeight: FontWeight.w500,
|
2026-03-27 19:07:39 +08:00
|
|
|
color: colorScheme.onSurfaceVariant,
|
2026-02-25 10:52:18 +08:00
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(height: 6),
|
|
|
|
|
TextField(
|
|
|
|
|
controller: controller,
|
|
|
|
|
obscureText: obscureText,
|
|
|
|
|
keyboardType: keyboardType,
|
|
|
|
|
maxLines: maxLines,
|
|
|
|
|
enabled: enabled,
|
2026-03-30 09:07:30 +08:00
|
|
|
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,
|
|
|
|
|
),
|
|
|
|
|
),
|
2026-02-25 10:52:18 +08:00
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|