Flutter map popup message

321 views
Skip to first unread message

sona

unread,
Dec 9, 2020, 2:36:16 PM12/9/20
to Flutter Development (flutter-dev)
Hello , please help me to show a popup message in the marker of flutter map. On this page it was going to another page .But,I want to show popup on the same page



builder: (ctx) =>
new Container(
child: IconButton(icon: Icon(Icons.camera_alt,
color: AppTheme.PrimaryColor,
), onPressed: () => {
Navigator.push(context,MaterialPageRoute(builder: (context) => cctv(place: cctvList[i]['place'],
ip: cctvList[i]['ipaddress'],

port: cctvList[i]['port']
)))
}),
),
));
}
return y;
}

var infoWindowVisible = false;
GlobalKey<State> key = new GlobalKey();


Stack _buildCustomMarker() {
return Stack(
children: <Widget>[popup(), marker()],
);
}

Opacity popup() {
return Opacity(
opacity: infoWindowVisible ? 1.0 : 0.0,
child: Container(
alignment: Alignment.bottomCenter,
width: 279.0,
height: 256.0,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/images/ic_info_window.png"),
fit: BoxFit.cover)),
),
);
}

Opacity marker() {
return Opacity(
child: Container(
alignment: Alignment.bottomCenter,
child: Image.asset(
'assets/images/ic_marker.png',
width: 49,
height: 65,
)),
opacity: infoWindowVisible ? 0.0 : 1.0,
);
}



class cctv extends StatelessWidget {


final String place;
final String ip;
final String port;

const cctv({Key key, this.place, this.ip, this.port}) : super(key: key);

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text( place + " Footage", style: TextStyle(
fontFamily: AppTheme.fontname,
fontWeight: FontWeight.w700,
color: AppTheme.spacer,
)),
centerTitle: true,
backgroundColor: AppTheme.background,
),
body: Center(
child: Text("IP Address : " + ip + " Port : " + port,style: new TextStyle(fontSize: 20.0,fontWeight: FontWeight.bold),)
),
);
}
}









sumit kumawat

unread,
Dec 9, 2020, 2:44:39 PM12/9/20
to sona, Flutter Development (flutter-dev)
Hello
Please use this inside markers.I used for multiple markers
markers:_marker.add(icon: modal[i].isLive==0?marker_icon:liveMarkerIcon,
markerId: MarkerId(markerId),
position: LatLng(double.parse(modal[i].placeAddressLat),
    double.parse(modal[i].placeAddressLong)),
onTap: () async {
showDialog()
}
);

--
You received this message because you are subscribed to the Google Groups "Flutter Development (flutter-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flutter-dev/CAD04MMASSn0Gc960k2iaD-VOai4UOX9%3DUuadxhN8_Fifc2u8uw%40mail.gmail.com.


--
Thanks & Regards
Sumit Kumawat

Suzuki Tomohiro

unread,
Dec 9, 2020, 3:12:46 PM12/9/20
to Flutter Development (flutter-dev)
Isn’t showDialog() what you want rather than Navigator.push(context,MaterialPageRoute ?

Reply all
Reply to author
Forward
0 new messages