I am trying to get this image in my window. But the image is of a large size. I want the size of the image to shrink if the window size decreases and expand if it increases. with the present code the increasing part works well. But instead of decreasing it throws a render overflow error.
import "package:flutter/material.dart";
class Default extends StatefulWidget {
const Default({super.key});
@override
State<Default> createState() => _DefaultState();
}
class _DefaultState extends State<Default> {
Map articles = {};
@override
Widget build(BuildContext context) {
ColorScheme colors = Theme.of(context).colorScheme;
return Scaffold(
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
AspectRatio(
aspectRatio: 2,
child: ColorFiltered(
colorFilter: ColorFilter.mode(
colors.background, BlendMode.darken),
child: Stack(
children: [Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(
child: Image.asset(
fit: BoxFit.fill,
"assets/images/shelf.png"),
),
Expanded(
child: Image.asset(
fit: BoxFit.fill,
"assets/images/shelf.png"),
),
],
)],
),
),
),
],
),
bottomNavigationBar: BottomNavigationBar(items: const [
BottomNavigationBarItem(icon: Icon(Icons.abc), label: "hello"),
BottomNavigationBarItem(icon: Icon(Icons.abc), label: "hello"),
BottomNavigationBarItem(icon: Icon(Icons.abc), label: "hello"),
],),
);
}
}
I have tried fitted box, boxfits but none work.