fbmobile/lib/ui/widgets/login_text_field.dart

40 lines
1.3 KiB
Dart
Raw Normal View History

2021-02-02 14:33:23 +00:00
import 'package:flutter/material.dart';
class LoginTextField extends StatelessWidget {
final TextEditingController controller;
final String placeHolder;
final TextInputType keyboardType;
final bool obscureText;
final Widget prefixIcon;
2023-01-04 20:17:54 +00:00
const LoginTextField(this.controller, this.placeHolder, this.prefixIcon,
2023-01-16 00:44:34 +00:00
{super.key,
this.keyboardType = TextInputType.text,
this.obscureText = false});
2021-02-02 14:33:23 +00:00
@override
Widget build(BuildContext context) {
return Container(
2023-01-04 20:17:54 +00:00
padding: const EdgeInsets.symmetric(horizontal: 10.0),
margin: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 10.0),
2021-02-02 14:33:23 +00:00
height: 50.0,
alignment: Alignment.centerLeft,
child: TextFormField(
keyboardType: keyboardType,
obscureText: obscureText,
decoration: InputDecoration(
suffixIcon: IconButton(
onPressed: () => controller.clear(),
2023-01-04 20:17:54 +00:00
icon: const Icon(Icons.clear),
2021-02-02 14:33:23 +00:00
),
prefixIcon: prefixIcon,
hintText: placeHolder,
2023-01-04 20:17:54 +00:00
contentPadding: const EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0),
2023-01-16 00:44:34 +00:00
border:
OutlineInputBorder(borderRadius: BorderRadius.circular(32.0)),
2021-02-02 14:33:23 +00:00
),
controller: controller),
);
}
}