Commit 670fc2a3 authored by Dio Maulana's avatar Dio Maulana

textfield khusus password mode

parent 40acdcbf
import 'package:excelso_attendance/helper/component/text_field.dart';
import 'package:flutter/material.dart';
class PasswordInput extends StatefulWidget {
const PasswordInput({
Key? key,
required this.passwordController,
this.onChanged,
this.labelText = "Password",
this.labelColor,
this.marginTop,
this.borderSideActive = false,
this.textInputType = TextInputType.text,
}) : super(key: key);
final TextEditingController passwordController;
final void Function(String val)? onChanged;
final String labelText;
final Color? labelColor;
final double? marginTop;
final bool borderSideActive;
final TextInputType textInputType;
@override
State<PasswordInput> createState() => _PasswordInputState();
}
class _PasswordInputState extends State<PasswordInput> {
bool secure = true;
@override
Widget build(BuildContext context) {
return InputTextField(
controller: widget.passwordController,
labelText: widget.labelText,
labelColor: widget.labelColor,
marginTop: widget.marginTop,
marginActive: false,
onChanged: widget.onChanged,
secure: secure,
isSuffixActive: true,
borderSideActive: widget.borderSideActive,
hintText: widget.labelText,
inputType: widget.textInputType,
suffixIcon: (secure) ? Icons.visibility_off : Icons.visibility,
onSuffixPress: () {
setState(() {
secure = !secure;
});
},
);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment