GenderPickerWithImage constructor
GenderPickerWithImage({
- Key? key,
- TextStyle selectedGenderTextStyle = const TextStyle(fontSize: 19, color: Colors.redAccent, fontWeight: FontWeight.w600),
- TextStyle unSelectedGenderTextStyle = const TextStyle(fontSize: 19, color: Colors.black, fontWeight: FontWeight.w600),
- bool verticalAlignedText = false,
- Duration animationDuration = const Duration(milliseconds: 500),
- double opacityOfGradient = 0.6,
- EdgeInsetsGeometry padding = const EdgeInsets.all(10),
- bool isCircular = true,
- double size = 40.0,
- bool equallyAligned = true,
- Gender? selectedGender = Gender.Male,
- required ValueChanged<
Gender?> ? onChanged, - LinearGradient linearGradient = const LinearGradient(colors: [Color(0xFF3271a8), Color(0xFF8b32a8)], tileMode: TileMode.clamp, begin: Alignment.bottomLeft, end: Alignment.topRight, stops: [0.0, 1.0]),
- bool showOtherGender = false,
- ImageProvider<
Object> maleImage = const AssetImage("assets/images/male.png", package: 'gender_picker'), - ImageProvider<
Object> femaleImage = const AssetImage("assets/images/female.png", package: 'gender_picker'), - ImageProvider<
Object> otherGenderImage = const AssetImage("assets/images/other.png", package: 'gender_picker'), - String maleText = "Male",
- String femaleText = "Female",
- String otherGenderText = "Other",
Implementation
GenderPickerWithImage({
Key? key,
// by default selected color of selected gender text
this.selectedGenderTextStyle = const TextStyle(
fontSize: 19,
color: Colors.redAccent,
fontWeight: FontWeight.w600,
),
// by default un-selected color of selected gender text
this.unSelectedGenderTextStyle = const TextStyle(
fontSize: 19,
color: Colors.black,
fontWeight: FontWeight.w600,
),
// bedefault verticallyaligned text is false to show in same row
this.verticalAlignedText = false,
// animation loading time by default set to [500 milliseconds]
this.animationDuration = const Duration(milliseconds: 500),
// by default gradient opacity set to 0.6
this.opacityOfGradient = 0.6,
// padding set to 10 from all side, you can also define yours
this.padding = const EdgeInsets.all(10),
// selection is in circular and can be in square as you needed
this.isCircular = true,
// default size of ImageIcon
this.size = 40.0,
// if alignment is true then everything will be in center
this.equallyAligned = true,
// to show selected Gender
this.selectedGender = Gender.Male,
// OnChanged is mandatory to implement, so ca change state of widget
required this.onChanged,
// by default gradient color
this.linearGradient = const LinearGradient(
colors: [Color(0xFF3271a8), Color(0xFF8b32a8)],
tileMode: TileMode.clamp,
begin: Alignment.bottomLeft,
end: Alignment.topRight,
stops: [0.0, 1.0]),
this.showOtherGender = false,
// Images asset can be network images,
this.maleImage =
const AssetImage("assets/images/male.png", package: 'gender_picker'),
this.femaleImage =
const AssetImage("assets/images/female.png", package: 'gender_picker'),
this.otherGenderImage =
const AssetImage("assets/images/other.png", package: 'gender_picker'),
// by default text to show
this.maleText = "Male",
this.femaleText = "Female",
this.otherGenderText = "Other",
}) : super(key: key);