Flutter Row Yan Yana Sığmayınca Nasıl Alt Alta Yapılır?

Nazo_2004

Decapat
Katılım
8 Temmuz 2021
Mesajlar
260
Daha fazla  
Cinsiyet
Erkek
Flutter Row yan yana sığmayınca altta atmayı olayını nasıl yapılır?

a.PNG


Kod:
import 'package:flutter/material.dart';
import 'package:blockmedia/Settings/Settings.dart';
import 'package:blockmedia/Settings/Profile_Ayarlama/Profile_Ayarlama.dart';
import 'package:blockmedia/pages/Profile/ProfilePost/ProfilePost.dart';

class Profile extends StatefulWidget {
  @override
  _ProfileState createState() => _ProfileState();
}

class _ProfileState extends State<Profile> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: SafeArea(
          child: Scaffold(
              appBar: AppBar(
                backgroundColor: Colors.white,
                title: Center(child: Text("Hayri Alagöz", style: TextStyle(color: Colors.black))),
                actions: <Widget>[
                  IconButton(
                    icon: Icon(Icons.settings, color: Colors.black),
                    onPressed: () {
                      Navigator.push(context, MaterialPageRoute(builder: (context) => Settings()));
                    },
                  ),
                ],
              ),
              body: SingleChildScrollView(
                child: Column(children: <Widget>[
                  SizedBox(height: 20),
                  Container(
                    child: Column(
                      children: <Widget>[
                        Container(
                          child: Stack(children: [
                            Container(
                              width: 130,
                              height: 130,
                              decoration: BoxDecoration(
                                border: Border.all(width: 4, color: Theme.of(context).scaffoldBackgroundColor),
                                boxShadow: [
                                  BoxShadow(
                                    spreadRadius: 2,
                                    blurRadius: 10,
                                    color: Colors.black.withOpacity(0.1),
                                  ),
                                ],
                                shape: BoxShape.circle,
                              ),
                            )
                          ]),
                        ),
                        SizedBox(height: 10),
                        SizedBox(width: 15),
                        Text("Hayri Alagöz", style: TextStyle(fontSize: 15, fontWeight: FontWeight.bold)),
                        SizedBox(width: 10),
                      ],
                    ),
                  ),
                  SizedBox(height: 10),
                  Container(
                    child: Column(
                      children: <Widget>[
                        Row(
                          children: <Widget>[
                            SizedBox(width: 15),
                            Text("Takipçiler", style: TextStyle(fontSize: 15, fontWeight: FontWeight.bold)),
                            SizedBox(width: 30),
                            Text("Takip Edilenler", style: TextStyle(fontSize: 15, fontWeight: FontWeight.bold)),
                            SizedBox(width: 30),
                            Text("Paylaşımlar", style: TextStyle(fontSize: 15, fontWeight: FontWeight.bold)),
                            SizedBox(width: 15),
                          ],
                        ),
                        Row(
                          children: <Widget>[
                            SizedBox(width: 35),
                            Text("75", style: TextStyle(fontSize: 15, fontWeight: FontWeight.bold)),
                            SizedBox(width: 105),
                            Text("75", style: TextStyle(fontSize: 15, fontWeight: FontWeight.bold)),
                            SizedBox(width: 105),
                            Text("75", style: TextStyle(fontSize: 15, fontWeight: FontWeight.bold)),
                          ],
                        ),
                      ],
                    ),
                  ),
                  SizedBox(height: 10),
                  FlatButton(
                    child: Text("Profile düzenle", style: TextStyle(fontSize: 25, color: Colors.black)),
                    minWidth: 1000,
                    height: 60,
                    color: Colors.white,
                    shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(18.0), side: BorderSide(color: Colors.black)),
                    onPressed: () {
                      Navigator.push(context, MaterialPageRoute(builder: (context) => ProfileAyarlama()));
                    },
                  ),
                  SizedBox(height: 10),
                  Container(
                    child: Row(
                      children: <Widget>[
                        Container(
                          child: FlatButton(
                            minWidth: 185,
                            height: 60,
                            child: Icon(Icons.photo),
                            onPressed: () {},
                          ),
                        ),
                        Container(
                          child: FlatButton(
                            minWidth: 185,
                            height: 60,
                            child: Icon(Icons.comment),
                            onPressed: () {},
                          ),
                        ),
                      ],
                    ),
                  ),
                  Wrap(
                    spacing: 8.0, // gap between adjacent chips
                    runSpacing: 4.0, // gap between lines
                    children: <Widget>[
                      buildRowArea(),
                    ],
                  ),

                  //buildRowArea(),
                  /*
                  Wrap(
                    spacing: 1,
                    children: [
                      Post(),
                      Post(),
                      Post(),
                      Post(),
                      Post(),
                      Post(),
                    ],
                  ),*/
                ]),
              ))),
    );
  }
}

Widget buildRowArea() => Wrap(children: [
      Row(
        children: [
          Post(),
          Post(),
          Post(),
          Post(),
          Post(),
          Post(),
        ],
      ),
    ]);

class Post extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      child: Column(
        children: <Widget>[
          Container(
            child: Row(children: <Widget>[
              Container(
                child: GestureDetector(onTap: () {
                  Navigator.push(context, MaterialPageRoute(builder: (context) => ProfilePost()));
                }),
                height: 120,
                width: 120,
                decoration: BoxDecoration(
                  color: Colors.grey[300],
                  border: Border.all(
                    width: 1,
                  ),
                ),
              ),
            ]),
          )
        ],
      ),
    );
  }
}
 

Technopat Haberler

Yeni konular

Geri
Yukarı