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