I'm trying to wrap a Stack widget on Flutter into an Expanded widget. It looks like the Expanded widget forces the stack to be positioned with a default margin. So, How could I make the Stack fit in the Expanded widget with 0 margin? Or what would you recommend to layout widgets (with overlap) and make sure to use the suitable widget ensuring the responsivity of my app.
import 'package:WEW/constants.dart';
import 'package:WEW/size_config.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
// The body of my Scaffold widget in the main class
class Body extends StatefulWidget {
@override
_BodyState createState() => _BodyState();
}
// Implementation of state State
class _BodyState extends State<Body> {
@override
Widget build(BuildContext context) {
return SafeArea(
child: SizedBox(
height: getScreenHeight(),
width: getScreenWidth(),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Expanded(
// The stack I'm trying to fit into Expanded
child: Stack(
children: <Widget>[
Positioned(
top: 0,
left: 0,
child: Image.asset(
"assets/images/welcome_top.png",
height: getProportionateScreenHeight(144),
width: getProportionateScreenWidth(193),
),
),
Positioned(
top: 0,
left: 0,
child: Image.asset(
"assets/images/WEW_logo_light.png",
height: getProportionateScreenHeight(149),
width: getProportionateScreenWidth(228),
),
),
],
),
),
Expanded(
flex: 2,
child: Column(
children: <Widget>[
Text(
"Werkgerers & Werknemers",
style: TextStyle(
fontSize: getProportionateScreenHeight(36),
//color: cPrimaryColor,
fontWeight: FontWeight.bold,
),
),
Text("Verbinden van de wereld van logistiek"),
],
),
),
Expanded(
child: SizedBox(),
),
],
),
),
);
}
}
question from:
https://stackoverflow.com/questions/65865782/im-trying-to-wrap-a-stack-widget-on-flutter-into-an-expanded-widget-how-could 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…