Вы можете скопировать и вставить полный код ниже
Вы можете использовать Transform.scale
, с примером масштаба 3,0, вы можете увидеть, что размер изображения превышает исходный ConstrainedBox
Transform.scale(
scale: 3.0,
child: new Container(
decoration: BoxDecoration(
image: DecorationImage(
image: NetworkImage("https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/132.png"),
fit: BoxFit.cover
)
)
),
),
рабочая демонстрация
полный код
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
void _incrementCounter() {
setState(() {
_counter++;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Container(
child: GridView.count(
crossAxisCount: 4,
children: <Widget>[
Transform.scale(
scale: 3.0,
child: new Container(
decoration: BoxDecoration(
image: DecorationImage(
image: NetworkImage("https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/132.png"),
fit: BoxFit.cover
)
)
),
),
Transform.scale(
scale: 2.0,
child: new Container(
decoration: BoxDecoration(
image: DecorationImage(
image: NetworkImage("https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/132.png"),
fit: BoxFit.cover
)
)
),
),
Transform.scale(
scale: 1.5,
child: new Container(
decoration: BoxDecoration(
image: DecorationImage(
image: NetworkImage("https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/132.png"),
fit: BoxFit.cover
)
)
),
),
Transform.scale(
scale: 1.0,
child: new Container(
decoration: BoxDecoration(
image: DecorationImage(
image: NetworkImage("https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/132.png"),
fit: BoxFit.cover
)
)
),
),
new Container(
decoration: BoxDecoration(
image: DecorationImage(
image: NetworkImage("https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/132.png"),
fit: BoxFit.cover
)
)
),
new Container(
decoration: BoxDecoration(
image: DecorationImage(
image: NetworkImage("https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/132.png"),
fit: BoxFit.cover
)
)
)
]),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: Icon(Icons.add),
),
);
}
}