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

First line is duplicated if there are multiple lines with image. #6

Open
azhar294 opened this issue Feb 4, 2020 · 10 comments
Open

Comments

@azhar294
Copy link

azhar294 commented Feb 4, 2020

First line is duplicated ( means repeating ) if there are multiple lines of text with image.
I checked this in version 1.0.1 it's working fine. From 1.0.2 this issue is happening.

@mtiziano
Copy link
Owner

mtiziano commented Feb 4, 2020

thanks @azhar294 can you please paste code example?

@mtiziano
Copy link
Owner

@azhar294 ?

@azhar294
Copy link
Author

child: new DropCapText(
  'Long Text',
  dropCap: DropCap(
    width: 20,
    height: 10,
    child: Image.asset(
      'assets/verified_drop_cap.png'),
  dropCapPadding: new EdgeInsets.only(top: 5.0),
  style: new TextStyle(
    fontWeight: FontWeight.bold,
    fontSize: 14.0,height: 1.2),
    maxLines: 3,
  overflow: TextOverflow.ellipsis,
),

@exptk3
Copy link

exptk3 commented Feb 25, 2020

I have the same problem. If some of the text next to the picture is cut off at the end of the picture, the line that was cut is duplicated on the first line immediately after the picture. You can test this by changing your device or by changing the height of TextStyle on the same device.

  • The image is used for the drop cap and below is my code.
    DropCapText(pickedContent,
    dropCapPadding: EdgeInsets.only(right: 5, bottom: 0,),
    style: TextStyle(
    height: 1.15,
    fontSize: mediaQuery.size.width * 0.04 > 25
    ? 25
    : mediaQuery.size.width * 0.04,
    ),
    dropCap: DropCap(
    width: xxx,
    height: xxx,
    child: GestureDetector(
    onTap: () {
    xxx
    },
    child: ImageContent(pickedImage)),
    ))

*** This bug was tested on a real device. (Test device: Galaxy Note 4, Galaxy S8)


*** Changed : The problem does not occur now. I will report again if that happens again.

@mtiziano
Copy link
Owner

Tested @azhar294 and @exptk3 code with 1.0.7 and everything works fine.
Please be more accurate, attach screen + lib version

@exptk3
Copy link

exptk3 commented Mar 8, 2020

Tested @azhar294 and @exptk3 code with 1.0.7 and everything works fine.
Please be more accurate, attach screen + lib version

At the time of writing the issue report, there was a problem that the text at the end of the picture was duplicated.
But, At present, the problem does not occur.
In the meantime, I've upgraded Android Studio, flutter sdk, and so on, but it's not clear exactly why that bug was resolved.
Anyway if I find the same problem again, I will report more detailed information.
Thank you.

@exptk3
Copy link

exptk3 commented Mar 17, 2020

The problem mentioned above occurred again and this time I figured out how to reproduce it.

  • bug description
    : When the text was displayed with the picture --> the text at the end of the picture was cut off or duplicated.
  • Reproducing method
     - This problem was independent of device type and was reproduced in a virtual emulator (of android studio).
  • This bug seems to be related to the type of language or font height.
     - If you test while changing the language type, font type, font style height, etc., you may see duplicates (Korean image1 : '트 합니다.' , image2 : '그림이 있는') or some characters cut off (Arabic) as shown in the attached image.

DropCapText(pickedContent,
dropCapPadding: EdgeInsets.only(right: 5, bottom: 0,),
style: TextStyle(
height: 1.15, --> change from 1.0 to 1.5 --> maybe bug appear

 - If you test it in Korean, Arabic, etc. rather than in a low-height language like English, you will be able to reproduce it immediately.
 - Please refer to the attached picture.

200317_dropcaptext_bug

200317_02_dropcaptext_bug2

@teshlya
Copy link

teshlya commented Mar 29, 2020

I have same problem:

DropCapText(
'long text',
dropCapPosition: DropCapPosition.end,
textAlign: TextAlign.justify,
style: TextStyle(fontSize: 24),
dropCap: DropCap(
width: 478 * 0.4,
height: 640 * 0.4,
child: Padding(
padding: EdgeInsets.only(left: 20, bottom: 20),
child: Image.asset(
"assets/cabinet1.jpg",
))),
);
DropCapText

@teshlya
Copy link

teshlya commented Mar 29, 2020

I have same problem:

DropCapText(
'long text',
dropCapPosition: DropCapPosition.end,
textAlign: TextAlign.justify,
style: TextStyle(fontSize: 24),
dropCap: DropCap(
width: 478 * 0.4,
height: 640 * 0.4,
child: Padding(
padding: EdgeInsets.only(left: 20, bottom: 20),
child: Image.asset(
"assets/cabinet1.jpg",
))),
);
DropCapText

I'm use Flutter Web. This not work in PC Chrome but on emulator is fine.
TextPainter.getPositionForOffset() method return not correct value. DropCapText package everythink fine.

@mtiziano
Copy link
Owner

mtiziano commented Mar 29, 2021

i've tested your code but have no problems. Additional info?

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

4 participants