Chvění obrazu kontejner, obrázky vedle sebe

0

Otázka

Snažím se, aby na domovské stránce a vytvořit tento obrázek nádoby, tři snímky vedle sebe. Snažil jsem se dělat to takhle:

Container(
     height: 100.0,
     width: 150.0,
     child: Row(
         children:[
             Image(image: AssetImage('')),
         Column(
         children:[
             Image(image: AssetImage('')), 
             Image(image: AssetImage('')), 
             ],
            ),
          ],
        ), 
      ),

to, co jsem dostat vypadá takto

what i get looks like this

zatímco to, co chci, je to

while what i want is this

I když výsledky nejsou nic, jako je tento. Nějaké nápady na to, jak obnovit můj figma image?

containers flutter flutter-layout
2021-11-20 17:03:13
1

Nejlepší odpověď

1

Na své Image widget, poskytnout height a weight a také použít fit: BoxFit.cover, pro lepší výhled, pak to bude dobré jít.

Váš Kontejner bude v pořádku

 Container(
              height: 100.0,
              width: 150.0 + 4, //for padding
              color: Colors.green,
              child: Row(
                children: [
                  Padding(
                    // for rounded border
                    padding: const EdgeInsets.only(right: 2.0),
                    child: ClipRRect(
                      borderRadius: BorderRadius.circular(12),
                      child: const Image(
                        image: AssetImage('assets/images/p7_image_asset.jpeg'),
                        width: 150 / 2,
                        height: 100.0,
                        fit: BoxFit.cover,
                      ),
                    ),
                  ),
                  Column(
                    children: [
                      Padding(
                        // space between items
                        padding: const EdgeInsets.only(left: 2.0, bottom: 2),
                        child: ClipRRect(
                          borderRadius: BorderRadius.circular(12),
                          child: Image(
                            image:
                                AssetImage('assets/images/p8_image_asset.jpeg'),
                            fit: BoxFit.cover,
                            height: 100 / 2 - 2, //-2 for padding
                            width: 150 / 2,
                          ),
                        ),
                      ),
                      Padding(
                        padding: const EdgeInsets.only(left: 2.0, top: 2),
                        child: ClipRRect(
                          borderRadius: BorderRadius.circular(12),
                          child: Image(
                            image:
                                AssetImage('assets/images/p9_image_asset.jpeg'),
                            fit: BoxFit.cover,
                            height: 100 / 2 - 2, //-2 for padding
                            width: 150 / 2,
                          ),
                        ),
                      ),
                    ],
                  ),
                ],
              ),
            ),

enter image description here

Budu podporovat, aby šel flutter.dev a dozvědět se o těchto widgetů. Pokud jste se chtěli GridView zaškrtněteflutter_staggered_grid_view

2021-11-20 18:23:08

děkuji vám, že funguje. a také flutter_staggered_grid_view docela dobře funguje.
Elena Soteriou

ano, použít pouze tehdy, pokud jste potřebovali pro GridView. také pro vnitřní text zkontrolovat stack widget
Yeasin Sheikh

V jiných jazycích

Tato stránka je v jiných jazycích

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................