Fix markdown editor gutter scroll sync without sharing ScrollController.
The line-number gutter now follows the TextField scroll offset via Transform.translate so Flutter no longer attaches one controller to two scroll views. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
3c8eda6fd9
commit
986aba99e5
1 changed files with 23 additions and 13 deletions
|
|
@ -427,19 +427,29 @@ class _LineNumberGutter extends StatelessWidget {
|
||||||
color: const Color(0xFFEEF2F7),
|
color: const Color(0xFFEEF2F7),
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: 44,
|
width: 44,
|
||||||
child: ListView.builder(
|
child: ClipRect(
|
||||||
controller: scrollController,
|
child: AnimatedBuilder(
|
||||||
padding: const EdgeInsets.only(top: 16),
|
animation: scrollController,
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
builder: (context, child) {
|
||||||
itemCount: lineCount,
|
final offset =
|
||||||
itemBuilder: (context, index) {
|
scrollController.hasClients ? scrollController.offset : 0.0;
|
||||||
final line = index + 1;
|
return Transform.translate(
|
||||||
return _LineNumberCell(
|
offset: Offset(0, 16 - offset),
|
||||||
line: line,
|
child: child,
|
||||||
severity: issueLines[line],
|
);
|
||||||
onTap: onLineTap,
|
},
|
||||||
);
|
child: Column(
|
||||||
},
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
|
children: [
|
||||||
|
for (var index = 0; index < lineCount; index++)
|
||||||
|
_LineNumberCell(
|
||||||
|
line: index + 1,
|
||||||
|
severity: issueLines[index + 1],
|
||||||
|
onTap: onLineTap,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue