refactor(add_contact): improve phone list rendering and enhance layout structure

This commit is contained in:
Vaibhav Surve 2025-07-14 10:15:11 +05:30
parent 395444e8fc
commit 07bf9a93aa

View File

@ -258,24 +258,24 @@ class _AddContactBottomSheetState extends State<AddContactBottomSheet> {
Widget _buildPhoneList() => Column(
children: List.generate(phoneControllers.length, (index) {
return Padding(
padding: const EdgeInsets.only(bottom: 12),
child: _buildLabeledRow(
"Phone Label",
phoneLabels[index],
["Work", "Mobile", "Other"],
"Phone",
phoneControllers[index],
TextInputType.phone,
onRemove: phoneControllers.length > 1
? () {
phoneControllers.removeAt(index);
phoneLabels.removeAt(index);
}
: null,
),
);
}),
return Padding(
padding: const EdgeInsets.only(bottom: 12),
child: _buildLabeledRow(
"Phone Label",
phoneLabels[index],
["Work", "Mobile", "Other"],
"Phone",
phoneControllers[index],
TextInputType.phone,
onRemove: phoneControllers.length > 1
? () {
phoneControllers.removeAt(index);
phoneLabels.removeAt(index);
}
: null,
),
);
}),
);
Widget _popupSelector({
@ -521,14 +521,16 @@ class _AddContactBottomSheetState extends State<AddContactBottomSheet> {
return const Center(child: CircularProgressIndicator());
}
return SingleChildScrollView(
padding: MediaQuery.of(context).viewInsets,
child: Container(
decoration: BoxDecoration(
color: Theme.of(context).cardColor,
borderRadius: const BorderRadius.vertical(top: Radius.circular(24)),
),
child: Padding(
return SafeArea(
child: SingleChildScrollView(
padding: MediaQuery.of(context).viewInsets,
child: Container(
decoration: BoxDecoration(
color: Theme.of(context).cardColor,
borderRadius:
const BorderRadius.vertical(top: Radius.circular(24)),
),
child: Padding(
padding: const EdgeInsets.fromLTRB(20, 16, 20, 32),
child: Form(
key: formKey,
@ -558,8 +560,6 @@ class _AddContactBottomSheetState extends State<AddContactBottomSheet> {
options: controller.buckets,
),
MySpacing.height(24),
// Toggle for Advanced Section
Obx(() => GestureDetector(
onTap: () => showAdvanced.toggle(),
child: Row(
@ -625,13 +625,14 @@ class _AddContactBottomSheetState extends State<AddContactBottomSheet> {
maxLines: 2),
],
)
: SizedBox()),
: const SizedBox()),
MySpacing.height(24),
_buildActionButtons(),
],
),
)),
),
),
),
),
);
});