Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>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.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading