• 07-07-2022, 10:09:43
    #1
    Arkadaşlar merhaba, flutter'da google maps eklentisiyle polyline çiziyorum fakat bir yerde takıldım.
    Kod: https://www.toptal.com/developers/hastebin/sexukuqibe.yaml
    Bu kodda ListView'in içerisinde butona basıldığı zaman voidin içerisindeki point değerinin ona göre değer almasını istiyorum. Misal ListView'in içerisindeki index 3 ise point'in point3 olarak değer almasını istiyorum bunu nasıl yapabilirim?

      Widget build(BuildContext context) {
        return Scaffold(
          body: Stack(
            children: [
    
              GoogleMap(
                polylines: _polyline0,
                mapType: MapType.normal,
                initialCameraPosition: _kLake,
                onMapCreated: (map) {},
              ),
              bottomListView
            ],
          ),
        );
      }
    
      void initState() {
        super.initState();
        Future.microtask(() => initMapItemList());
        _polyline0.add(Polyline(
            polylineId: PolylineId("1"),
            points: points0,
            color: Colors.black.withOpacity(0.25)));
      }
      
      
      ListView listViewFlights() {
        return ListView.builder(
          scrollDirection: Axis.horizontal,
          shrinkWrap: true,
          itemCount: flightList.length,
          itemBuilder: (context, index) {
            return SizedBox(
              width: MediaQuery.of(context).size.width - 100,
              child: Container(
                child: Card(
                  color: Colors.white,
                  child: ListTile(
                    title: Column(
                      children: [
                        Text(
                          flightList[index].country!,
                          style:
                              TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
                        ),
                        RaisedButton(
                          onPressed: () {},
                          child: Text("$index"),
                        )
                      ],
                    ),
                  ),
                ),
              ),
            );
          },
        );
  • 07-07-2022, 15:26:47
    #2
    Bi değişken tanımlayıp points yerine yazarsınız sonra button press kısmına setstate verip index ile verdiğini değişkeni eşitlersiniz. Aklıma bu geldi soruyu yanlış anlamadıysam