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

Wrong ImageSpan position #22

Open
2dxgujun opened this issue Jul 10, 2019 · 2 comments · May be fixed by #24
Open

Wrong ImageSpan position #22

2dxgujun opened this issue Jul 10, 2019 · 2 comments · May be fixed by #24

Comments

@2dxgujun
Copy link

2dxgujun commented Jul 10, 2019

image

import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:real_rich_text/real_rich_text.dart';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: RealRichText([
            TextSpan(
              text: "【7.9隔夜大消息】 1、 降息预期降低,美股三大股指周一集体收跌,道指跌0.43%;纳指跌0.78%;标普500指数跌0.48%。中概股普跌,诺亚财富跌20.41%; 2、 诺亚财富大跌逾20% ,旗下歌斐资产34亿元踩雷承兴国际控股; 3、 格力电器:认购新疆众和非公开发行股票, 将成第三大股东; 4、 上交所:上半年沪市公司披露各类并购重组交易470余单, 涉及金额达到3500亿元; 5、 北向资金昨日净卖出36.06亿 ,中国平安净卖出7.08亿; 6、 唐人神:6月生猪销售收入同比翻倍; 7、 31家券商合计净利润为472.3亿元,剔除前述4家券商后同比增幅为44%; 8、 铁矿石急涨不具可持续性, 监管层将加大调查和监管力度; 9、 年内公募基金分红508亿元 ,债基“挑大梁”分红占比高达75.7%; 10、国有五大行2018年度现金分红金额再创新高,合计高达3031.25亿元(含税),较2017年度增加136亿元。 每天早上7:10左右,新增一个【隔夜大消息】,大家在上班路上可以大概知道前一天发生的财经大事。 不同于【早评】的是,隔夜的一些主要消息,需要大家自己去消化,而我会选择其中更为重要的4-5条,放在【早评】里面特别解释。 新的一天开始了,大家早安吖😘😘😘",
            ),
            ImageSpan(
              AssetImage("packages/real_rich_text/images/emoji_9.png"),
              imageWidth: 24,
              imageHeight: 24,
            )
          ], overflow: TextOverflow.ellipsis,
            maxLines: 3,),
        ),
      ),
    );
  }
}
@2dxgujun
Copy link
Author

getOffsetForCaret returned a weird offset in above code

@2dxgujun 2dxgujun changed the title BUG Wrong ImageSpan position Jul 10, 2019
@2dxgujun
Copy link
Author

发现如果这个TextSpan的text最后的字符是emoji就会有这个问题

@2dxgujun 2dxgujun linked a pull request Jul 12, 2019 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant