Merge remote-tracking branch 'origin/auth-login-and-2fa-login' into auth-recover-password
This commit is contained in:
@@ -29,12 +29,13 @@ class CountryPrefixPicker extends StatelessWidget {
|
||||
width: width,
|
||||
height: height,
|
||||
child: CountryCodePicker(
|
||||
showCountryOnly: true,
|
||||
showOnlyCountryWhenClosed: true,
|
||||
showDropDownButton: true,
|
||||
headerText: headerText,
|
||||
onChanged: onChanged,
|
||||
initialSelection: initialCountryCode,
|
||||
showFlag: false,
|
||||
showDropDownButton: false,
|
||||
hideMainText: true,
|
||||
showFlag: true,
|
||||
padding: EdgeInsets.zero,
|
||||
builder: (CountryCode? country) {
|
||||
if (country == null) {
|
||||
|
||||
@@ -3,7 +3,9 @@ import 'package:flutter/material.dart';
|
||||
class CustomDropdown extends StatelessWidget {
|
||||
final List<Widget> items;
|
||||
final List<dynamic>? values;
|
||||
|
||||
final ValueChanged<dynamic> onChanged;
|
||||
|
||||
final dynamic value;
|
||||
final String? hint;
|
||||
final String? label;
|
||||
@@ -28,10 +30,15 @@ class CustomDropdown extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final borderColor = color ?? const Color(0xFF4B4B4B);
|
||||
|
||||
OutlineInputBorder border(Color c) => OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(radius)),
|
||||
borderSide: BorderSide(color: c),
|
||||
);
|
||||
return Column(
|
||||
spacing: 8,
|
||||
children: [
|
||||
if (label != null)
|
||||
if (label != null) ...[
|
||||
Align(
|
||||
alignment: Alignment.bottomLeft,
|
||||
child: Text(
|
||||
@@ -39,6 +46,8 @@ class CustomDropdown extends StatelessWidget {
|
||||
style: const TextStyle(fontSize: 14, letterSpacing: 0),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
],
|
||||
SizedBox(
|
||||
width: width,
|
||||
height: height,
|
||||
@@ -46,15 +55,21 @@ class CustomDropdown extends StatelessWidget {
|
||||
child: DropdownButtonFormField<dynamic>(
|
||||
dropdownColor: Colors.white,
|
||||
decoration: InputDecoration(
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(radius)),
|
||||
borderSide: BorderSide(
|
||||
color: color ?? const Color(0xFF4B4B4B),
|
||||
),
|
||||
enabledBorder: border(borderColor),
|
||||
focusedBorder: border(borderColor),
|
||||
disabledBorder: border(borderColor),
|
||||
errorBorder: border(borderColor),
|
||||
focusedErrorBorder: border(borderColor),
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 12,
|
||||
vertical: 16,
|
||||
),
|
||||
),
|
||||
|
||||
initialValue: value,
|
||||
|
||||
onChanged: onChanged,
|
||||
|
||||
hint: hint != null ? Text(hint!) : null,
|
||||
items: List<DropdownMenuItem<dynamic>>.generate(items.length, (
|
||||
int index,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class CustomTextField extends StatelessWidget {
|
||||
class CustomTextField extends StatefulWidget {
|
||||
final bool? showPassword;
|
||||
final TextInputType keyboardType;
|
||||
final TextInputAction? textInputAction;
|
||||
@@ -11,10 +11,9 @@ class CustomTextField extends StatelessWidget {
|
||||
final double labelSize;
|
||||
final int? lines;
|
||||
final ValueChanged<String>? onChanged;
|
||||
final bool readOnly;
|
||||
final int? length;
|
||||
final TextEditingController? controller;
|
||||
final String? initialValue;
|
||||
final Color color;
|
||||
|
||||
const CustomTextField({
|
||||
super.key,
|
||||
@@ -29,60 +28,71 @@ class CustomTextField extends StatelessWidget {
|
||||
this.lines,
|
||||
this.length,
|
||||
this.onChanged,
|
||||
this.readOnly = false,
|
||||
this.controller,
|
||||
this.initialValue,
|
||||
this.color = const Color(0xFF4B4B4B),
|
||||
});
|
||||
|
||||
@override
|
||||
State<CustomTextField> createState() => CustomTextFieldState();
|
||||
}
|
||||
|
||||
class CustomTextFieldState extends State<CustomTextField> {
|
||||
late bool _showPassword;
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_showPassword = widget.showPassword ?? true;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
spacing: 8,
|
||||
children: [
|
||||
if (label.isNotEmpty)
|
||||
if (widget.label.isNotEmpty)
|
||||
Align(
|
||||
alignment: Alignment.bottomLeft,
|
||||
child: Text(
|
||||
label,
|
||||
style: TextStyle(fontSize: labelSize, letterSpacing: 0),
|
||||
widget.label,
|
||||
style: TextStyle(fontSize: widget.labelSize, letterSpacing: 0),
|
||||
),
|
||||
),
|
||||
TextFormField(
|
||||
onFieldSubmitted: onSubmitted,
|
||||
textInputAction: textInputAction,
|
||||
controller: controller,
|
||||
keyboardType: keyboardType,
|
||||
obscureText: !(showPassword ?? true),
|
||||
enableSuggestions: (showPassword ?? true),
|
||||
autocorrect: !(showPassword ?? true),
|
||||
readOnly: widget.readOnly,
|
||||
onFieldSubmitted: widget.onSubmitted,
|
||||
textInputAction: widget.textInputAction,
|
||||
controller: widget.controller,
|
||||
keyboardType: widget.keyboardType,
|
||||
obscureText: !_showPassword,
|
||||
enableSuggestions: _showPassword,
|
||||
autocorrect: !_showPassword,
|
||||
style: const TextStyle(color: Color(0xFF4B4B4B)),
|
||||
decoration: InputDecoration(
|
||||
counterText: "",
|
||||
hintText: hint,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
hintText: widget.hint,
|
||||
border: const OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(12)),
|
||||
borderSide: BorderSide(color: color),
|
||||
borderSide: BorderSide(color: Color(0xFF4B4B4B)),
|
||||
gapPadding: 16,
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(12)),
|
||||
borderSide: BorderSide(color: color),
|
||||
gapPadding: 16,
|
||||
),
|
||||
suffixIcon: showPassword != null
|
||||
suffixIcon: widget.showPassword != null
|
||||
? IconButton(
|
||||
icon: Icon(
|
||||
showPassword! ? Icons.visibility_off_outlined : Icons.visibility_outlined,
|
||||
),
|
||||
onPressed: onVisibilityChanged,
|
||||
)
|
||||
icon: Icon(
|
||||
_showPassword ? Icons.visibility_off : Icons.visibility,
|
||||
),
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
_showPassword = !_showPassword;
|
||||
});
|
||||
},
|
||||
//onpressed: widget.onVisibilityChanged,
|
||||
)
|
||||
: null,
|
||||
),
|
||||
initialValue: initialValue,
|
||||
minLines: lines ?? 1,
|
||||
maxLines: lines ?? 1,
|
||||
maxLength: length,
|
||||
onChanged: onChanged,
|
||||
minLines: widget.lines ?? 1,
|
||||
maxLines: widget.lines ?? 1,
|
||||
maxLength: widget.length,
|
||||
onChanged: widget.onChanged,
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user