Search code examples
androidfluttertextcontainersmobile-development

Text is not displaying on Container in Flutter


I am a beginner in flutter. I have tried many options, but the text is not showing on the container, container i am talking about is top container (Refer Img.) Hope i find the solution :)

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,
              ),
              
            ),
          ),
        ),
      ),

Output


Solution

  • The Container has top padding set to 150 yet the height of the Container itself is 140. The Align that is wrapping the Text won't help here.