Files
feature-next-arch/_fix_overflow.py
2026-08-10 10:00:52 +08:00

44 lines
1.9 KiB
Python

filepath = r'C:\Users\jsmbz\Documents\flutter-app-02\lib\features\home\presentation\widgets\map\testmap_pages.dart'
with open(filepath, 'r', encoding='utf-8') as f:
content = f.read()
old = ''' const SizedBox(height: 4),
Row(
children: [
Text(
'设备: ${currentTask.deviceId}',
style: const TextStyle(
fontSize: 12,
color: Color(0xFF4E5969),
),
),
const SizedBox(width: 12),
Container('''
new = ''' const SizedBox(height: 4),
Text(
'设备: ${currentTask.deviceId}',
style: const TextStyle(
fontSize: 12,
color: Color(0xFF4E5969),
),
softWrap: true,
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
const SizedBox(height: 4),
Container('''
if old in content:
content = content.replace(old, new)
with open(filepath, 'w', encoding='utf-8') as f:
f.write(content)
print('SUCCESS - replaced device ID text with wrapping support')
else:
print('NOT FOUND')
# Debug: find the line
for i, line in enumerate(content.split('\n'), 1):
if "设备: ${currentTask.deviceId}" in line:
print(f'Line {i}: {repr(line)}')