Flutter 中的容器上不显示文本

问题描述 投票:0回答:1

我是颤振的初学者。我已经尝试了很多选项,但文本没有显示在容器上,我所说的容器是顶部容器(参考图片。)希望我找到解决方案:)

body: ListView(
    children: [
      //Container 1
      GestureDetector(
        onTap: () {
          Navigator.of(context).push(
              MaterialPageRoute(builder: (context) => RememberingPage()));
        },
        child: Container(
          height: 140,
          width: 500,
          padding: const EdgeInsets.only(top: 150),
          margin: const EdgeInsets.only(top: 100, left: 25, right: 25),
          decoration: BoxDecoration(
            color: Theme.of(context).colorScheme.primary,
            borderRadius: BorderRadius.circular(15),
            boxShadow: const [
              BoxShadow(
                color: Color.fromARGB(63, 0, 0, 0),
                blurRadius: 4.0,
                spreadRadius: -5.0,
                offset: Offset(
                  0.0, // horizontal, move right 10
                  8.0, // vertical, move down 10
                ),
              ),
            ],
          ),
          child: Align(
            alignment: Alignment.center,
            child: Text(
              "Remembering",
              style: TextStyle(
                color: Theme.of(context).colorScheme.onPrimary,
                fontSize: 20,
              ),
              
            ),
          ),
        ),
      ),

android flutter text containers mobile-development
1个回答
0
投票

Container
的顶部填充设置为 150,但
Container
本身的高度为 140。包裹
Align
Text
在这里没有帮助。

© www.soinside.com 2019 - 2024. All rights reserved.