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