0

Grid view with flutter icons with 2 columns and Each Images Text under the image aligned bottom center with 300 by 300 pixel dimensions or icon size 98 or 85My code is as below`import

    appBar: AppBar(title: Text("Digital Directory"),),
  body: Center(
      child: GridView.count(
        primary: false,
        padding: const EdgeInsets.all(20),
        crossAxisSpacing: 10,
        mainAxisSpacing: 10,
        crossAxisCount: 2,
        children: <Widget>[
          Container(
            color: Colors.cyan[100],
             child: GestureDetector
          (
          onTap:(){

            Navigator.of(context).push(MaterialPageRoute(builder:(context)=>MobileAccessoriesPage(),
            ),
            );
          },

    child: Center (child:Text ('Mobiles'),icon:Icons.mobile_screen_share),

         ),
  ),

I am building grid view Application with flutter flat icons and I want to navigate when clicked on Flat Icons to another screens (i.e .dart page/screen)`

4

1 回答 1

0

Change the Child Of Center with the code below:

Center(
   child: Row(
      mainAxisAlignment: MainAxisAlignment.spaceEvenly,
              crossAxisAlignment: CrossAxisAlignment.center,
                   children: [
                              Text(
                                'Mobiles',
                              ),
                              Icon(Icons.mobile_screen_share),
                            ],
                          ),
                         )

This would make the text 'mobiles' and the Icon to appear side by side. If you are not happy with the alignment change the mainAxisAlignment and the crossAxisAlignment

于 2020-09-05T11:04:46.390 回答