Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS: Gutter shifted up from the text #261

Open
alexeyinkin opened this issue Nov 8, 2023 · 6 comments
Open

iOS: Gutter shifted up from the text #261

alexeyinkin opened this issue Nov 8, 2023 · 6 comments

Comments

@alexeyinkin
Copy link
Contributor

alexeyinkin commented Nov 8, 2023

Note: This issue is about just shifting. Line heights match and do not de-sync further down the gutter. For an issue with Material 3 with progressively shifting numbers, see #262

Run the example 02.code_field unmodified, as of 0f18b2b.

Web -- Gutter is aligned with the code lines:
image

iOS -- Gutter is shifted upwards for ~20% of the line height:
image

This is likely due to an issue in Flutter since there is nothing platform-specific in the editor, and it is built of standard widgets.

flutter doctor -v
[✓] Flutter (Channel stable, 3.13.9, on macOS 13.6 22G120 darwin-arm64, locale
    en-GE)
    • Flutter version 3.13.9 on channel stable at /Users/ai/bin/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision d211f42860 (13 days ago), 2023-10-25 13:42:25 -0700
    • Engine revision 0545f8705d
    • Dart version 3.1.5
    • DevTools version 2.25.0

[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/ai/Library/Android/sdk
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for
      more details.

[✓] Xcode - develop for iOS and macOS (Xcode 15.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15A240d
    • CocoaPods version 1.13.0

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build
      17.0.6+0-17.0.6b829.9-10027231)

[✓] Connected device (3 available)
    • iPhone 15 Pro Max (mobile) • 8DCD89EC-E8C0-424E-A0D7-04E293ABF945 • ios
      • com.apple.CoreSimulator.SimRuntime.iOS-17-0 (simulator)
    • macOS (desktop)            • macos                                •
      darwin-arm64   • macOS 13.6 22G120 darwin-arm64
    • Chrome (web)               • chrome                               •
      web-javascript • Google Chrome 119.0.6045.123

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.
@ghost
Copy link

ghost commented Nov 28, 2023

Good afternoon @alexeyinkin,

If you set up the same font, size and line height for the code and the gutter, the problem disappears.

Cheers,
Antonio Jesus

@vd3d
Copy link

vd3d commented Jan 3, 2024

Hi,

I have try to set the same fontsize in the theme (custom one) and the gutter, but it does not solve the problem.
I still got an alignment issue.

Any idea ?

@ghost
Copy link

ghost commented Jan 4, 2024

Hi,

I have try to set the same fontsize in the theme (custom one) and the gutter, but it does not solve the problem. I still got an alignment issue.

Any idea ?

Have you tried modifying the line height?

The two properties I had to modify were "fontSize" and "height" besides, of course, making sure the font family was the same for both.

Hope it helps,

Cheers,
Antonio Jesus

@vd3d
Copy link

vd3d commented Jan 4, 2024

Playing with 'height' helps a little bit... I have less offset, but it does not solve.
I still have some offsets..

Please, look at the picture, I have add some "red line" to show you:
image

@ghost
Copy link

ghost commented Jan 4, 2024 via email

@SilverMira
Copy link

Setting the height on both textStyle and gutterStyle did seem to fix the desync for me, unsure whether it will work on other fonts or not.

CodeField(
  controller: controller,
  textStyle: GoogleFonts.jetBrainsMono(
    fontSize: 14,
    height: 1.4,
  ),
  gutterStyle: GutterStyle(
    textStyle: GoogleFonts.jetBrainsMono(
      fontSize: 14,
      height: 1.4,
    ),
  ),
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants