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

Why do I get a blank white page? Flutter

I am new to Flutter.
I get a blank white screen.
Is the problem with the code or something else?

My code is as follows:

import 'package:animalsflutter/Splash.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(const AnimalsApp());
}

class AnimalsApp extends StatelessWidget {
  const AnimalsApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Splash(),
    );
  }
}

And the continuation of the code

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

import 'package:flutter/material.dart';

class Splash extends StatelessWidget {
  const Splash({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Color(0xff00324B),
      body: Column(
        children: [
          Container(
            width: double.infinity,
            height: double.infinity,
            child: Container(
              child: Image.asset(
                fit: BoxFit.fill,
                "assets/images/hiro.png",
              ),
            ),
          ),
          Stack(
            children: [
              Positioned(
                child: Container(
                  height: 200.0,
                  width: 200.0,
                  decoration: BoxDecoration(
                    color: Colors.blueAccent,
                    border: Border.all(
                      color: Colors.black,
                      width: 2.0,
                    ),
                    borderRadius: BorderRadius.circular(10.0),
                  ),
                  child: Text("signIn"),
                ),
                left: 24.0,
                top: 24.0,
              ),
            ],
          ),
        ],
      ),
    );
  }
}

What could be my problem? And what’s the solution? And Could it be a problem with the simulator?

>Solution :

Based on your code-structure, You are trying to get this

class Splash extends StatelessWidget {
  const Splash({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Color(0xff00324B),
      body: Stack(
        children: [
          Positioned.fill(
            child: Image.asset(
              fit: BoxFit.fill,
              "assets/images/hiro.png",
            ),
          ),
          Positioned(
            child: Container(
              height: 200.0,
              width: 200.0,
              decoration: BoxDecoration(
                color: Colors.blueAccent,
                border: Border.all(
                  color: Colors.black,
                  width: 2.0,
                ),
                borderRadius: BorderRadius.circular(10.0),
              ),
              child: Text("signIn"),
            ),
            left: 24.0,
            top: 24.0,
          ),
        ],
      ),
    );
  }
}

More about using Stack

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