chore: initial commit Dutra Store POS app
This commit is contained in:
35
fix_indent.py
Normal file
35
fix_indent.py
Normal file
@@ -0,0 +1,35 @@
|
||||
with open('D:\\app\\ai\\app-grosir\\lib\\screens\\produk_screen.dart', 'r') as f:
|
||||
lines = f.readlines()
|
||||
|
||||
# Find the start and end of _showAddForm
|
||||
start = None
|
||||
end = None
|
||||
for i, line in enumerate(lines):
|
||||
if line.strip().startswith('void _showAddForm'):
|
||||
start = i
|
||||
if start is not None and line.strip() == '}' and i > start + 5:
|
||||
# Check if this is the end of _showAddForm
|
||||
# It should be followed by empty line or another top-level declaration
|
||||
if i + 1 < len(lines):
|
||||
next_line = lines[i + 1].strip()
|
||||
if next_line == '' or next_line.startswith('void ') or next_line.startswith('class '):
|
||||
end = i
|
||||
break
|
||||
|
||||
print(f'_showAddForm: lines {start+1} to {end+1}')
|
||||
|
||||
# Remove 2-space indent from _showAddForm function
|
||||
for i in range(start, end + 1):
|
||||
if lines[i].startswith(' '):
|
||||
lines[i] = lines[i][2:]
|
||||
|
||||
# After _showAddForm, there might be an extra class closing }
|
||||
# The class _ProdukScreenState should close right after build method
|
||||
# Let's find the class closing after _showAddForm and remove it if it's extra
|
||||
# After _showAddForm ends, the next line should be empty or a function/class
|
||||
# If there's a } followed by empty line and then another }, remove the first }
|
||||
|
||||
with open('D:\\app\\ai\\app-grosir\\lib\\screens\\produk_screen.dart', 'w') as f:
|
||||
f.writelines(lines)
|
||||
|
||||
print('Done')
|
||||
Reference in New Issue
Block a user