forked from eatvio/eatvio_app
feat: update add product modal to reflect selection state with icons
This commit is contained in:
@@ -132,7 +132,12 @@ class _AddProductModalState extends State<AddProductModal> {
|
||||
subtitle: glossariesList[i].grInPortion == 0
|
||||
? null
|
||||
: Text('${glossariesList[i].grInPortion} г', style: TextStyle(height: 1, color: Colors.grey.shade600)),
|
||||
trailing: Icon(Icons.add_rounded, color: Colors.grey.shade400),
|
||||
trailing: Icon(
|
||||
productNameController.text.trim().toLowerCase() == glossariesList[i].name.toLowerCase()
|
||||
? Icons.radio_button_checked
|
||||
: Icons.radio_button_off,
|
||||
color: Colors.blueAccent,
|
||||
),
|
||||
contentPadding: const EdgeInsets.only(left: 12),
|
||||
);
|
||||
},
|
||||
@@ -166,7 +171,9 @@ class _AddProductModalState extends State<AddProductModal> {
|
||||
InkWell(
|
||||
onTap: () {
|
||||
// Автоматически выбираем первый элемент, если текст точно совпадает
|
||||
if (selectedGlossary == null && glossariesList.isNotEmpty && productNameController.text.trim().toLowerCase() == glossariesList[0].name.toLowerCase()) {
|
||||
if (selectedGlossary == null &&
|
||||
glossariesList.isNotEmpty &&
|
||||
productNameController.text.trim().toLowerCase() == glossariesList[0].name.toLowerCase()) {
|
||||
selectedGlossary = glossariesList[0];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user