52 lines
1.5 KiB
Dart
52 lines
1.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:manager_app/Components/text_field_container.dart';
|
|
import 'package:manager_app/constants.dart';
|
|
|
|
class RoundedPasswordField extends StatefulWidget {
|
|
final ValueChanged<String> onChanged;
|
|
final String initialValue;
|
|
const RoundedPasswordField({
|
|
Key? key,
|
|
required this.onChanged,
|
|
required this.initialValue
|
|
}) : super(key: key);
|
|
|
|
@override
|
|
_RoundedPasswordFieldState createState() => _RoundedPasswordFieldState();
|
|
}
|
|
|
|
class _RoundedPasswordFieldState extends State<RoundedPasswordField> {
|
|
bool isVisible = true;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return TextFieldContainer(
|
|
child: TextFormField(
|
|
obscureText: isVisible,
|
|
onChanged: widget.onChanged,
|
|
initialValue: widget.initialValue,
|
|
autofillHints: [AutofillHints.password],
|
|
cursorColor: kPrimaryColor,
|
|
style: TextStyle(fontSize: 20, color: kBlack),
|
|
decoration: InputDecoration(
|
|
hintText: "Mot de passe",
|
|
hintStyle: TextStyle(fontSize: 20.0, color: kBlack, fontWeight: FontWeight.normal),
|
|
icon: Icon(
|
|
Icons.lock,
|
|
color: kPrimaryColor,
|
|
),
|
|
suffixIcon: IconButton(
|
|
icon: Icon(Icons.visibility),
|
|
onPressed: () {
|
|
setState(() {
|
|
isVisible = !isVisible;
|
|
});
|
|
},
|
|
color: kPrimaryColor,
|
|
),
|
|
border: InputBorder.none,
|
|
),
|
|
),
|
|
);
|
|
}
|
|
} |