Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to change image size in dart

Tags:

My image is unable to resize. Firstly I have put the background in the container widget. After that, I have put the logo image in the center widget using Image.assets. The main problem is that the size of the image is resizing according to the height and width. Currently, I am coding in the flutter framework using dart language.

I am doing coding in Android Studio.

@override
  Widget build(BuildContext context) {
    return new MaterialApp(
      debugShowCheckedModeBanner: false,
      home: new Scaffold(
        body: new Stack(
          children: <Widget>[
            new Container(
              decoration: new BoxDecoration(
                  image: new DecorationImage(
                      image: new AssetImage("assets/imgs/home_bg.png"),
                      fit: BoxFit.cover,
                  )
              ),
            ),
            new Center(
              child: Image.asset("assets/imgs/home_logo.png",height: 300,width:300,),
            )
          ],
        ),
      ),
    );

No error messages are showing. Then also the image is not resizing.

like image 338
Tanu Agarwal Avatar asked Aug 30 '19 09:08

Tanu Agarwal


1 Answers

      body: Center(
        child: SizedBox(
          width: 100.0,
          height: 100.0,
          child: Image.network(
              "https://th.thgim.com/opinion/op-ed/article22695424.ece/alternates/FREE_300/9thscience"),
        ),
      ))
like image 54
Amit Prajapati Avatar answered Sep 19 '22 23:09

Amit Prajapati