如果侧面不适合放置文本,如何在Flutter中的图像下方放置文本?

时间:2019-05-13 20:30:01

标签: dart flutter

我不知道如何将列和行连接在一起,因此图像周围呈“ L”形。

This is text. XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
This is text. XXXXXXXXXXXXXXXXimageXXXXXXXXXXXXXXXX
This is text. XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
This is text. XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
This is text.This is text.This is text.This is text.
This is text.This is text.This is text.This is text.
This is text.This is text.This is text.This is text.

1 个答案:

答案 0 :(得分:0)

您需要嵌套行和列。

示例:

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

    class MyApp extends StatelessWidget {

      @override
  Widget build(BuildContext context) {
return MaterialApp(
  title: 'Flutter Demo',
  home: MyHomePage(),
);
     }
   }

  class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => _MyHomePageState();
   }

    class _MyHomePageState extends State<MyHomePage> {
    @override
    Widget build(BuildContext context) {
return Scaffold(
  appBar: AppBar(
    title: Text("Text"),
  ),
  body: Center(
    child: Column(
      mainAxisAlignment: MainAxisAlignment.center,
      children: <Widget>[
        Row(
          mainAxisAlignment: MainAxisAlignment.start,
          children: <Widget>[
            Column(
              children: <Widget>[
                Text(
                  'This is text.',
                ),
                Text(
                  'This is text.',
                ),
                Text(
                  'This is text.',
                ),
                Text(
                  'This is text.',
                ),
                Text(
                  'This is text.',
                ),
                Text(
                  'This is text.',
                ),
              ],
            ),
            Column(
              children: <Widget>[
                SizedBox(
                  width: 100,
                  height: 100,
                  child: Image.asset("assets/kitty-551554__340.jpg"),
                ),
                Row(
                  children: <Widget>[
                    Column(
                      children: <Widget>[
                        Text(
                          'This is text.',
                        ),
                        Text(
                          'This is text.',
                        ),
                      ],
                    ),
                    Column(
                      children: <Widget>[
                        Text(
                          'This is text.',
                        ),
                        Text(
                          'This is text.',
                        ),
                      ],
                    ),
                  ],
                )
              ],
            )
          ],
        )
      ],
    ),
  ),
);
  }
  }