fluttercandies / extended_text

A powerful extended official text for Flutter, which supports Speical Text(Image,@somebody), Custom Background, Custom overFlow, Text Selection.
MIT License
664 stars 134 forks source link

ExtendedText affect other widget's layout and draw. #104

Closed cr1992 closed 3 years ago

cr1992 commented 3 years ago

Here is my code:

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        scaffoldBackgroundColor: Colors.white,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: DemoPage(),
    );
  }
}

class DemoPage extends StatefulWidget {
  const DemoPage({
    Key key,
  }) : super(key: key);

  @override
  _DemoPageState createState() => _DemoPageState();
}

class _DemoPageState extends State<DemoPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Flutter Demo'),
      ),
      body: Column(
        children: [
          ExtendedText(
            '这是已经输入的意见反馈,您要反馈的内容,至少10个字,最多200字。这是已经输入的意见反馈,您要反馈的内容您要反馈的内容,至少10个字,最多200字您要反馈的内容,至少10个字,最多200字这是已经输入的意见反馈,您要反馈的内容,至少10个字,最多200字。这是已经输入的意见反馈,您要反馈的内容您要反馈的内容,至少10个字,最多200字您要反馈的内容,至少10个字,最多200字',
            style: TextStyle(
              color: Colors.black,
              fontSize: 17,
              height: 1.6,
            ),
            maxLines: 2,
            overflowWidget: TextOverflowWidget(
              position: TextOverflowPosition.end,
              align: TextOverflowAlign.center,
              // just for debug
              debugOverflowRectColor: Colors.red.withOpacity(0.1),
              child: Container(
                child: Row(
                  mainAxisSize: MainAxisSize.min,
                  children: <Widget>[
                    const Text('\u2026 '),
                    InkWell(
                      child: const Text(
                        'more',
                      ),
                      onTap: () {},
                    )
                  ],
                ),
              ),
            ),
          ),
          Container(
            color: Colors.redAccent,
            height: 50,
          ),
        ],
      ),
    );
  }
}

Simulator Screen Shot - iPhone 11 Pro Max - 2021-04-27 at 10.36.18 As you can see, Container is gone. And I replaced ExtendedText with Text, Container will show. Simulator Screen Shot - iPhone 11 Pro Max - 2021-04-27 at 10.36.50

➜  ~ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.0.5, on macOS 11.2.3 20D91 darwin-x64, locale
    zh-Hans-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[!] Xcode - develop for iOS and macOS
    ! CocoaPods 1.9.3 out of date (1.10.0 is recommended).
        CocoaPods is used to retrieve the iOS and macOS platform side's plugin
        code that responds to your plugin usage on the Dart side.
        Without CocoaPods, plugins will not work on iOS or macOS.
        For more info, see https://flutter.dev/platform-plugins
      To upgrade see
      https://guides.cocoapods.org/using/getting-started.html#installation for
      instructions.
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] IntelliJ IDEA Ultimate Edition (version 2021.1)
[✓] VS Code (version 1.48.1)
[✓] Connected device (3 available)

! Doctor found issues in 1 category.
zmtzawqlp commented 3 years ago

close with https://github.com/fluttercandies/extended_text/commit/74bafe6c17b361d1188d3accdbf2abb7494ffdf8