134 lines
4.7 KiB
Dart
134 lines
4.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:regroup/Utils/Common/sized_box.dart';
|
|
|
|
class CustomDropDownWidgetSignup extends StatefulWidget {
|
|
const CustomDropDownWidgetSignup({
|
|
Key? key,
|
|
required this.header,
|
|
required this.title,
|
|
required this.listData,
|
|
required this.onItemSelected,
|
|
required this.leadingImage,
|
|
}) : super(key: key);
|
|
|
|
final String header;
|
|
final String title;
|
|
final List<String> listData;
|
|
final Function(String) onItemSelected;
|
|
final Widget? leadingImage;
|
|
|
|
@override
|
|
State<CustomDropDownWidgetSignup> createState() =>
|
|
_CustomDropDownWidgetSignupState();
|
|
}
|
|
|
|
class _CustomDropDownWidgetSignupState
|
|
extends State<CustomDropDownWidgetSignup> {
|
|
RxBool onDropTap = false.obs;
|
|
RxString selectedValue = "".obs;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Obx(
|
|
() => Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
GestureDetector(
|
|
onTap: () {
|
|
onDropTap.value = !onDropTap.value;
|
|
},
|
|
child: Container(
|
|
width: double.infinity,
|
|
height: 50.h,
|
|
padding: EdgeInsets.only(
|
|
top: 14.0, bottom: 14.0, right: 14.w, left: 12.w),
|
|
decoration: BoxDecoration(
|
|
color: Color(0xFFFFFFFF).withOpacity(0.10),
|
|
borderRadius: onDropTap.value
|
|
? BorderRadius.vertical(
|
|
top: Radius.circular(30.r),
|
|
)
|
|
: BorderRadius.circular(30.r),
|
|
border: Border.all(color: const Color(0xFF434A53)),
|
|
),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
// Image.asset(
|
|
// 'assets/images/png/user.png',
|
|
// ),
|
|
widget.leadingImage!,
|
|
SizedBox(width: 16.w),
|
|
Text(
|
|
selectedValue.value.isEmpty
|
|
? widget.header
|
|
: selectedValue.value,
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
fontSize: 16.sp,
|
|
fontWeight: FontWeight.w400),
|
|
),
|
|
],
|
|
),
|
|
onDropTap.value
|
|
? Image.asset('assets/images/png/arrowup.png')
|
|
: Image.asset('assets/images/png/arrowdown.png'),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
if (onDropTap.value)
|
|
Container(
|
|
width: double.infinity,
|
|
decoration: BoxDecoration(
|
|
color: Color(0xFFFFFFFF).withOpacity(0.10),
|
|
borderRadius: BorderRadius.vertical(
|
|
bottom: Radius.circular(30.r),
|
|
),
|
|
border: Border.all(color: const Color(0xFF434A53)),
|
|
),
|
|
child: ListView.builder(
|
|
shrinkWrap: true,
|
|
itemCount: widget.listData.length,
|
|
itemBuilder: (context, index) {
|
|
return InkWell(
|
|
onTap: () {
|
|
selectedValue.value = widget.listData[index];
|
|
onDropTap.value = !onDropTap.value;
|
|
widget.onItemSelected(selectedValue.value);
|
|
},
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Padding(
|
|
padding: const EdgeInsets.only(
|
|
left: 20.0, right: 20.0, top: 10.0, bottom: 10.0),
|
|
child: Text(
|
|
widget.listData[index],
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
fontSize: 16.sp,
|
|
fontWeight: FontWeight.w400,
|
|
fontFamily: 'Helvetica'),
|
|
),
|
|
),
|
|
// sizedBoxHeight(5.h),
|
|
if (index != widget.listData.length - 1)
|
|
Divider(thickness: 1, color: const Color(0xFF434A53)),
|
|
],
|
|
),
|
|
);
|
|
},
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|