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