Skip to content

Commit f8549e7

Browse files
razankv13claude
andcommitted
fix(gutter): hide scrollbar from line numbers area
Wrap the gutter's SingleChildScrollView with ScrollConfiguration to hide the scrollbar while maintaining synchronized scrolling functionality between line numbers and code editor. Also update dependencies to match lockfile versions. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent f4a6509 commit f8549e7

File tree

2 files changed

+22
-21
lines changed

2 files changed

+22
-21
lines changed

lib/src/gutter/gutter.dart

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
import 'package:flutter/material.dart';
32

43
import 'package:flutter_code_editor/src/code_field/browser_detection.dart';
@@ -14,9 +13,6 @@ const _lineNumberColumn = 0;
1413
const _issueColumn = 1;
1514
const _foldingColumn = 2;
1615

17-
18-
19-
2016
class GutterWidget extends StatelessWidget {
2117
const GutterWidget({
2218
super.key,
@@ -47,7 +43,8 @@ class GutterWidget extends StatelessWidget {
4743
(style.showFoldingHandles ? 0 : _foldingColumnWidth);
4844

4945
final issueColumnWidth = style.showErrors ? _issueColumnWidth : 0.0;
50-
final foldingColumnWidth = style.showFoldingHandles ? _foldingColumnWidth : 0.0;
46+
final foldingColumnWidth =
47+
style.showFoldingHandles ? _foldingColumnWidth : 0.0;
5148

5249
final tableRows = List.generate(
5350
code.hiddenLineRanges.visibleLineNumbers.length,
@@ -79,18 +76,20 @@ class GutterWidget extends StatelessWidget {
7976
right: 10,
8077
),
8178
width: style.showLineNumbers ? gutterWidth : null,
82-
83-
child: SingleChildScrollView(
84-
controller: scrollController,
85-
child: Table(
86-
columnWidths: {
87-
_lineNumberColumn: const FlexColumnWidth(),
88-
_issueColumn: FixedColumnWidth(issueColumnWidth),
89-
_foldingColumn: FixedColumnWidth(foldingColumnWidth),
90-
},
91-
defaultVerticalAlignment: TableCellVerticalAlignment.baseline,
92-
textBaseline: TextBaseline.alphabetic,
93-
children: tableRows,
79+
child: ScrollConfiguration(
80+
behavior: ScrollConfiguration.of(context).copyWith(scrollbars: false),
81+
child: SingleChildScrollView(
82+
controller: scrollController,
83+
child: Table(
84+
columnWidths: {
85+
_lineNumberColumn: const FlexColumnWidth(),
86+
_issueColumn: FixedColumnWidth(issueColumnWidth),
87+
_foldingColumn: FixedColumnWidth(foldingColumnWidth),
88+
},
89+
defaultVerticalAlignment: TableCellVerticalAlignment.baseline,
90+
textBaseline: TextBaseline.alphabetic,
91+
children: tableRows,
92+
),
9493
),
9594
),
9695
);
@@ -118,7 +117,8 @@ class GutterWidget extends StatelessWidget {
118117
const newLine = '\n';
119118
double textWrappedTimes = 1;
120119
if (size != null && code.text.isNotEmpty) {
121-
final textWidth = getTextWidth(code.lines[lineIndex].text, style.textStyle!);
120+
final textWidth =
121+
getTextWidth(code.lines[lineIndex].text, style.textStyle!);
122122
textWrappedTimes = textWidth.width / (size!.width - 36);
123123
}
124124

@@ -145,7 +145,8 @@ class GutterWidget extends StatelessWidget {
145145

146146
tableRows[lineIndex].children[_issueColumn] = GutterErrorWidget(
147147
issue,
148-
style.errorPopupTextStyle ?? (throw Exception('Error popup style should never be null')),
148+
style.errorPopupTextStyle ??
149+
(throw Exception('Error popup style should never be null')),
149150
);
150151
}
151152
}

pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ dependencies:
1111
autotrie: ^2.0.0
1212
characters: ^1.3.0
1313
charcode: ^1.3.1
14-
collection: ^1.17.2
15-
equatable: ^2.0.5
14+
collection: ^1.19.1
15+
equatable: ^2.0.7
1616
flutter: { sdk: flutter }
1717
flutter_highlight: ^0.7.0
1818
highlight: ^0.7.0

0 commit comments

Comments
 (0)