fix(ui): 优化药物配置界面喷数和吸气时间选项布局,杜绝屏幕溢出
This commit is contained in:
@@ -118,12 +118,19 @@ class _PlanConfigScreenState extends State<PlanConfigScreen> {
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
const Row(
|
||||
children: [
|
||||
Icon(Icons.hourglass_top, color: Color(0xFFD97706), size: 20),
|
||||
SizedBox(width: 8),
|
||||
Text('两药之间的等待时间', style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14, color: Color(0xFF92400E))),
|
||||
],
|
||||
const Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.hourglass_top, color: Color(0xFFD97706), size: 20),
|
||||
SizedBox(width: 8),
|
||||
Flexible(
|
||||
child: Text(
|
||||
'两药之间的等待时间',
|
||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14, color: Color(0xFF92400E)),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 4),
|
||||
@@ -285,11 +292,11 @@ class _PlanConfigScreenState extends State<PlanConfigScreen> {
|
||||
if (canister.isEnabled) ...[
|
||||
const Divider(height: 1),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 14),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// 配置 1:每次几喷
|
||||
// 配置 1:每次用药喷数
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
@@ -297,78 +304,130 @@ class _PlanConfigScreenState extends State<PlanConfigScreen> {
|
||||
'每次用药喷数',
|
||||
style: TextStyle(fontWeight: FontWeight.w600, fontSize: 13, color: Color(0xFF334155)),
|
||||
),
|
||||
Row(
|
||||
children: [1, 2, 3, 4].map((puff) {
|
||||
final selected = canister.puffsPerSession == puff;
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(left: 6),
|
||||
child: ChoiceChip(
|
||||
label: Text('$puff 喷'),
|
||||
selected: selected,
|
||||
selectedColor: const Color(0xFF2563EB),
|
||||
labelStyle: TextStyle(
|
||||
color: selected ? Colors.white : const Color(0xFF475569),
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 12,
|
||||
),
|
||||
showCheckmark: false,
|
||||
onSelected: (_) {
|
||||
setState(() {
|
||||
canister.puffsPerSession = puff;
|
||||
});
|
||||
},
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFEFF6FF),
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
child: Text(
|
||||
'${canister.puffsPerSession} 喷',
|
||||
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 12, color: Color(0xFF2563EB)),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Row(
|
||||
children: [1, 2, 3, 4].map((puff) {
|
||||
final selected = canister.puffsPerSession == puff;
|
||||
return Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 3),
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
canister.puffsPerSession = puff;
|
||||
});
|
||||
},
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 9),
|
||||
decoration: BoxDecoration(
|
||||
color: selected ? const Color(0xFF2563EB) : const Color(0xFFF8FAFC),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
border: Border.all(
|
||||
color: selected ? const Color(0xFF2563EB) : const Color(0xFFE2E8F0),
|
||||
width: selected ? 1.5 : 1,
|
||||
),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
'$puff 喷',
|
||||
style: TextStyle(
|
||||
color: selected ? Colors.white : const Color(0xFF475569),
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 13,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
|
||||
const SizedBox(height: 14),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// 配置 2:每次雾化/吸气时长
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
Row(
|
||||
children: [
|
||||
const Text(
|
||||
'单喷雾化吸入时间',
|
||||
style: TextStyle(fontWeight: FontWeight.w600, fontSize: 13, color: Color(0xFF334155)),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
'面罩口鼻密闭吸气倒计时',
|
||||
'(面罩密闭吸气)',
|
||||
style: TextStyle(fontSize: 11, color: Colors.grey.shade500),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [10, 15, 30, 60].map((sec) {
|
||||
final selected = canister.inhalationSeconds == sec;
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(left: 6),
|
||||
child: ChoiceChip(
|
||||
label: Text('$sec秒'),
|
||||
selected: selected,
|
||||
selectedColor: const Color(0xFF0F172A),
|
||||
labelStyle: TextStyle(
|
||||
color: selected ? Colors.white : const Color(0xFF475569),
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 12,
|
||||
),
|
||||
showCheckmark: false,
|
||||
onSelected: (_) {
|
||||
setState(() {
|
||||
canister.inhalationSeconds = sec;
|
||||
});
|
||||
},
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFF1F5F9),
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
child: Text(
|
||||
'${canister.inhalationSeconds} 秒',
|
||||
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 12, color: Color(0xFF0F172A)),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Row(
|
||||
children: [10, 15, 30, 60].map((sec) {
|
||||
final selected = canister.inhalationSeconds == sec;
|
||||
return Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 3),
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
canister.inhalationSeconds = sec;
|
||||
});
|
||||
},
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 9),
|
||||
decoration: BoxDecoration(
|
||||
color: selected ? const Color(0xFF0F172A) : const Color(0xFFF8FAFC),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
border: Border.all(
|
||||
color: selected ? const Color(0xFF0F172A) : const Color(0xFFE2E8F0),
|
||||
width: selected ? 1.5 : 1,
|
||||
),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
'$sec 秒',
|
||||
style: TextStyle(
|
||||
color: selected ? Colors.white : const Color(0xFF475569),
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 13,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user