59 lines
1.9 KiB
Dart
59 lines
1.9 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
class GlobalTextField extends StatelessWidget {
|
|
final TextEditingController controller;
|
|
final String? hintText;
|
|
final String? labelText;
|
|
final bool isPassword;
|
|
final bool obscureText;
|
|
final VoidCallback? onToggleVisibility;
|
|
|
|
const GlobalTextField({
|
|
super.key,
|
|
required this.controller,
|
|
this.hintText,
|
|
this.labelText,
|
|
this.isPassword = false,
|
|
this.obscureText = false,
|
|
this.onToggleVisibility,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return TextField(
|
|
controller: controller,
|
|
obscureText: isPassword ? obscureText : false,
|
|
decoration: InputDecoration(
|
|
labelText: labelText,
|
|
labelStyle: const TextStyle(color: Color(0xFF6B778C), fontSize: 14),
|
|
hintText: hintText,
|
|
hintStyle: const TextStyle(color: Color(0xFF6B778C), fontSize: 14),
|
|
filled: true,
|
|
fillColor: const Color(0xFFFAFBFC), // Background soft white
|
|
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 16),
|
|
border: OutlineInputBorder(
|
|
borderRadius: BorderRadius.circular(16),
|
|
borderSide: BorderSide(color: Colors.transparent),
|
|
),
|
|
enabledBorder: OutlineInputBorder(
|
|
borderRadius: BorderRadius.circular(16),
|
|
borderSide: BorderSide(color: Colors.transparent),
|
|
),
|
|
focusedBorder: OutlineInputBorder(
|
|
borderRadius: BorderRadius.circular(16),
|
|
borderSide: const BorderSide(color: Color(0xFF0052CC), width: 2),
|
|
),
|
|
suffixIcon: isPassword
|
|
? IconButton(
|
|
icon: Icon(
|
|
obscureText ? Icons.visibility_off : Icons.visibility,
|
|
color: const Color(0xFF6B778C),
|
|
),
|
|
onPressed: onToggleVisibility,
|
|
)
|
|
: null,
|
|
),
|
|
);
|
|
}
|
|
}
|