Hide country dropdown on subsequent runs once a country is set in local storage
This commit is contained in:
@@ -297,58 +297,60 @@ class _AdminLoginPageState extends State<AdminLoginPage>
|
||||
return null;
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
if (Get.find<OtpHelper>().isFirstRun) ...[
|
||||
const SizedBox(height: 20),
|
||||
|
||||
// ── Country Dropdown ───────────────────────────
|
||||
const Row(
|
||||
children: [
|
||||
Icon(Icons.public_rounded,
|
||||
color: _C.accent, size: 16),
|
||||
SizedBox(width: 8),
|
||||
Text(
|
||||
'الدولة',
|
||||
style: TextStyle(
|
||||
color: _C.textSec,
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w600,
|
||||
letterSpacing: 0.3,
|
||||
// ── Country Dropdown ───────────────────────────
|
||||
const Row(
|
||||
children: [
|
||||
Icon(Icons.public_rounded,
|
||||
color: _C.accent, size: 16),
|
||||
SizedBox(width: 8),
|
||||
Text(
|
||||
'الدولة',
|
||||
style: TextStyle(
|
||||
color: _C.textSec,
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w600,
|
||||
letterSpacing: 0.3,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Obx(() {
|
||||
final otpHelper = Get.find<OtpHelper>();
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: _C.inputBg,
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
border: Border.all(color: _C.border, width: 1),
|
||||
),
|
||||
child: DropdownButtonHideUnderline(
|
||||
child: DropdownButton<String>(
|
||||
value: otpHelper.selectedCountry.value,
|
||||
icon: const Icon(Icons.arrow_drop_down, color: _C.accent),
|
||||
isExpanded: true,
|
||||
dropdownColor: _C.card,
|
||||
style: const TextStyle(color: _C.textPrimary, fontSize: 16),
|
||||
items: ['Jordan', 'Egypt', 'Syria'].map((String country) {
|
||||
return DropdownMenuItem<String>(
|
||||
value: country,
|
||||
child: Text(country.tr),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: (String? val) {
|
||||
if (val != null) {
|
||||
otpHelper.changeCountry(val);
|
||||
}
|
||||
},
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Obx(() {
|
||||
final otpHelper = Get.find<OtpHelper>();
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: _C.inputBg,
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
border: Border.all(color: _C.border, width: 1),
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
const SizedBox(height: 28),
|
||||
child: DropdownButtonHideUnderline(
|
||||
child: DropdownButton<String>(
|
||||
value: otpHelper.selectedCountry.value,
|
||||
icon: const Icon(Icons.arrow_drop_down, color: _C.accent),
|
||||
isExpanded: true,
|
||||
dropdownColor: _C.card,
|
||||
style: const TextStyle(color: _C.textPrimary, fontSize: 16),
|
||||
items: ['Jordan', 'Egypt', 'Syria'].map((String country) {
|
||||
return DropdownMenuItem<String>(
|
||||
value: country,
|
||||
child: Text(country.tr),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: (String? val) {
|
||||
if (val != null) {
|
||||
otpHelper.changeCountry(val);
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
const SizedBox(height: 28),
|
||||
],
|
||||
|
||||
// ── Submit button ────────────────────────────
|
||||
_isLoading
|
||||
|
||||
Reference in New Issue
Block a user