|
|
|
|
@ -10,6 +10,7 @@ import 'package:hmg_patient_app/widgets/transitions/fade_page.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
import 'package:hijri_gregorian_calendar/hijri_gregorian_calendar.dart';
|
|
|
|
|
|
|
|
|
|
import 'carbs_result_page.dart';
|
|
|
|
|
|
|
|
|
|
@ -322,10 +323,13 @@ Widget inputWidget(
|
|
|
|
|
String? leadingIcon,
|
|
|
|
|
bool removePadding = false,
|
|
|
|
|
bool isAllowRadius = true,
|
|
|
|
|
bool isReadOnly = false,
|
|
|
|
|
bool isReadOnly = false,
|
|
|
|
|
TextInputType keyboardType = TextInputType.number,
|
|
|
|
|
List<String>? dropdownItems,
|
|
|
|
|
String? selectedValue,
|
|
|
|
|
SelectionType? selectionType,
|
|
|
|
|
Function(bool)? onCalendarTypeChanged,
|
|
|
|
|
String lang = 'en',
|
|
|
|
|
}) {
|
|
|
|
|
return Builder(
|
|
|
|
|
builder: (context) {
|
|
|
|
|
@ -378,116 +382,155 @@ Widget inputWidget(
|
|
|
|
|
),
|
|
|
|
|
hasSelection
|
|
|
|
|
? GestureDetector(
|
|
|
|
|
onTap: isEnable && !isReadOnly
|
|
|
|
|
? () async {
|
|
|
|
|
if (selectionType == SelectionType.dropdown) {
|
|
|
|
|
final renderBox = context.findRenderObject() as RenderBox;
|
|
|
|
|
final offset = renderBox.localToGlobal(Offset.zero);
|
|
|
|
|
|
|
|
|
|
final selected = await showMenu<String>(
|
|
|
|
|
context: context,
|
|
|
|
|
position: RelativeRect.fromLTRB(
|
|
|
|
|
offset.dx,
|
|
|
|
|
offset.dy + renderBox.size.height,
|
|
|
|
|
offset.dx + 1,
|
|
|
|
|
0,
|
|
|
|
|
),
|
|
|
|
|
items: dropdownItems
|
|
|
|
|
?.map(
|
|
|
|
|
(e) => PopupMenuItem<String>(
|
|
|
|
|
value: e,
|
|
|
|
|
child: Text(e),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
.toList() ??
|
|
|
|
|
[],
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (selected != null && onChange != null) {
|
|
|
|
|
onChange(selected);
|
|
|
|
|
}
|
|
|
|
|
} else if (selectionType == SelectionType.calendar) {
|
|
|
|
|
final picked = await showDatePicker(context: context, initialDate: DateTime.now(), firstDate: DateTime(1900), lastDate: DateTime(2100));
|
|
|
|
|
if (picked != null && onChange != null) {
|
|
|
|
|
onChange(picked.toIso8601String());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
: null,
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Text(
|
|
|
|
|
(selectedValue == null || selectedValue.isEmpty) ? _hintText : selectedValue,
|
|
|
|
|
textAlign: isRtl ? TextAlign.right : TextAlign.left,
|
|
|
|
|
textDirection: isRtl ? TextDirection.rtl : TextDirection.ltr,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
height: 21 / 14,
|
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
|
fontFamily: context.fontFamily,
|
|
|
|
|
color: (selectedValue != null && selectedValue.isNotEmpty) ? const Color(0xff2E3039) : const Color(0xffB0B0B0),
|
|
|
|
|
letterSpacing: -0.2,
|
|
|
|
|
),
|
|
|
|
|
onTap: isEnable && !isReadOnly
|
|
|
|
|
? () async {
|
|
|
|
|
if (selectionType == SelectionType.dropdown) {
|
|
|
|
|
final renderBox = context.findRenderObject() as RenderBox;
|
|
|
|
|
final offset = renderBox.localToGlobal(Offset.zero);
|
|
|
|
|
final selected = await showMenu<String>(
|
|
|
|
|
context: context,
|
|
|
|
|
position: RelativeRect.fromLTRB(
|
|
|
|
|
offset.dx,
|
|
|
|
|
offset.dy + renderBox.size.height,
|
|
|
|
|
offset.dx + renderBox.size.width,
|
|
|
|
|
0,
|
|
|
|
|
),
|
|
|
|
|
items: dropdownItems
|
|
|
|
|
?.map(
|
|
|
|
|
(e) =>
|
|
|
|
|
PopupMenuItem<String>(
|
|
|
|
|
value: e,
|
|
|
|
|
child: Text(e),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
if (hasSelectionCustomIcon && selectionCustomIcon != null)
|
|
|
|
|
SvgPicture.asset(selectionCustomIcon, width: 24, height: 24)
|
|
|
|
|
else
|
|
|
|
|
const Icon(Icons.keyboard_arrow_down_outlined),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
.toList() ??
|
|
|
|
|
[],
|
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
|
borderRadius: BorderRadius.circular(12),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: TextField(
|
|
|
|
|
enabled: isEnable,
|
|
|
|
|
scrollPadding: EdgeInsets.zero,
|
|
|
|
|
keyboardType: TextInputType.number,
|
|
|
|
|
controller: _controller,
|
|
|
|
|
readOnly: isReadOnly,
|
|
|
|
|
textAlignVertical: TextAlignVertical.top,
|
|
|
|
|
textAlign: isRtl ? TextAlign.right : TextAlign.left,
|
|
|
|
|
textDirection: isRtl ? TextDirection.rtl : TextDirection.ltr,
|
|
|
|
|
onChanged: onChange,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
height: 21 / 14,
|
|
|
|
|
fontFamily: context.fontFamily,
|
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
|
color: const Color(0xff2E3039),
|
|
|
|
|
letterSpacing: -0.2,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (selected != null && onChange != null) {
|
|
|
|
|
onChange(selected);
|
|
|
|
|
}
|
|
|
|
|
} else if (selectionType == SelectionType.calendar) {
|
|
|
|
|
bool isGregorian = true;
|
|
|
|
|
// final picked = await showDatePicker(context: context, initialDate: DateTime.now(), firstDate: DateTime(1900), lastDate: DateTime(2100));
|
|
|
|
|
final picked = await showHijriGregBottomSheet(
|
|
|
|
|
context,
|
|
|
|
|
switcherIcon: SvgPicture.asset("assets/images/svg/language.svg", width: 24),
|
|
|
|
|
fontFamily: context.fontFamily,
|
|
|
|
|
language: lang,
|
|
|
|
|
initialDate: DateTime.now(),
|
|
|
|
|
okWidget: Padding(
|
|
|
|
|
padding: const EdgeInsets.only(right: 8.0),
|
|
|
|
|
child: SvgPicture.asset(
|
|
|
|
|
"assets/images/svg/confirm.svg",
|
|
|
|
|
width: 24,
|
|
|
|
|
height: 24,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
decoration: InputDecoration(
|
|
|
|
|
isDense: true,
|
|
|
|
|
hintText: _hintText,
|
|
|
|
|
hintStyle: TextStyle(
|
|
|
|
|
cancelWidget: Padding(
|
|
|
|
|
padding: const EdgeInsets.only(right: 8.0),
|
|
|
|
|
child: SvgPicture.asset(
|
|
|
|
|
"assets/images/svg/cancel.svg",
|
|
|
|
|
colorFilter: ColorFilter.mode(
|
|
|
|
|
Colors.white,
|
|
|
|
|
BlendMode.srcIn,
|
|
|
|
|
),
|
|
|
|
|
width: 24,
|
|
|
|
|
height: 24,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
onCalendarTypeChanged: (bool value) {
|
|
|
|
|
isGregorian = value;
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
if (picked != null && onChange != null) {
|
|
|
|
|
print(picked.toIso8601String());
|
|
|
|
|
if (onCalendarTypeChanged != null) {
|
|
|
|
|
print(isGregorian.toString());
|
|
|
|
|
onCalendarTypeChanged.call(isGregorian);
|
|
|
|
|
}
|
|
|
|
|
onChange(picked.toIso8601String());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
: null,
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Text(
|
|
|
|
|
(selectedValue == null || selectedValue.isEmpty) ? _hintText : selectedValue,
|
|
|
|
|
textAlign: isRtl ? TextAlign.right : TextAlign.left,
|
|
|
|
|
textDirection: isRtl ? TextDirection.rtl : TextDirection.ltr,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
height: 21 / 16,
|
|
|
|
|
fontFamily: context.fontFamily,
|
|
|
|
|
height: 21 / 14,
|
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
|
color: const Color(0xff898A8D),
|
|
|
|
|
fontFamily: context.fontFamily,
|
|
|
|
|
color: (selectedValue != null && selectedValue.isNotEmpty) ? const Color(0xff2E3039) : const Color(0xffB0B0B0),
|
|
|
|
|
letterSpacing: -0.2,
|
|
|
|
|
),
|
|
|
|
|
prefixIconConstraints: const BoxConstraints(minWidth: 45),
|
|
|
|
|
prefixIcon: prefix == null
|
|
|
|
|
? null
|
|
|
|
|
: Text(
|
|
|
|
|
"+" + prefix,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
height: 21 / 14,
|
|
|
|
|
fontFamily: context.fontFamily,
|
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
|
color: const Color(0xff2E303A),
|
|
|
|
|
letterSpacing: -0.2,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
contentPadding: EdgeInsets.zero,
|
|
|
|
|
border: InputBorder.none,
|
|
|
|
|
focusedBorder: InputBorder.none,
|
|
|
|
|
enabledBorder: InputBorder.none,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
if (hasSelectionCustomIcon && selectionCustomIcon != null)
|
|
|
|
|
SvgPicture.asset(selectionCustomIcon, width: 24, height: 24)
|
|
|
|
|
else
|
|
|
|
|
const Icon(Icons.keyboard_arrow_down_outlined),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: TextField(
|
|
|
|
|
enabled: isEnable,
|
|
|
|
|
scrollPadding: EdgeInsets.zero,
|
|
|
|
|
keyboardType: keyboardType,
|
|
|
|
|
controller: _controller,
|
|
|
|
|
readOnly: isReadOnly,
|
|
|
|
|
textAlignVertical: TextAlignVertical.top,
|
|
|
|
|
textAlign: isRtl ? TextAlign.right : TextAlign.left,
|
|
|
|
|
textDirection: isRtl ? TextDirection.rtl : TextDirection.ltr,
|
|
|
|
|
onChanged: onChange,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
height: 21 / 14,
|
|
|
|
|
fontFamily: context.fontFamily,
|
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
|
color: const Color(0xff2E3039),
|
|
|
|
|
letterSpacing: -0.2,
|
|
|
|
|
),
|
|
|
|
|
decoration: InputDecoration(
|
|
|
|
|
isDense: true,
|
|
|
|
|
hintText: _hintText,
|
|
|
|
|
hintStyle: TextStyle(
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
height: 21 / 16,
|
|
|
|
|
fontFamily: context.fontFamily,
|
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
|
color: const Color(0xff898A8D),
|
|
|
|
|
letterSpacing: -0.2,
|
|
|
|
|
),
|
|
|
|
|
prefixIconConstraints: const BoxConstraints(minWidth: 45),
|
|
|
|
|
prefixIcon: prefix == null
|
|
|
|
|
? null
|
|
|
|
|
: Text(
|
|
|
|
|
"+" + prefix,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
height: 21 / 14,
|
|
|
|
|
fontFamily: context.fontFamily,
|
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
|
color: const Color(0xff2E303A),
|
|
|
|
|
letterSpacing: -0.2,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
contentPadding: EdgeInsets.zero,
|
|
|
|
|
border: InputBorder.none,
|
|
|
|
|
focusedBorder: InputBorder.none,
|
|
|
|
|
enabledBorder: InputBorder.none,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -497,437 +540,8 @@ Widget inputWidget(
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
// return Builder(
|
|
|
|
|
// builder: (context) {
|
|
|
|
|
// return Directionality(
|
|
|
|
|
// textDirection:Directionality.of(context),
|
|
|
|
|
// child: Container(
|
|
|
|
|
// padding: removePadding ? const EdgeInsets.only(top: 16, bottom: 16) : const EdgeInsets.symmetric(horizontal: 16, vertical: 15),
|
|
|
|
|
// alignment: Alignment.center,
|
|
|
|
|
// decoration: BoxDecoration(
|
|
|
|
|
// borderRadius: isAllowRadius ? BorderRadius.circular(15) : null,
|
|
|
|
|
// color: Colors.white,
|
|
|
|
|
// border: isBorderAllowed ? Border.all(color: const Color(0xffefefef), width: 1) : null,
|
|
|
|
|
// ),
|
|
|
|
|
// child: Row(
|
|
|
|
|
// children: [
|
|
|
|
|
// if (isAllowLeadingIcon && leadingIcon != null)
|
|
|
|
|
// Container(
|
|
|
|
|
// height: 40,
|
|
|
|
|
// width: 40,
|
|
|
|
|
// margin: const EdgeInsets.only(right: 10),
|
|
|
|
|
// padding: isLeadingCountry ? null : const EdgeInsets.all(5),
|
|
|
|
|
// decoration: const BoxDecoration(
|
|
|
|
|
// color: Color(0xFFEFEFF0),
|
|
|
|
|
// borderRadius: BorderRadius.all(Radius.circular(10)),
|
|
|
|
|
// ),
|
|
|
|
|
// child: SvgPicture.asset(leadingIcon, width: 24, height: 24),
|
|
|
|
|
// ),
|
|
|
|
|
// Expanded(
|
|
|
|
|
// child: Column(
|
|
|
|
|
// mainAxisSize: MainAxisSize.min,
|
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
// children: [
|
|
|
|
|
// Text(
|
|
|
|
|
// _labelText,
|
|
|
|
|
// style: TextStyle(
|
|
|
|
|
// fontSize: 12,
|
|
|
|
|
// fontWeight: FontWeight.w500,
|
|
|
|
|
// color: const Color(0xff898A8D),
|
|
|
|
|
// fontFamily: context.fontFamily,
|
|
|
|
|
// letterSpacing: -0.2,
|
|
|
|
|
// height: 18 / 12,
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// hasSelection
|
|
|
|
|
// ? GestureDetector(
|
|
|
|
|
// onTap: isEnable
|
|
|
|
|
// ? () async {
|
|
|
|
|
// if (selectionType == SelectionType.dropdown) {
|
|
|
|
|
// final renderBox = context.findRenderObject() as RenderBox;
|
|
|
|
|
// final offset = renderBox.localToGlobal(Offset.zero);
|
|
|
|
|
//
|
|
|
|
|
// final selected = await showMenu<String>(
|
|
|
|
|
// context: context,
|
|
|
|
|
// position: RelativeRect.fromLTRB(
|
|
|
|
|
// offset.dx,
|
|
|
|
|
// offset.dy + renderBox.size.height,
|
|
|
|
|
// offset.dx + 1,
|
|
|
|
|
// 0,
|
|
|
|
|
// ),
|
|
|
|
|
// items: dropdownItems?.map((e) {
|
|
|
|
|
// return PopupMenuItem<String>(
|
|
|
|
|
// value: e,
|
|
|
|
|
// child: Text(e),
|
|
|
|
|
// );
|
|
|
|
|
// }).toList() ??
|
|
|
|
|
// [],
|
|
|
|
|
// );
|
|
|
|
|
//
|
|
|
|
|
// if (selected != null && onChange != null) {
|
|
|
|
|
// onChange(selected);
|
|
|
|
|
// }
|
|
|
|
|
// } else if (selectionType == SelectionType.calendar) {
|
|
|
|
|
// final picked = await showDatePicker(
|
|
|
|
|
// context: context,
|
|
|
|
|
//
|
|
|
|
|
// initialDate: DateTime.now(),
|
|
|
|
|
// firstDate: DateTime(1900),
|
|
|
|
|
// lastDate: DateTime(2100),
|
|
|
|
|
// );
|
|
|
|
|
//
|
|
|
|
|
// if (picked != null && onChange != null) {
|
|
|
|
|
// onChange(picked.toIso8601String());
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// : null,
|
|
|
|
|
// child: Row(
|
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
// children: [
|
|
|
|
|
// Expanded(
|
|
|
|
|
// child: Text(
|
|
|
|
|
// selectedValue ?? _hintText,
|
|
|
|
|
// style: TextStyle(
|
|
|
|
|
// fontSize: 14,
|
|
|
|
|
// height: 21 / 14,
|
|
|
|
|
// fontWeight: FontWeight.w500,
|
|
|
|
|
// fontFamily: context.fontFamily,
|
|
|
|
|
// color: selectedValue != null ? const Color(0xff2E3039) : const Color(0xffB0B0B0),
|
|
|
|
|
// letterSpacing: -0.2,
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// if (hasSelectionCustomIcon && selectionCustomIcon != null)
|
|
|
|
|
// SvgPicture.asset(selectionCustomIcon, width: 24, height: 24)
|
|
|
|
|
// else
|
|
|
|
|
// const Icon(Icons.keyboard_arrow_down_outlined),
|
|
|
|
|
// ],
|
|
|
|
|
// ),
|
|
|
|
|
// )
|
|
|
|
|
// : TextField(
|
|
|
|
|
// enabled: isEnable,
|
|
|
|
|
// scrollPadding: EdgeInsets.zero,
|
|
|
|
|
// keyboardType: TextInputType.number,
|
|
|
|
|
// controller: _controller,
|
|
|
|
|
// textAlignVertical: TextAlignVertical.top,
|
|
|
|
|
// onChanged: onChange,
|
|
|
|
|
// style: TextStyle(
|
|
|
|
|
// fontSize: 14,
|
|
|
|
|
// height: 21 / 14,
|
|
|
|
|
// fontFamily: context.fontFamily,
|
|
|
|
|
// fontWeight: FontWeight.w500,
|
|
|
|
|
// color: const Color(0xff2E3039),
|
|
|
|
|
// letterSpacing: -0.2,
|
|
|
|
|
// ),
|
|
|
|
|
// decoration: InputDecoration(
|
|
|
|
|
// isDense: true,
|
|
|
|
|
// hintText: _hintText,
|
|
|
|
|
// hintStyle: TextStyle(
|
|
|
|
|
// fontSize: 14,
|
|
|
|
|
// height: 21 / 16,
|
|
|
|
|
// fontFamily: context.fontFamily,
|
|
|
|
|
// fontWeight: FontWeight.w500,
|
|
|
|
|
// color: const Color(0xff898A8D),
|
|
|
|
|
// letterSpacing: -0.2,
|
|
|
|
|
// ),
|
|
|
|
|
// prefixIconConstraints: const BoxConstraints(minWidth: 45),
|
|
|
|
|
// prefixIcon: prefix == null
|
|
|
|
|
// ? null
|
|
|
|
|
// : Text(
|
|
|
|
|
// "+" + prefix,
|
|
|
|
|
// style: TextStyle(
|
|
|
|
|
// fontSize: 14,
|
|
|
|
|
// height: 21 / 14,
|
|
|
|
|
// fontFamily: context.fontFamily,
|
|
|
|
|
// fontWeight: FontWeight.w500,
|
|
|
|
|
// color: const Color(0xff2E303A),
|
|
|
|
|
// letterSpacing: -0.2,
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// contentPadding: EdgeInsets.zero,
|
|
|
|
|
// border: InputBorder.none,
|
|
|
|
|
// focusedBorder: InputBorder.none,
|
|
|
|
|
// enabledBorder: InputBorder.none,
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// ],
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// ],
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// );
|
|
|
|
|
// },
|
|
|
|
|
// );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Widget inputWidget(
|
|
|
|
|
// String _labelText,
|
|
|
|
|
// String _hintText,
|
|
|
|
|
// TextEditingController? _controller, {
|
|
|
|
|
// Function(String?)? onChange,
|
|
|
|
|
// String? prefix,
|
|
|
|
|
// bool isEnable = true,
|
|
|
|
|
// bool hasSelection = false,
|
|
|
|
|
// bool hasDropDown = false,
|
|
|
|
|
// bool hasSelectionCustomIcon = false,
|
|
|
|
|
// String? selectionCustomIcon,
|
|
|
|
|
// bool isBorderAllowed = true,
|
|
|
|
|
// bool isAllowLeadingIcon = false,
|
|
|
|
|
// bool isLeadingCountry = false,
|
|
|
|
|
// String? leadingIcon,
|
|
|
|
|
// bool removePadding = false,
|
|
|
|
|
// bool isAllowRadius = true,
|
|
|
|
|
// List<String>? dropdownItems, // <-- NEW
|
|
|
|
|
// String? selectedValue, // <-- NEW
|
|
|
|
|
// }) {
|
|
|
|
|
// return Container(
|
|
|
|
|
// padding: removePadding
|
|
|
|
|
// ? EdgeInsets.only(top: 16, bottom: 16)
|
|
|
|
|
// : EdgeInsets.symmetric(horizontal: 16, vertical: 15),
|
|
|
|
|
// alignment: Alignment.center,
|
|
|
|
|
// decoration: BoxDecoration(
|
|
|
|
|
// borderRadius: isAllowRadius ? BorderRadius.circular(15) : null,
|
|
|
|
|
// color: Colors.white,
|
|
|
|
|
// border: isBorderAllowed ? Border.all(color: Color(0xffefefef), width: 1) : null,
|
|
|
|
|
// ),
|
|
|
|
|
// child: Row(
|
|
|
|
|
// children: [
|
|
|
|
|
// if (isAllowLeadingIcon && leadingIcon != null)
|
|
|
|
|
// Container(
|
|
|
|
|
// height: 40,
|
|
|
|
|
// width: 40,
|
|
|
|
|
// margin: EdgeInsets.only(right: 10),
|
|
|
|
|
// padding: isLeadingCountry ? null : EdgeInsets.all(5),
|
|
|
|
|
// decoration: BoxDecoration(
|
|
|
|
|
// color: Color(0xFFEFEFF0),
|
|
|
|
|
// borderRadius: BorderRadius.all(Radius.circular(10)),
|
|
|
|
|
// ),
|
|
|
|
|
// child: SvgPicture.asset(leadingIcon, width: 24, height: 24),
|
|
|
|
|
// ),
|
|
|
|
|
// Expanded(
|
|
|
|
|
// child: Column(
|
|
|
|
|
// mainAxisSize: MainAxisSize.min,
|
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
// children: [
|
|
|
|
|
// Text(
|
|
|
|
|
// _labelText,
|
|
|
|
|
// style: TextStyle(
|
|
|
|
|
// fontSize: 12,
|
|
|
|
|
// fontWeight: FontWeight.w500,
|
|
|
|
|
// color: Color(0xff898A8D),
|
|
|
|
|
// fontFamily: 'poppins',
|
|
|
|
|
// letterSpacing: -0.2,
|
|
|
|
|
// height: 18 / 12,
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// hasDropDown
|
|
|
|
|
// ? DropdownButton<String>(
|
|
|
|
|
// isExpanded: true,
|
|
|
|
|
// value: selectedValue,
|
|
|
|
|
// hint: Text(_hintText,
|
|
|
|
|
// style: TextStyle(
|
|
|
|
|
// fontSize: 14,
|
|
|
|
|
// height: 21 / 16,
|
|
|
|
|
// fontWeight: FontWeight.w500,
|
|
|
|
|
// color: Color(0xff2E3039),
|
|
|
|
|
// letterSpacing: -0.2,
|
|
|
|
|
// )),
|
|
|
|
|
// icon: SizedBox.shrink(), // hide default arrow
|
|
|
|
|
// underline: SizedBox.shrink(), // remove underline
|
|
|
|
|
// onChanged: isEnable ? onChange : null,
|
|
|
|
|
// items: dropdownItems?.map((String value) {
|
|
|
|
|
// return DropdownMenuItem<String>(
|
|
|
|
|
// value: value,
|
|
|
|
|
// child: Text(
|
|
|
|
|
// value,
|
|
|
|
|
// style: TextStyle(
|
|
|
|
|
// fontSize: 14,
|
|
|
|
|
// height: 21 / 14,
|
|
|
|
|
// fontWeight: FontWeight.w500,
|
|
|
|
|
// color: Color(0xff2E3039),
|
|
|
|
|
// letterSpacing: -0.2,
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// );
|
|
|
|
|
// }).toList(),
|
|
|
|
|
// )
|
|
|
|
|
// : TextField(
|
|
|
|
|
// enabled: isEnable,
|
|
|
|
|
// scrollPadding: EdgeInsets.zero,
|
|
|
|
|
// keyboardType: TextInputType.number,
|
|
|
|
|
// controller: _controller,
|
|
|
|
|
// textAlignVertical: TextAlignVertical.top,
|
|
|
|
|
// onChanged: onChange,
|
|
|
|
|
// style: TextStyle(
|
|
|
|
|
// fontSize: 14,
|
|
|
|
|
// height: 21 / 14,
|
|
|
|
|
// fontWeight: FontWeight.w500,
|
|
|
|
|
// color: Color(0xff2E3039),
|
|
|
|
|
// letterSpacing: -0.2,
|
|
|
|
|
// ),
|
|
|
|
|
// decoration: InputDecoration(
|
|
|
|
|
// isDense: true,
|
|
|
|
|
// hintText: _hintText,
|
|
|
|
|
// hintStyle: TextStyle(
|
|
|
|
|
// fontSize: 14,
|
|
|
|
|
// height: 21 / 16,
|
|
|
|
|
// fontWeight: FontWeight.w500,
|
|
|
|
|
// color: Color(0xff2E3039),
|
|
|
|
|
// letterSpacing: -0.2,
|
|
|
|
|
// ),
|
|
|
|
|
// prefixIconConstraints: BoxConstraints(minWidth: 45),
|
|
|
|
|
// prefixIcon: prefix == null
|
|
|
|
|
// ? null
|
|
|
|
|
// : Text(
|
|
|
|
|
// "+" + prefix,
|
|
|
|
|
// style: TextStyle(
|
|
|
|
|
// fontSize: 14,
|
|
|
|
|
// height: 21 / 14,
|
|
|
|
|
// fontWeight: FontWeight.w500,
|
|
|
|
|
// color: Color(0xff2E303A),
|
|
|
|
|
// letterSpacing: -0.2,
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// contentPadding: EdgeInsets.zero,
|
|
|
|
|
// border: InputBorder.none,
|
|
|
|
|
// focusedBorder: InputBorder.none,
|
|
|
|
|
// enabledBorder: InputBorder.none,
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// ],
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// if (hasSelection && !hasSelectionCustomIcon)
|
|
|
|
|
// Icon(Icons.keyboard_arrow_down_outlined),
|
|
|
|
|
// if (hasSelection && hasSelectionCustomIcon)
|
|
|
|
|
// Container(
|
|
|
|
|
// height: 40,
|
|
|
|
|
// width: 40,
|
|
|
|
|
// margin: EdgeInsets.only(left: 10),
|
|
|
|
|
// padding: EdgeInsets.all(5),
|
|
|
|
|
// decoration: BoxDecoration(
|
|
|
|
|
// borderRadius: BorderRadius.all(Radius.circular(10)),
|
|
|
|
|
// ),
|
|
|
|
|
// child: SvgPicture.asset(selectionCustomIcon!, width: 24, height: 24),
|
|
|
|
|
// ),
|
|
|
|
|
// ],
|
|
|
|
|
// ),
|
|
|
|
|
// );
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// Widget inputWidget(
|
|
|
|
|
// String _labelText,
|
|
|
|
|
// String _hintText,
|
|
|
|
|
// TextEditingController? _controller, {
|
|
|
|
|
// Function? onChange(String? value)?,
|
|
|
|
|
// String? prefix,
|
|
|
|
|
// bool isEnable = true,
|
|
|
|
|
// bool hasSelection = false,
|
|
|
|
|
// bool hasSelectionCustomIcon = false,
|
|
|
|
|
// String? selectionCustomIcon,
|
|
|
|
|
// bool isBorderAllowed = true,
|
|
|
|
|
// bool isAllowLeadingIcon = false,
|
|
|
|
|
// bool isLeadingCountry = false,
|
|
|
|
|
// String? leadingIcon,
|
|
|
|
|
// bool removePadding = false,
|
|
|
|
|
// bool isAllowRadius = true,
|
|
|
|
|
// }) {
|
|
|
|
|
// return Container(
|
|
|
|
|
// padding: removePadding ? EdgeInsets.only(top: 16, bottom: 16) : EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15),
|
|
|
|
|
// alignment: Alignment.center,
|
|
|
|
|
// decoration: BoxDecoration(
|
|
|
|
|
// borderRadius: isAllowRadius ? BorderRadius.circular(15) : null,
|
|
|
|
|
// color: Colors.white,
|
|
|
|
|
// border: isBorderAllowed ? Border.all(color: Color(0xffefefef), width: 1) : null,
|
|
|
|
|
// ),
|
|
|
|
|
// child: InkWell(
|
|
|
|
|
// onTap: hasSelection ? () {} : null,
|
|
|
|
|
// child: Row(
|
|
|
|
|
// children: [
|
|
|
|
|
// if (isAllowLeadingIcon && leadingIcon != null)
|
|
|
|
|
// Container(
|
|
|
|
|
// height: 40,
|
|
|
|
|
// width: 40,
|
|
|
|
|
// margin: EdgeInsets.only(right: 10),
|
|
|
|
|
// padding: isLeadingCountry ? null : EdgeInsets.all(5),
|
|
|
|
|
// decoration: BoxDecoration(
|
|
|
|
|
// color: Color(0xFFEFEFF0),
|
|
|
|
|
// borderRadius: BorderRadius.all(Radius.circular(10)),
|
|
|
|
|
// ),
|
|
|
|
|
// child: SvgPicture.asset(leadingIcon, width: 24, height: 24),
|
|
|
|
|
// ),
|
|
|
|
|
// Expanded(
|
|
|
|
|
// child: Column(
|
|
|
|
|
// mainAxisSize: MainAxisSize.min,
|
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
// children: [
|
|
|
|
|
// Text(
|
|
|
|
|
// _labelText,
|
|
|
|
|
// style: TextStyle(fontSize: 12, fontWeight: FontWeight.w500, color: Color(0xff898A8D), fontFamily: 'poppins', letterSpacing: -0.2, height: 18 / 12),
|
|
|
|
|
// ),
|
|
|
|
|
// // if(prefix !=null) Row(
|
|
|
|
|
// // children: [
|
|
|
|
|
// // Text(
|
|
|
|
|
// // "+" + prefix,
|
|
|
|
|
// // style: TextStyle(
|
|
|
|
|
// // fontSize: 14,
|
|
|
|
|
// // height: 21 / 14,
|
|
|
|
|
// // fontWeight: FontWeight.w500,
|
|
|
|
|
// // color: Color(0xff2E303A),
|
|
|
|
|
// // letterSpacing: -0.56,
|
|
|
|
|
// // ),
|
|
|
|
|
// // ),
|
|
|
|
|
// // ],
|
|
|
|
|
// // ),
|
|
|
|
|
// TextField(
|
|
|
|
|
// enabled: isEnable,
|
|
|
|
|
// scrollPadding: EdgeInsets.zero,
|
|
|
|
|
// keyboardType: TextInputType.number,
|
|
|
|
|
// controller: _controller,
|
|
|
|
|
// textAlignVertical: TextAlignVertical.top,
|
|
|
|
|
// onChanged: onChange,
|
|
|
|
|
// style: TextStyle(fontSize: 14, height: 21 / 14, fontWeight: FontWeight.w500, color: Color(0xff2E3039), letterSpacing: -0.2),
|
|
|
|
|
// decoration: InputDecoration(
|
|
|
|
|
// isDense: true,
|
|
|
|
|
// hintText: _hintText,
|
|
|
|
|
// hintStyle: TextStyle(fontSize: 14, height: 21 / 16, fontWeight: FontWeight.w500, color: Color(0xff2E3039), letterSpacing: -0.2),
|
|
|
|
|
// prefixIconConstraints: BoxConstraints(minWidth: 45),
|
|
|
|
|
// prefixIcon: prefix == null
|
|
|
|
|
// ? null
|
|
|
|
|
// : Text(
|
|
|
|
|
// "+" + prefix,
|
|
|
|
|
// style: TextStyle(fontSize: 14, height: 21 / 14, fontWeight: FontWeight.w500, color: Color(0xff2E303A), letterSpacing: -0.2),
|
|
|
|
|
// ),
|
|
|
|
|
// contentPadding: EdgeInsets.zero,
|
|
|
|
|
// border: InputBorder.none,
|
|
|
|
|
// focusedBorder: InputBorder.none,
|
|
|
|
|
// enabledBorder: InputBorder.none,
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// ],
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// if (hasSelection && !hasSelectionCustomIcon) Icon(Icons.keyboard_arrow_down_outlined),
|
|
|
|
|
// if (hasSelection && hasSelectionCustomIcon)
|
|
|
|
|
// Container(
|
|
|
|
|
// height: 40,
|
|
|
|
|
// width: 40,
|
|
|
|
|
// margin: EdgeInsets.only(left: 10),
|
|
|
|
|
// padding: EdgeInsets.all(5),
|
|
|
|
|
// decoration: BoxDecoration(
|
|
|
|
|
// borderRadius: BorderRadius.all(Radius.circular(10)),
|
|
|
|
|
// ),
|
|
|
|
|
// child: SvgPicture.asset(selectionCustomIcon!, width: 24, height: 24),
|
|
|
|
|
// ),
|
|
|
|
|
// ],
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// );
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
extension BorderedContainer on Widget {
|
|
|
|
|
Widget get withBorderedContainer => Container(
|
|
|
|
|
padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15),
|
|
|
|
|
|