43 lines
1.6 KiB
Python
43 lines
1.6 KiB
Python
import re
|
|
|
|
with open('kifi-app/lib/features/projects/presentation/projects_screen.dart', 'r') as f:
|
|
content = f.read()
|
|
|
|
# Add AppBar
|
|
if "appBar: AppBar" not in content:
|
|
content = content.replace(" return Scaffold(\n body: projectsAsync.when(", """ return Scaffold(
|
|
appBar: AppBar(
|
|
title: const Text('Projects'),
|
|
backgroundColor: Colors.transparent,
|
|
elevation: 0,
|
|
),
|
|
body: projectsAsync.when(""")
|
|
|
|
# Add Edit button to ListTile
|
|
old_list_tile = r""" trailing: const Icon\(Icons\.chevron_right\),
|
|
onTap: \(\) \{
|
|
Navigator\.push\("""
|
|
new_list_tile = """ trailing: Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
IconButton(
|
|
icon: const Icon(LucideIcons.edit),
|
|
onPressed: () {
|
|
showModalBottomSheet(
|
|
context: context,
|
|
isScrollControlled: true,
|
|
backgroundColor: Colors.transparent,
|
|
builder: (context) => AddProjectSheet(project: p),
|
|
);
|
|
},
|
|
),
|
|
const Icon(Icons.chevron_right),
|
|
],
|
|
),
|
|
onTap: () {
|
|
Navigator.push("""
|
|
content = re.sub(old_list_tile, new_list_tile, content)
|
|
|
|
with open('kifi-app/lib/features/projects/presentation/projects_screen.dart', 'w') as f:
|
|
f.write(content)
|