@@ -141,20 +141,26 @@ ImageRender networkImageRender({
141
141
future: completer.future,
142
142
builder: (BuildContext buildContext, AsyncSnapshot <Size > snapshot) {
143
143
if (snapshot.hasData) {
144
- return AspectRatio (
145
- aspectRatio: _aspectRatio (attributes, snapshot),
146
- child: Image .network (
147
- src,
148
- headers: headers,
149
- width: width ?? _width (attributes) ?? snapshot.data! .width,
150
- height: height ?? _height (attributes),
151
- frameBuilder: (ctx, child, frame, _) {
152
- if (frame == null ) {
153
- return altWidget? .call (_alt (attributes)) ??
154
- Text (_alt (attributes) ?? "" , style: context.style.generateTextStyle ());
155
- }
156
- return child;
157
- },
144
+ return Container (
145
+ constraints: BoxConstraints (
146
+ maxWidth: width ?? _width (attributes) ?? snapshot.data! .width,
147
+ maxHeight: (width ?? _width (attributes) ?? snapshot.data! .width) / _aspectRatio (attributes, snapshot)
148
+ ),
149
+ child: AspectRatio (
150
+ aspectRatio: _aspectRatio (attributes, snapshot),
151
+ child: Image .network (
152
+ src,
153
+ headers: headers,
154
+ width: width ?? _width (attributes) ?? snapshot.data! .width,
155
+ height: height ?? _height (attributes),
156
+ frameBuilder: (ctx, child, frame, _) {
157
+ if (frame == null ) {
158
+ return altWidget? .call (_alt (attributes)) ??
159
+ Text (_alt (attributes) ?? "" , style: context.style.generateTextStyle ());
160
+ }
161
+ return child;
162
+ },
163
+ ),
158
164
),
159
165
);
160
166
} else if (snapshot.hasError) {
0 commit comments