Files
Kifi/scratch/patch_board_screen.py

41 lines
1.3 KiB
Python

import re
with open('kifi-app/lib/features/projects/presentation/project_board_screen.dart', 'r') as f:
content = f.read()
# Add edit button to AppBar
old_app_bar = r""" appBar: AppBar\(
title: Text\(widget\.project\.name\),
backgroundColor: Colors\.white,
foregroundColor: Colors\.black,
elevation: 0,
\),"""
new_app_bar = """ appBar: AppBar(
title: Text(widget.project.name),
backgroundColor: Colors.white,
foregroundColor: Colors.black,
elevation: 0,
actions: [
IconButton(
icon: const Icon(Icons.info_outline),
tooltip: 'Project Details',
onPressed: () {
showModalBottomSheet(
context: context,
isScrollControlled: true,
backgroundColor: Colors.transparent,
builder: (context) => AddProjectSheet(project: widget.project),
);
},
),
],
),"""
content = re.sub(old_app_bar, new_app_bar, content)
if "AddProjectSheet" not in content:
content = content.replace("import 'widgets/add_task_sheet.dart';", "import 'widgets/add_task_sheet.dart';\nimport 'widgets/add_project_sheet.dart';")
with open('kifi-app/lib/features/projects/presentation/project_board_screen.dart', 'w') as f:
f.write(content)