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