Files
Kifi/scratch/patch_board.py

39 lines
1.4 KiB
Python

import re
with open('kifi-app/lib/features/projects/presentation/project_board_screen.dart', 'r') as f:
content = f.read()
# Add button for "To Do" column
content = content.replace(
'_buildColumn(\'To Do\', todo),',
'_buildColumn(\'To Do\', todo, showAdd: true),'
)
content = content.replace(
'Widget _buildColumn(String title, List tasks) {',
'Widget _buildColumn(String title, List tasks, {bool showAdd = false}) {'
)
add_button_code = """
if (showAdd)
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: TextButton.icon(
icon: const Icon(Icons.add),
label: const Text('Add Task'),
onPressed: () {
showModalBottomSheet(
context: context,
isScrollControlled: true,
backgroundColor: Colors.transparent,
builder: (_) => AddTaskSheet(projectId: widget.project.id),
);
},
),
),
const SizedBox(height: 16),
"""
content = content.replace(' const SizedBox(height: 16),\n ],\n ),\n );\n }', add_button_code + ' ],\n ),\n );\n }')
with open('kifi-app/lib/features/projects/presentation/project_board_screen.dart', 'w') as f:
f.write(content)