generated from FGA0138-MDS-Ajax/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'main/44-refatoracao' into 60-refatorar-…
…backend
- Loading branch information
Showing
3 changed files
with
118 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,80 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class PurpleTextField extends StatelessWidget { | ||
class PurpleTextField extends StatefulWidget { | ||
final String label; | ||
final Icon icon; | ||
final TextEditingController controller; | ||
final bool isPassword; | ||
final bool isSecurepassword; | ||
|
||
const PurpleTextField({ | ||
super.key, | ||
required this.label, | ||
required this.icon, | ||
required this.controller, | ||
required this.isPassword, | ||
required this.isSecurepassword, | ||
}); | ||
|
||
@override | ||
_PurpleTextFieldState createState() => _PurpleTextFieldState(); | ||
} | ||
|
||
class _PurpleTextFieldState extends State<PurpleTextField> { | ||
late bool _securePasswordState; | ||
|
||
@override | ||
void initState() { | ||
super.initState(); | ||
// Inicializa o estado da visibilidade da senha com o valor recebido no construtor. | ||
_securePasswordState = widget.isSecurepassword; | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return SizedBox( | ||
width: 324, | ||
height: 68, | ||
child: TextField( | ||
obscureText: isPassword, | ||
controller: controller, | ||
obscureText: _securePasswordState, | ||
controller: widget.controller, | ||
decoration: InputDecoration( | ||
border: OutlineInputBorder( | ||
borderSide: BorderSide(width: 2), | ||
borderRadius: BorderRadius.circular(4.0)), | ||
enabledBorder: OutlineInputBorder( | ||
borderSide: BorderSide(width: 2, color: Color(0xFFACACAC))), | ||
focusedBorder: OutlineInputBorder( | ||
borderSide: BorderSide(width: 2, color: Color(0x80FC298F))), | ||
prefixIcon: icon, | ||
filled: true, | ||
fillColor: Color(0xFFDEE1FF), | ||
labelText: label, | ||
labelStyle: TextStyle( | ||
color: Color(0xCCACACAC), | ||
fontSize: 16.0, | ||
fontWeight: FontWeight.w100)), | ||
border: OutlineInputBorder( | ||
borderSide: BorderSide(width: 2), | ||
borderRadius: BorderRadius.circular(4.0)), | ||
enabledBorder: OutlineInputBorder( | ||
borderSide: BorderSide(width: 2, color: Color(0xFFACACAC))), | ||
focusedBorder: OutlineInputBorder( | ||
borderSide: BorderSide(width: 2, color: Color(0x80FC298F))), | ||
prefixIcon: widget.icon, | ||
filled: true, | ||
fillColor: Color(0xFFDEE1FF), | ||
labelText: widget.label, | ||
suffixIcon: togglePassword(), | ||
labelStyle: TextStyle( | ||
color: Color(0xCCACACAC), | ||
fontSize: 16.0, | ||
fontWeight: FontWeight.w100), | ||
), | ||
), | ||
); | ||
} | ||
|
||
// Função para alternar a visibilidade da senha | ||
Widget togglePassword() { | ||
return IconButton( | ||
onPressed: () { | ||
setState(() { | ||
_securePasswordState = !_securePasswordState; | ||
}); | ||
}, | ||
icon: _securePasswordState | ||
? Icon( | ||
Icons.visibility, | ||
color: Color(0xFFACACAC), | ||
) | ||
: Icon( | ||
Icons.visibility_off, | ||
color: Color(0xFFACACAC), | ||
), | ||
); | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
catavento/lib/screens/Login/components/input_purple_email.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class PurpleTextFieldEmail extends StatefulWidget { | ||
final String label; | ||
final Icon icon; | ||
final TextEditingController controller; | ||
|
||
const PurpleTextFieldEmail({ | ||
super.key, | ||
required this.label, | ||
required this.icon, | ||
required this.controller, | ||
}); | ||
|
||
@override | ||
_PurpleTextFieldEmailState createState() => _PurpleTextFieldEmailState(); | ||
} | ||
|
||
class _PurpleTextFieldEmailState extends State<PurpleTextFieldEmail> { | ||
@override | ||
void initState() { | ||
super.initState(); | ||
// Inicializa o estado da visibilidade da senha com o valor recebido no construtor. | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return SizedBox( | ||
width: 324, | ||
height: 68, | ||
child: TextField( | ||
controller: widget.controller, | ||
decoration: InputDecoration( | ||
border: OutlineInputBorder( | ||
borderSide: BorderSide(width: 2), | ||
borderRadius: BorderRadius.circular(4.0)), | ||
enabledBorder: OutlineInputBorder( | ||
borderSide: BorderSide(width: 2, color: Color(0xFFACACAC))), | ||
focusedBorder: OutlineInputBorder( | ||
borderSide: BorderSide(width: 2, color: Color(0x80FC298F))), | ||
prefixIcon: widget.icon, | ||
filled: true, | ||
fillColor: Color(0xFFDEE1FF), | ||
labelText: widget.label, | ||
labelStyle: TextStyle( | ||
color: Color(0xCCACACAC), | ||
fontSize: 16.0, | ||
fontWeight: FontWeight.w100), | ||
), | ||
), | ||
); | ||
} | ||
|
||
// Função para alternar a visibilidade da senha | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters