This commit is contained in:
Surendiran 2026-04-04 18:20:03 +05:30
parent c2bdd3b556
commit dcdafd4efd
2 changed files with 111 additions and 116 deletions

File diff suppressed because one or more lines are too long

View File

@ -761,10 +761,15 @@ class _AgentDetailsScreenState extends ConsumerState<AgentDetailsScreen> {
Widget _partnerRows(BuildContext context, double viewportWidth) { Widget _partnerRows(BuildContext context, double viewportWidth) {
final mobile = ResponsiveLayout.isMobile(context); final mobile = ResponsiveLayout.isMobile(context);
final usable = viewportWidth.isFinite ? viewportWidth.clamp(280.0, 1200.0) : 800.0; final usable = viewportWidth.isFinite ? viewportWidth.clamp(280.0, 1200.0) : 800.0;
final fieldWidth = mobile ? double.infinity : ((usable - 36) / 3).clamp(140.0, 360.0); const rowGap = 12.0;
const verticalGap = 16.0;
/// Desktop: two equal columns per row (one horizontal gap).
final fieldWidth = mobile
? double.infinity
: ((usable - rowGap) / 2).clamp(140.0, 520.0);
Widget row1 = mobile if (mobile) {
? Column( return Column(
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
children: [ children: [
_labeledField('Full name *', _nameCtrl, _reqName, _labeledField('Full name *', _nameCtrl, _reqName,
@ -786,43 +791,7 @@ class _AgentDetailsScreenState extends ConsumerState<AgentDetailsScreen> {
keyboardType: TextInputType.phone, keyboardType: TextInputType.phone,
inputFormatters: _phoneInputFormatters, inputFormatters: _phoneInputFormatters,
), ),
], const SizedBox(height: 12),
)
: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: _labeledField('Full name *', _nameCtrl, _reqName,
width: fieldWidth, keyboardType: TextInputType.name),
),
const SizedBox(width: 16),
Expanded(
child: _labeledField(
'Email *',
_emailCtrl,
_emailVal,
width: fieldWidth,
keyboardType: TextInputType.emailAddress,
),
),
const SizedBox(width: 16),
Expanded(
child: _labeledField(
'Phone number *',
_mobileCtrl,
_phoneVal,
width: fieldWidth,
keyboardType: TextInputType.phone,
inputFormatters: _phoneInputFormatters,
),
),
],
);
Widget row2 = mobile
? Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
_labeledField( _labeledField(
'Partner Id *', 'Partner Id *',
_codeCtrl, _codeCtrl,
@ -845,12 +814,45 @@ class _AgentDetailsScreenState extends ConsumerState<AgentDetailsScreen> {
const SizedBox(height: 12), const SizedBox(height: 12),
_certificateColumn(context), _certificateColumn(context),
], ],
) );
: Row( }
Widget pair(Widget a, Widget b) {
return Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Expanded( Expanded(child: a),
child: _labeledField( SizedBox(width: rowGap),
Expanded(child: b),
],
);
}
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
pair(
_labeledField('Full name *', _nameCtrl, _reqName,
width: fieldWidth, keyboardType: TextInputType.name),
_labeledField(
'Email *',
_emailCtrl,
_emailVal,
width: fieldWidth,
keyboardType: TextInputType.emailAddress,
),
),
const SizedBox(height: verticalGap),
pair(
_labeledField(
'Phone number *',
_mobileCtrl,
_phoneVal,
width: fieldWidth,
keyboardType: TextInputType.phone,
inputFormatters: _phoneInputFormatters,
),
_labeledField(
'Partner Id *', 'Partner Id *',
_codeCtrl, _codeCtrl,
_reqCode, _reqCode,
@ -860,11 +862,10 @@ class _AgentDetailsScreenState extends ConsumerState<AgentDetailsScreen> {
], ],
), ),
), ),
const SizedBox(width: 12), const SizedBox(height: verticalGap),
Expanded(child: _salesDropdown(context, fieldWidth)), pair(
const SizedBox(width: 12), _salesDropdown(context, fieldWidth),
Expanded( _labeledField(
child: _labeledField(
'Address *', 'Address *',
_addressCtrl, _addressCtrl,
_reqAddress, _reqAddress,
@ -872,17 +873,11 @@ class _AgentDetailsScreenState extends ConsumerState<AgentDetailsScreen> {
keyboardType: TextInputType.streetAddress, keyboardType: TextInputType.streetAddress,
), ),
), ),
const SizedBox(width: 12), const SizedBox(height: verticalGap),
Expanded(child: _certificateColumn(context)), pair(
], _certificateColumn(context),
); const SizedBox.shrink(),
),
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
row1,
const SizedBox(height: 16),
row2,
], ],
); );
} }