fix(ui): 修复家庭药箱分类标签字号间距与文字截断溢出问题,改用平滑自适应Pill标签
This commit is contained in:
@@ -333,25 +333,39 @@ class _MedicineCabinetScreenState extends State<MedicineCabinetScreen> {
|
|||||||
),
|
),
|
||||||
onChanged: (val) => setState(() => _searchQuery = val.trim()),
|
onChanged: (val) => setState(() => _searchQuery = val.trim()),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 10),
|
||||||
SingleChildScrollView(
|
SingleChildScrollView(
|
||||||
scrollDirection: Axis.horizontal,
|
scrollDirection: Axis.horizontal,
|
||||||
|
physics: const BouncingScrollPhysics(),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: _filters.map((f) {
|
children: _filters.map((f) {
|
||||||
final selected = _selectedFilter == f;
|
final selected = _selectedFilter == f;
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.only(right: 8),
|
padding: const EdgeInsets.only(right: 8),
|
||||||
child: ChoiceChip(
|
child: InkWell(
|
||||||
label: Text(f),
|
onTap: () => setState(() => _selectedFilter = f),
|
||||||
selected: selected,
|
borderRadius: BorderRadius.circular(20),
|
||||||
selectedColor: const Color(0xFF2563EB),
|
child: AnimatedContainer(
|
||||||
labelStyle: TextStyle(
|
duration: const Duration(milliseconds: 150),
|
||||||
color: selected ? Colors.white : Colors.black87,
|
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 8),
|
||||||
fontSize: 12,
|
decoration: BoxDecoration(
|
||||||
|
color: selected ? const Color(0xFF2563EB) : const Color(0xFFF1F5F9),
|
||||||
|
borderRadius: BorderRadius.circular(20),
|
||||||
|
border: Border.all(
|
||||||
|
color: selected ? const Color(0xFF2563EB) : const Color(0xFFE2E8F0),
|
||||||
|
width: 1,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
f,
|
||||||
|
style: TextStyle(
|
||||||
|
color: selected ? Colors.white : const Color(0xFF334155),
|
||||||
|
fontSize: 13,
|
||||||
|
fontWeight: selected ? FontWeight.bold : FontWeight.w500,
|
||||||
|
height: 1.2,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
onSelected: (val) {
|
|
||||||
if (val) setState(() => _selectedFilter = f);
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}).toList(),
|
}).toList(),
|
||||||
@@ -718,19 +732,24 @@ class _MedicineCabinetScreenState extends State<MedicineCabinetScreen> {
|
|||||||
required Color color,
|
required Color color,
|
||||||
}) {
|
}) {
|
||||||
return Container(
|
return Container(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 2),
|
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: color.withValues(alpha: 0.08),
|
color: color.withValues(alpha: 0.08),
|
||||||
borderRadius: BorderRadius.circular(4),
|
borderRadius: BorderRadius.circular(6),
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
Icon(icon, size: 12, color: color),
|
Icon(icon, size: 13, color: color),
|
||||||
const SizedBox(width: 3),
|
const SizedBox(width: 4),
|
||||||
Text(
|
Text(
|
||||||
text,
|
text,
|
||||||
style: TextStyle(color: color, fontSize: 11, fontWeight: FontWeight.w500),
|
style: TextStyle(
|
||||||
|
color: color,
|
||||||
|
fontSize: 11,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
height: 1.2,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -263,6 +263,8 @@ class _MedicineEditDialogState extends State<MedicineEditDialog> {
|
|||||||
children: MedicineCategory.values.map((cat) {
|
children: MedicineCategory.values.map((cat) {
|
||||||
final selected = _category == cat;
|
final selected = _category == cat;
|
||||||
return ChoiceChip(
|
return ChoiceChip(
|
||||||
|
showCheckmark: false,
|
||||||
|
labelPadding: const EdgeInsets.symmetric(horizontal: 4, vertical: 2),
|
||||||
label: Row(
|
label: Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
@@ -324,6 +326,8 @@ class _MedicineEditDialogState extends State<MedicineEditDialog> {
|
|||||||
children: _commonLocations.map((loc) {
|
children: _commonLocations.map((loc) {
|
||||||
final selected = _storageLocation == loc;
|
final selected = _storageLocation == loc;
|
||||||
return ChoiceChip(
|
return ChoiceChip(
|
||||||
|
showCheckmark: false,
|
||||||
|
labelPadding: const EdgeInsets.symmetric(horizontal: 4, vertical: 2),
|
||||||
label: Text(loc),
|
label: Text(loc),
|
||||||
selected: selected,
|
selected: selected,
|
||||||
selectedColor: const Color(0xFF059669),
|
selectedColor: const Color(0xFF059669),
|
||||||
@@ -350,6 +354,8 @@ class _MedicineEditDialogState extends State<MedicineEditDialog> {
|
|||||||
children: _commonUsers.map((user) {
|
children: _commonUsers.map((user) {
|
||||||
final selected = _targetUser == user;
|
final selected = _targetUser == user;
|
||||||
return ChoiceChip(
|
return ChoiceChip(
|
||||||
|
showCheckmark: false,
|
||||||
|
labelPadding: const EdgeInsets.symmetric(horizontal: 4, vertical: 2),
|
||||||
label: Text(user),
|
label: Text(user),
|
||||||
selected: selected,
|
selected: selected,
|
||||||
selectedColor: const Color(0xFFD97706),
|
selectedColor: const Color(0xFFD97706),
|
||||||
|
|||||||
Reference in New Issue
Block a user