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,128 +761,123 @@ 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,
width: fieldWidth, keyboardType: TextInputType.name), width: fieldWidth, keyboardType: TextInputType.name),
const SizedBox(height: 12), const SizedBox(height: 12),
_labeledField( _labeledField(
'Email *', 'Email *',
_emailCtrl, _emailCtrl,
_emailVal, _emailVal,
width: fieldWidth, width: fieldWidth,
keyboardType: TextInputType.emailAddress, keyboardType: TextInputType.emailAddress,
), ),
const SizedBox(height: 12), const SizedBox(height: 12),
_labeledField( _labeledField(
'Phone number *', 'Phone number *',
_mobileCtrl, _mobileCtrl,
_phoneVal, _phoneVal,
width: fieldWidth, width: fieldWidth,
keyboardType: TextInputType.phone, keyboardType: TextInputType.phone,
inputFormatters: _phoneInputFormatters, inputFormatters: _phoneInputFormatters,
), ),
const SizedBox(height: 12),
_labeledField(
'Partner Id *',
_codeCtrl,
_reqCode,
width: fieldWidth,
inputFormatters: [
FilteringTextInputFormatter.allow(RegExp(r'[a-zA-Z0-9]')),
], ],
) ),
: Row( const SizedBox(height: 12),
crossAxisAlignment: CrossAxisAlignment.start, _salesDropdown(context, fieldWidth),
children: [ const SizedBox(height: 12),
Expanded( _labeledField(
child: _labeledField('Full name *', _nameCtrl, _reqName, 'Address *',
width: fieldWidth, keyboardType: TextInputType.name), _addressCtrl,
), _reqAddress,
const SizedBox(width: 16), width: fieldWidth,
Expanded( keyboardType: TextInputType.streetAddress,
child: _labeledField( ),
'Email *', const SizedBox(height: 12),
_emailCtrl, _certificateColumn(context),
_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 Widget pair(Widget a, Widget b) {
? Column( return Row(
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
_labeledField( Expanded(child: a),
'Partner Id *', SizedBox(width: rowGap),
_codeCtrl, Expanded(child: b),
_reqCode, ],
width: fieldWidth, );
inputFormatters: [ }
FilteringTextInputFormatter.allow(RegExp(r'[a-zA-Z0-9]')),
],
),
const SizedBox(height: 12),
_salesDropdown(context, fieldWidth),
const SizedBox(height: 12),
_labeledField(
'Address *',
_addressCtrl,
_reqAddress,
width: fieldWidth,
keyboardType: TextInputType.streetAddress,
),
const SizedBox(height: 12),
_certificateColumn(context),
],
)
: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: _labeledField(
'Partner Id *',
_codeCtrl,
_reqCode,
width: fieldWidth,
inputFormatters: [
FilteringTextInputFormatter.allow(RegExp(r'[a-zA-Z0-9]')),
],
),
),
const SizedBox(width: 12),
Expanded(child: _salesDropdown(context, fieldWidth)),
const SizedBox(width: 12),
Expanded(
child: _labeledField(
'Address *',
_addressCtrl,
_reqAddress,
width: fieldWidth,
keyboardType: TextInputType.streetAddress,
),
),
const SizedBox(width: 12),
Expanded(child: _certificateColumn(context)),
],
);
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
children: [ children: [
row1, pair(
const SizedBox(height: 16), _labeledField('Full name *', _nameCtrl, _reqName,
row2, 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 *',
_codeCtrl,
_reqCode,
width: fieldWidth,
inputFormatters: [
FilteringTextInputFormatter.allow(RegExp(r'[a-zA-Z0-9]')),
],
),
),
const SizedBox(height: verticalGap),
pair(
_salesDropdown(context, fieldWidth),
_labeledField(
'Address *',
_addressCtrl,
_reqAddress,
width: fieldWidth,
keyboardType: TextInputType.streetAddress,
),
),
const SizedBox(height: verticalGap),
pair(
_certificateColumn(context),
const SizedBox.shrink(),
),
], ],
); );
} }