Flutter mesaj yeri boş kalıyor

Nazo_2004

Decapat
Katılım
8 Temmuz 2021
Mesajlar
259
Daha fazla  
Cinsiyet
Erkek
Flutter mesaj yeri boş kalıyor ne yapmalıyım?

a.PNG



Kod:
class ImagesYorumlar extends StatefulWidget {
  bool click = false;
  String name;
  ImagesYorumlar({required this.name});
  _ImagesYorumlarState createState() => _ImagesYorumlarState();
}

class _ImagesYorumlarState extends State<ImagesYorumlar> {
  bool click = false;
  Color _favIconColor = Colors.grey;
  Color _comIconColor = Colors.grey;
  Color _bookColor = Colors.grey;
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        body: Yorumlar(),
      ),
    );
  }
}

class Yorumlar extends StatefulWidget {
  const Yorumlar({Key? key}) : super(key: key);
  _YorumlarState createState() => _YorumlarState();
}

class _YorumlarState extends State<Yorumlar> {
  TextEditingController t1 = TextEditingController();

  List mesajListesi = [];

  listeyeMesajEkle(String metin) {
    setState(() {
      mesajListesi.insert(0, metin);
      t1.clear();
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        debugShowCheckedModeBanner: false,
        home: Scaffold(
          body: Container(
              child: Column(children: [
            SizedBox(height: 5),
            Row(children: [
              SizedBox(
                width: 300,
                child: TextField(
                  onSubmitted: listeyeMesajEkle,
                  controller: t1,
                  decoration: new InputDecoration(
                    labelText: "Yorum Ekle...",
                    fillColor: Colors.black,
                    border: new OutlineInputBorder(
                      borderRadius: new BorderRadius.circular(25.0),
                      borderSide: new BorderSide(),
                    ),
                  ),
                ),
              ),
              IconButton(
                  icon: Icon(Icons.send),
                  onPressed: () {
                    listeyeMesajEkle(t1.text);
                  }),
            ]),
            Flexible(
              child: ListView.builder(
                reverse: true,
                itemCount: mesajListesi.length,
                itemBuilder: (context, int indeksNumarasi) => Container(
                  child: Column(
                    children: [
                      Padding(
                          padding: EdgeInsets.all(16),
                          child: Row(
                            children: [
                              //Profile Photo
                              Container(
                                width: 40,
                                height: 40,
                                decoration: BoxDecoration(
                                  color: Colors.grey[300],
                                  shape: BoxShape.circle,
                                ),
                                child: Stack(
                                  children: [
                                    Container(
                                      width: 40,
                                      height: 40,
                                      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,
                                      ),
                                      child: GestureDetector(onTap: () {}),
                                    ),
                                  ],
                                ),
                              ),
                              SizedBox(width: 10),
                              InkWell(
                                child: FlatButton(child: Text("asdasd"), onPressed: () {}),
                              )
                            ],
                          )),
                      //Yazı alanı
                      Container(
                        padding: EdgeInsets.fromLTRB(10, 1, 10, 5),
                        child: Text(t1.text.toString(), style: TextStyle(color: Colors.black)),
                      ),
                      //İkonlar
                      Container(
                          padding: EdgeInsets.only(left: 15, bottom: 0, right: 0, top: 2),
                          child: Row(children: [
                            IconButton(
                              icon: Icon(Icons.favorite),
                              color: Colors.grey,
                              tooltip: 'Add to favorite',
                              onPressed: () {
                                setState(() {});
                              },
                            ),
                            SizedBox(width: 5),
                            FlatButton(
                              child: Text("Yanıtla",
                                  style: TextStyle(
                                    color: Colors.black,
                                  )),
                              onPressed: () {},
                            ),
                          ]))
                    ],
                  ),
                ),
              ),
            ),
          ])),
        ));
  }
}
 

Yeni konular

Geri
Yukarı