34 lines
1.5 KiB
Python
34 lines
1.5 KiB
Python
import re
|
|
|
|
with open('kifi-app/lib/features/projects/presentation/widgets/add_project_sheet.dart', 'r') as f:
|
|
content = f.read()
|
|
|
|
# Replace SmartSearchDropdown with DropdownButtonFormField
|
|
dropdown = """ DropdownButtonFormField<int>(
|
|
value: _selectedCustomerId,
|
|
decoration: InputDecoration(
|
|
labelText: 'Client (Optional)',
|
|
prefixIcon: const Icon(LucideIcons.users),
|
|
border: OutlineInputBorder(borderRadius: BorderRadius.circular(12)),
|
|
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
|
),
|
|
items: [
|
|
const DropdownMenuItem<int>(value: null, child: Text('None')),
|
|
...customersState.value!.map((c) => DropdownMenuItem<int>(
|
|
value: c.id,
|
|
child: Text(c.name),
|
|
)),
|
|
],
|
|
onChanged: (val) {
|
|
setState(() {
|
|
_selectedCustomerId = val;
|
|
});
|
|
},
|
|
),"""
|
|
|
|
content = re.sub(r' SmartSearchDropdown<Customer>\([\s\S]*?\),', dropdown, content)
|
|
content = content.replace("import '../../../core/widgets/smart_search_dropdown.dart';", "")
|
|
|
|
with open('kifi-app/lib/features/projects/presentation/widgets/add_project_sheet.dart', 'w') as f:
|
|
f.write(content)
|