want to add a background image to my drawer. I want to fix my background image over Drawer width
Drawer(
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topRight: Radius.circular(40),
bottomRight: Radius.circular(40),
topLeft: Radius.circular(40),
bottomLeft: Radius.circular(40),
),
),
child: Stack(children: <Widget>[
Image.asset(
"assets/images/menu.png",
width: double.infinity,
fit: BoxFit.cover,
),
CodePudding user response:
Wrap your Image.asset
in a Positioned.fill(child: Image.asset ... )
.
This should make it expand to fill the Stack
.
CodePudding user response:
Try the following code:
Drawer(
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topRight: Radius.circular(40),
bottomRight: Radius.circular(40),
topLeft: Radius.circular(40),
bottomLeft: Radius.circular(40),
),
),
child: Stack(children: <Widget>[
Image.asset(
"assets/images/menu.png",
width: MediaQuery.of(context).size.width,
fit: BoxFit.cover,
),