ak133720

Google Flutter Map with point

Oct 16th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 41.60 KB | None | 0 0
  1. First... You need to import pubspec.yaml on some depe like :: google_maps_flutter: ^0.5.21+7 and font_awesome_flutter version :)
  2.  
  3. Google Point Map Flutter by Aung Khant :)
  4.  
  5. class PointApp extends StatefulWidget {
  6. @override
  7. PointAppState createState() => PointAppState();
  8. }
  9.  
  10. class PointAppState extends State<PointApp> {
  11. Completer<GoogleMapController> _controller = Completer();
  12.  
  13. @override
  14. void initState() {
  15. super.initState();
  16. }
  17. double zoomVal = 5.0;
  18.  
  19. @override
  20. Widget build(BuildContext context) {
  21. return Scaffold(
  22. appBar: AppBar(
  23. leading: IconButton(
  24. icon: Icon(FontAwesomeIcons.arrowLeft),
  25. onPressed: () {
  26. Navigator.push(
  27. context,
  28. MaterialPageRoute(builder: (context) => NavigationDrawerDemo()),
  29. );
  30. },),
  31. title: Text("Yangon"),
  32. actions: <Widget>[
  33. IconButton(
  34. icon: Icon(FontAwesomeIcons.search),
  35. onPressed: () {
  36. //Need to Route n add Search Page
  37. }),
  38. ],
  39. ),
  40. body: Stack(
  41. children: <Widget>[
  42. _buildGoogleMap(context),
  43. _zoominusfunction(),
  44. _zoomplusfunction(),
  45. _buildContainer(),
  46. ],
  47. ),
  48. );
  49. }
  50.  
  51. Widget _zoominusfunction() {
  52. return Align(
  53. alignment: Alignment.topLeft,
  54. child: IconButton(
  55. icon: Icon(FontAwesomeIcons.searchMinus,color:Color(0xff6200ee)),
  56. onPressed: () {
  57. zoomVal--;
  58. _minus(zoomVal);
  59. }),
  60. );
  61. }
  62.  
  63. Widget _zoomplusfunction() {
  64. return Align(
  65. alignment: Alignment.topRight,
  66. child: IconButton(
  67. icon: Icon(FontAwesomeIcons.searchPlus,color:Color(0xff6200ee)),
  68. onPressed: () {
  69. zoomVal++;
  70. _plus(zoomVal);
  71. }),
  72. );
  73. }
  74. // for _minus Func
  75. Future<void> _minus(double zoomVal) async {
  76. final GoogleMapController controller = await _controller.future;
  77. controller.animateCamera(CameraUpdate.newCameraPosition(CameraPosition(target: LatLng(16.9284, 96.2346), zoom: zoomVal)));
  78. }
  79. Future<void> _plus(double zoomVal) async {
  80. final GoogleMapController controller = await _controller.future;
  81. controller.animateCamera(CameraUpdate.newCameraPosition(CameraPosition(target: LatLng(17.132582, 96.141762), zoom: zoomVal)));
  82. }
  83. // this method create Wid of Slide var
  84. Widget _buildContainer() {
  85. return Align(
  86. alignment: Alignment.bottomLeft,
  87. child: Container(
  88. margin: EdgeInsets.symmetric(vertical: 20.0),
  89. height: 150.0,
  90. child: ListView(
  91. scrollDirection: Axis.horizontal,
  92. children: <Widget>[
  93. SizedBox(width: 10.0),
  94. Padding(
  95. padding: const EdgeInsets.all(8.0),
  96. child: _boxes(
  97. "https://lh5.googleusercontent.com/p/AF1QipPcBXXmL5oczBzicqAhoQkzsX5SfOqVqmPlOlvQ=w225-h160-k-no",
  98. 16.8360031,96.1332521, "MHTi"),
  99. ),
  100. SizedBox(width: 10.0),
  101. Padding(
  102. padding: const EdgeInsets.all(8.0),
  103. child: _boxes(
  104. "https://lh5.googleusercontent.com/p/AF1QipMKRN-1zTYMUVPrH-CcKzfTo6Nai7wdL7D8PMkt=w340-h160-k-no",
  105. 16.7984618,96.1490159, "Shwe Dagon Pagoda"),
  106. ),
  107. SizedBox(width: 10.0),
  108. Padding(
  109. padding: const EdgeInsets.all(8.0),
  110. child: _boxes(
  111. "https://images.unsplash.com/photo-1504940892017-d23b9053d5d4?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=60",
  112. 16.7783961,96.1532603, "BoGyoke Zay"),
  113. ),
  114. ],
  115. ),
  116. ),
  117. );
  118. }
  119. // box wid get goes h3r3
  120. Widget _boxes(String _image, double lat,double long,String pagodaName) {
  121. return GestureDetector(
  122. onTap: () {
  123. _gotoLocation(lat,long);
  124. },
  125. child: Container(
  126. child: new FittedBox(
  127. child: Material(
  128. color: Colors.white10,
  129. elevation: 14.0,
  130. borderRadius: BorderRadius.circular(24.0),
  131. shadowColor: Color(0x802196F3),
  132. child: Row(
  133. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  134. children: <Widget>[
  135. Container(
  136. width: 180,
  137. height: 200,
  138. child: ClipRRect(
  139. borderRadius: new BorderRadius.circular(24.0),
  140. child: Image(
  141. fit: BoxFit.fill,
  142. image: NetworkImage(_image),
  143. ),
  144. ),
  145. ),
  146. Container(
  147. child: Padding(
  148. padding: const EdgeInsets.all(8.0),
  149. child: myDetailsContainer1(pagodaName),
  150. ),
  151. ),
  152. ],
  153. ),
  154. ),
  155. ),
  156. ),
  157. );
  158. }
  159.  
  160. Widget myDetailsContainer1(String pagodaName) {
  161. return Column(
  162. mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  163. children: <Widget>[
  164. Padding(
  165. padding: const EdgeInsets.only(left: 8.0),
  166. child: Container(
  167. child: Text(pagodaName,
  168. style: TextStyle(
  169. color: Color(0xff6200ee),
  170. fontSize: 24.0,
  171. fontWeight: FontWeight.bold),
  172. )),
  173. ),
  174. SizedBox(height: 5.0),
  175. Container(
  176. child: Row(
  177. mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  178. children: <Widget>[
  179. Container(
  180. child: Text(
  181. "4.1",
  182. style: TextStyle(
  183. color: Colors.black54,
  184. fontSize: 18.0,
  185. ),
  186. )),
  187. Container(
  188. child: Icon(
  189. FontAwesomeIcons.solidStar,
  190. color: Colors.amber,
  191. size: 15.0,
  192. ),
  193. ),
  194. Container(
  195. child: Icon(
  196. FontAwesomeIcons.solidStar,
  197. color: Colors.amber,
  198. size: 15.0,
  199. ),
  200. ),
  201. Container(
  202. child: Icon(
  203. FontAwesomeIcons.solidStar,
  204. color: Colors.amber,
  205. size: 15.0,
  206. ),
  207. ),
  208. Container(
  209. child: Icon(
  210. FontAwesomeIcons.solidStar,
  211. color: Colors.amber,
  212. size: 15.0,
  213. ),
  214. ),
  215. Container(
  216. child: Icon(
  217. FontAwesomeIcons.solidStarHalf,
  218. color: Colors.amber,
  219. size: 15.0,
  220. ),
  221. ),
  222. Container(
  223. child: Text(
  224. "(946)",
  225. style: TextStyle(
  226. color: Colors.black54,
  227. fontSize: 18.0,
  228. ),
  229. )),
  230. ],
  231. )),
  232. SizedBox(height: 5.0),
  233. Container(
  234. child: Text(
  235. "American \u00B7 \u0024\u0024 \u00B7 1.6 mi",
  236. style: TextStyle(
  237. color: Colors.black45,
  238. fontSize: 18.0,
  239. ),
  240. )),
  241. SizedBox(height: 5.0),
  242. Container(
  243. child: Text(
  244. "American \u00B7 \u0024\u0024 \u00B7 1.6 mi",
  245. style: TextStyle(
  246. color: Colors.black54,
  247. fontSize: 18.0,
  248. ),
  249. )),
  250. Container(
  251. child: Text(
  252. "Closed \u00B7 Open 17:00 Thu",
  253. style: TextStyle(
  254. color: Colors.black54,
  255. fontSize: 18.0,
  256. fontWeight: FontWeight.bold),
  257. ),
  258. ),
  259. ],
  260. );
  261. }
  262.  
  263. Widget _buildGoogleMap(BuildContext context) {
  264. return Container(
  265. height: MediaQuery.of(context).size.height,
  266. width: MediaQuery.of(context).size.width,
  267. child: GoogleMap(
  268. mapType: MapType.normal,
  269. initialCameraPosition: CameraPosition(target: LatLng(16.9284, 96.2346), zoom: 12),
  270. onMapCreated: (GoogleMapController controller) {
  271. _controller.complete(controller);
  272. },
  273. markers: {
  274. ygn1Marker,ygn2Marker,ygn3Marker,gramercyMarker,bernardinMarker,blueMarker
  275. },
  276. ),
  277. );
  278. }
  279.  
  280. Future<void> _gotoLocation(double lat,double long) async {
  281. final GoogleMapController controller = await _controller.future;
  282. controller.animateCamera(CameraUpdate.newCameraPosition(CameraPosition(target: LatLng(lat, long), zoom: 15,tilt: 50.0,
  283. bearing: 45.0,)));
  284. }
  285. }
  286.  
  287. Marker gramercyMarker = Marker(
  288. markerId: MarkerId('gramercy'),
  289. position: LatLng(16.9284, 96.2346),
  290. infoWindow: InfoWindow(title: 'Gramercy Tavern'),
  291. icon: BitmapDescriptor.defaultMarkerWithHue(
  292. BitmapDescriptor.hueViolet,
  293. ),
  294. );
  295.  
  296. Marker bernardinMarker = Marker(
  297. markerId: MarkerId('bernardin'),
  298. position: LatLng(16.8360031,96.1332521),
  299. infoWindow: InfoWindow(title: 'MHTi'),
  300. icon: BitmapDescriptor.defaultMarkerWithHue(
  301. BitmapDescriptor.hueViolet,
  302. ),
  303. );
  304.  
  305. Marker blueMarker = Marker(
  306. markerId: MarkerId('bluehill'),
  307. position: LatLng(16.8293115,96.1549398), // s e do na
  308. infoWindow: InfoWindow(title: 'Sedona Hotel'),
  309. icon: BitmapDescriptor.defaultMarkerWithHue(
  310. BitmapDescriptor.hueViolet,class PointApp extends StatefulWidget {
  311. @override
  312. PointAppState createState() => PointAppState();
  313. }
  314.  
  315. class PointAppState extends State<PointApp> {
  316. Completer<GoogleMapController> _controller = Completer();
  317.  
  318. @override
  319. void initState() {
  320. super.initState();
  321. }
  322. double zoomVal = 5.0;
  323.  
  324. @override
  325. Widget build(BuildContext context) {
  326. return Scaffold(
  327. appBar: AppBar(
  328. leading: IconButton(
  329. icon: Icon(FontAwesomeIcons.arrowLeft),
  330. onPressed: () {
  331. Navigator.push(
  332. context,
  333. MaterialPageRoute(builder: (context) => NavigationDrawerDemo()),
  334. );
  335. },),
  336. title: Text("Yangon"),
  337. actions: <Widget>[
  338. IconButton(
  339. icon: Icon(FontAwesomeIcons.search),
  340. onPressed: () {
  341. //Need to Route n add Search Page
  342. }),
  343. ],
  344. ),
  345. body: Stack(
  346. children: <Widget>[
  347. _buildGoogleMap(context),
  348. _zoominusfunction(),
  349. _zoomplusfunction(),
  350. _buildContainer(),
  351. ],
  352. ),
  353. );
  354. }
  355.  
  356. Widget _zoominusfunction() {
  357. return Align(
  358. alignment: Alignment.topLeft,
  359. child: IconButton(
  360. icon: Icon(FontAwesomeIcons.searchMinus,color:Color(0xff6200ee)),
  361. onPressed: () {
  362. zoomVal--;
  363. _minus(zoomVal);
  364. }),
  365. );
  366. }
  367.  
  368. Widget _zoomplusfunction() {
  369. return Align(
  370. alignment: Alignment.topRight,
  371. child: IconButton(
  372. icon: Icon(FontAwesomeIcons.searchPlus,color:Color(0xff6200ee)),
  373. onPressed: () {
  374. zoomVal++;
  375. _plus(zoomVal);
  376. }),
  377. );
  378. }
  379. // for _minus Func
  380. Future<void> _minus(double zoomVal) async {
  381. final GoogleMapController controller = await _controller.future;
  382. controller.animateCamera(CameraUpdate.newCameraPosition(CameraPosition(target: LatLng(16.9284, 96.2346), zoom: zoomVal)));
  383. }
  384. Future<void> _plus(double zoomVal) async {
  385. final GoogleMapController controller = await _controller.future;
  386. controller.animateCamera(CameraUpdate.newCameraPosition(CameraPosition(target: LatLng(17.132582, 96.141762), zoom: zoomVal)));
  387. }
  388. // this method create Wid of Slide var
  389. Widget _buildContainer() {
  390. return Align(
  391. alignment: Alignment.bottomLeft,
  392. child: Container(
  393. margin: EdgeInsets.symmetric(vertical: 20.0),
  394. height: 150.0,
  395. child: ListView(
  396. scrollDirection: Axis.horizontal,
  397. children: <Widget>[
  398. SizedBox(width: 10.0),
  399. Padding(
  400. padding: const EdgeInsets.all(8.0),
  401. child: _boxes(
  402. "https://lh5.googleusercontent.com/p/AF1QipPcBXXmL5oczBzicqAhoQkzsX5SfOqVqmPlOlvQ=w225-h160-k-no",
  403. 16.8360031,96.1332521, "MHTi"),
  404. ),
  405. SizedBox(width: 10.0),
  406. Padding(
  407. padding: const EdgeInsets.all(8.0),
  408. child: _boxes(
  409. "https://lh5.googleusercontent.com/p/AF1QipMKRN-1zTYMUVPrH-CcKzfTo6Nai7wdL7D8PMkt=w340-h160-k-no",
  410. 16.7984618,96.1490159, "Shwe Dagon Pagoda"),
  411. ),
  412. SizedBox(width: 10.0),
  413. Padding(
  414. padding: const EdgeInsets.all(8.0),
  415. child: _boxes(
  416. "https://images.unsplash.com/photo-1504940892017-d23b9053d5d4?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=60",
  417. 16.7783961,96.1532603, "BoGyoke Zay"),
  418. ),
  419. ],
  420. ),
  421. ),
  422. );
  423. }
  424. // box wid get goes h3r3
  425. Widget _boxes(String _image, double lat,double long,String pagodaName) {
  426. return GestureDetector(
  427. onTap: () {
  428. _gotoLocation(lat,long);
  429. },
  430. child: Container(
  431. child: new FittedBox(
  432. child: Material(
  433. color: Colors.white10,
  434. elevation: 14.0,
  435. borderRadius: BorderRadius.circular(24.0),
  436. shadowColor: Color(0x802196F3),
  437. child: Row(
  438. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  439. children: <Widget>[
  440. Container(
  441. width: 180,
  442. height: 200,
  443. child: ClipRRect(
  444. borderRadius: new BorderRadius.circular(24.0),
  445. child: Image(
  446. fit: BoxFit.fill,
  447. image: NetworkImage(_image),
  448. ),
  449. ),
  450. ),
  451. Container(
  452. child: Padding(
  453. padding: const EdgeInsets.all(8.0),
  454. child: myDetailsContainer1(pagodaName),
  455. ),
  456. ),
  457. ],
  458. ),
  459. ),
  460. ),
  461. ),
  462. );
  463. }
  464.  
  465. Widget myDetailsContainer1(String pagodaName) {
  466. return Column(
  467. mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  468. children: <Widget>[
  469. Padding(
  470. padding: const EdgeInsets.only(left: 8.0),
  471. child: Container(
  472. child: Text(pagodaName,
  473. style: TextStyle(
  474. color: Color(0xff6200ee),
  475. fontSize: 24.0,
  476. fontWeight: FontWeight.bold),
  477. )),
  478. ),
  479. SizedBox(height: 5.0),
  480. Container(
  481. child: Row(
  482. mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  483. children: <Widget>[
  484. Container(
  485. child: Text(
  486. "4.1",
  487. style: TextStyle(
  488. color: Colors.black54,
  489. fontSize: 18.0,
  490. ),
  491. )),
  492. Container(
  493. child: Icon(
  494. FontAwesomeIcons.solidStar,
  495. color: Colors.amber,
  496. size: 15.0,
  497. ),
  498. ),
  499. Container(
  500. child: Icon(
  501. FontAwesomeIcons.solidStar,
  502. color: Colors.amber,
  503. size: 15.0,
  504. ),
  505. ),
  506. Container(
  507. child: Icon(
  508. FontAwesomeIcons.solidStar,
  509. color: Colors.amber,
  510. size: 15.0,
  511. ),
  512. ),
  513. Container(
  514. child: Icon(
  515. FontAwesomeIcons.solidStar,
  516. color: Colors.amber,
  517. size: 15.0,
  518. ),
  519. ),
  520. Container(
  521. child: Icon(
  522. FontAwesomeIcons.solidStarHalf,
  523. color: Colors.amber,
  524. size: 15.0,
  525. ),
  526. ),
  527. Container(
  528. child: Text(
  529. "(946)",
  530. style: TextStyle(
  531. color: Colors.black54,
  532. fontSize: 18.0,
  533. ),
  534. )),
  535. ],
  536. )),
  537. SizedBox(height: 5.0),
  538. Container(
  539. child: Text(
  540. "American \u00B7 \u0024\u0024 \u00B7 1.6 mi",
  541. style: TextStyle(
  542. color: Colors.black45,
  543. fontSize: 18.0,
  544. ),
  545. )),
  546. SizedBox(height: 5.0),
  547. Container(
  548. child: Text(
  549. "American \u00B7 \u0024\u0024 \u00B7 1.6 mi",
  550. style: TextStyle(
  551. color: Colors.black54,
  552. fontSize: 18.0,
  553. ),
  554. )),
  555. Container(
  556. child: Text(
  557. "Closed \u00B7 Open 17:00 Thu",
  558. style: TextStyle(
  559. color: Colors.black54,
  560. fontSize: 18.0,
  561. fontWeight: FontWeight.bold),
  562. ),
  563. ),
  564. ],
  565. );
  566. }
  567.  
  568. Widget _buildGoogleMap(BuildContext context) {
  569. return Container(
  570. height: MediaQuery.of(context).size.height,
  571. width: MediaQuery.of(context).size.width,
  572. child: GoogleMap(
  573. mapType: MapType.normal,
  574. initialCameraPosition: CameraPosition(target: LatLng(16.9284, 96.2346), zoom: 12),
  575. onMapCreated: (GoogleMapController controller) {
  576. _controller.complete(controller);
  577. },
  578. markers: {
  579. ygn1Marker,ygn2Marker,ygn3Marker,gramercyMarker,bernardinMarker,blueMarker
  580. },
  581. ),
  582. );
  583. }
  584.  
  585. Future<void> _gotoLocation(double lat,double long) async {
  586. final GoogleMapController controller = await _controller.future;
  587. controller.animateCamera(CameraUpdate.newCameraPosition(CameraPosition(target: LatLng(lat, long), zoom: 15,tilt: 50.0,
  588. bearing: 45.0,)));
  589. }
  590. }
  591.  
  592. Marker gramercyMarker = Marker(
  593. markerId: MarkerId('gramercy'),
  594. position: LatLng(16.9284, 96.2346),
  595. infoWindow: InfoWindow(title: 'Gramercy Tavern'),
  596. icon: BitmapDescriptor.defaultMarkerWithHue(
  597. BitmapDescriptor.hueViolet,
  598. ),
  599. );
  600.  
  601. Marker bernardinMarker = Marker(
  602. markerId: MarkerId('bernardin'),
  603. position: LatLng(16.8360031,96.1332521),
  604. infoWindow: InfoWindow(title: 'MHTi'),
  605. icon: BitmapDescriptor.defaultMarkerWithHue(
  606. BitmapDescriptor.hueViolet,
  607. ),
  608. );
  609.  
  610. Marker blueMarker = Marker(
  611. markerId: MarkerId('bluehill'),
  612. position: LatLng(16.8293115,96.1549398), // s e do na
  613. infoWindow: InfoWindow(title: 'Sedona Hotel'),
  614. icon: BitmapDescriptor.defaultMarkerWithHue(
  615. BitmapDescriptor.hueViolet,
  616. ),
  617. );
  618.  
  619. Marker ygn1Marker = Marker(
  620. markerId: MarkerId('ygn1Marker'),
  621. position: LatLng(17.132582, 96.141762),
  622. infoWindow: InfoWindow(title: 'MHT Institute'),
  623. icon: BitmapDescriptor.defaultMarkerWithHue(
  624. BitmapDescriptor.hueViolet,
  625. ),
  626. );
  627.  
  628. Marker ygn2Marker = Marker(
  629. markerId: MarkerId('ygn2Marker'),class PointApp extends StatefulWidget {
  630. @override
  631. PointAppState createState() => PointAppState();
  632. }
  633.  
  634. class PointAppState extends State<PointApp> {
  635. Completer<GoogleMapController> _controller = Completer();
  636.  
  637. @override
  638. void initState() {
  639. super.initState();
  640. }
  641. double zoomVal = 5.0;
  642.  
  643. @override
  644. Widget build(BuildContext context) {
  645. return Scaffold(
  646. appBar: AppBar(
  647. leading: IconButton(
  648. icon: Icon(FontAwesomeIcons.arrowLeft),
  649. onPressed: () {
  650. Navigator.push(
  651. context,
  652. MaterialPageRoute(builder: (context) => NavigationDrawerDemo()),
  653. );
  654. },),
  655. title: Text("Yangon"),
  656. actions: <Widget>[
  657. IconButton(
  658. icon: Icon(FontAwesomeIcons.search),
  659. onPressed: () {
  660. //Need to Route n add Search Page
  661. }),
  662. ],
  663. ),
  664. body: Stack(
  665. children: <Widget>[
  666. _buildGoogleMap(context),
  667. _zoominusfunction(),
  668. _zoomplusfunction(),
  669. _buildContainer(),
  670. ],
  671. ),
  672. );
  673. }
  674.  
  675. Widget _zoominusfunction() {
  676. return Align(
  677. alignment: Alignment.topLeft,
  678. child: IconButton(
  679. icon: Icon(FontAwesomeIcons.searchMinus,color:Color(0xff6200ee)),
  680. onPressed: () {
  681. zoomVal--;
  682. _minus(zoomVal);
  683. }),
  684. );
  685. }
  686.  
  687. Widget _zoomplusfunction() {
  688. return Align(
  689. alignment: Alignment.topRight,
  690. child: IconButton(
  691. icon: Icon(FontAwesomeIcons.searchPlus,color:Color(0xff6200ee)),
  692. onPressed: () {
  693. zoomVal++;
  694. _plus(zoomVal);
  695. }),
  696. );
  697. }
  698. // for _minus Func
  699. Future<void> _minus(double zoomVal) async {
  700. final GoogleMapController controller = await _controller.future;
  701. controller.animateCamera(CameraUpdate.newCameraPosition(CameraPosition(target: LatLng(16.9284, 96.2346), zoom: zoomVal)));
  702. }
  703. Future<void> _plus(double zoomVal) async {
  704. final GoogleMapController controller = await _controller.future;
  705. controller.animateCamera(CameraUpdate.newCameraPosition(CameraPosition(target: LatLng(17.132582, 96.141762), zoom: zoomVal)));
  706. }
  707. // this method create Wid of Slide var
  708. Widget _buildContainer() {
  709. return Align(
  710. alignment: Alignment.bottomLeft,
  711. child: Container(
  712. margin: EdgeInsets.symmetric(vertical: 20.0),
  713. height: 150.0,
  714. child: ListView(
  715. scrollDirection: Axis.horizontal,
  716. children: <Widget>[
  717. SizedBox(width: 10.0),
  718. Padding(
  719. padding: const EdgeInsets.all(8.0),
  720. child: _boxes(
  721. "https://lh5.googleusercontent.com/p/AF1QipPcBXXmL5oczBzicqAhoQkzsX5SfOqVqmPlOlvQ=w225-h160-k-no",
  722. 16.8360031,96.1332521, "MHTi"),
  723. ),
  724. SizedBox(width: 10.0),
  725. Padding(
  726. padding: const EdgeInsets.all(8.0),
  727. child: _boxes(
  728. "https://lh5.googleusercontent.com/p/AF1QipMKRN-1zTYMUVPrH-CcKzfTo6Nai7wdL7D8PMkt=w340-h160-k-no",
  729. 16.7984618,96.1490159, "Shwe Dagon Pagoda"),
  730. ),
  731. SizedBox(width: 10.0),
  732. Padding(
  733. padding: const EdgeInsets.all(8.0),
  734. child: _boxes(
  735. "https://images.unsplash.com/photo-1504940892017-d23b9053d5d4?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=60",
  736. 16.7783961,96.1532603, "BoGyoke Zay"),
  737. ),
  738. ],
  739. ),
  740. ),
  741. );
  742. }
  743. // box wid get goes h3r3
  744. Widget _boxes(String _image, double lat,double long,String pagodaName) {
  745. return GestureDetector(
  746. onTap: () {
  747. _gotoLocation(lat,long);
  748. },
  749. child: Container(
  750. child: new FittedBox(
  751. child: Material(
  752. color: Colors.white10,
  753. elevation: 14.0,
  754. borderRadius: BorderRadius.circular(24.0),
  755. shadowColor: Color(0x802196F3),
  756. child: Row(
  757. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  758. children: <Widget>[
  759. Container(
  760. width: 180,
  761. height: 200,
  762. child: ClipRRect(
  763. borderRadius: new BorderRadius.circular(24.0),
  764. child: Image(
  765. fit: BoxFit.fill,
  766. image: NetworkImage(_image),
  767. ),
  768. ),
  769. ),
  770. Container(
  771. child: Padding(
  772. padding: const EdgeInsets.all(8.0),
  773. child: myDetailsContainer1(pagodaName),
  774. ),
  775. ),
  776. ],
  777. ),
  778. ),
  779. ),
  780. ),
  781. );
  782. }
  783.  
  784. Widget myDetailsContainer1(String pagodaName) {
  785. return Column(
  786. mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  787. children: <Widget>[
  788. Padding(
  789. padding: const EdgeInsets.only(left: 8.0),
  790. child: Container(
  791. child: Text(pagodaName,
  792. style: TextStyle(
  793. color: Color(0xff6200ee),
  794. fontSize: 24.0,
  795. fontWeight: FontWeight.bold),
  796. )),
  797. ),
  798. SizedBox(height: 5.0),
  799. Container(
  800. child: Row(
  801. mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  802. children: <Widget>[
  803. Container(
  804. child: Text(
  805. "4.1",
  806. style: TextStyle(
  807. color: Colors.black54,
  808. fontSize: 18.0,
  809. ),
  810. )),
  811. Container(
  812. child: Icon(
  813. FontAwesomeIcons.solidStar,
  814. color: Colors.amber,
  815. size: 15.0,
  816. ),
  817. ),
  818. Container(
  819. child: Icon(
  820. FontAwesomeIcons.solidStar,
  821. color: Colors.amber,
  822. size: 15.0,
  823. ),
  824. ),
  825. Container(
  826. child: Icon(
  827. FontAwesomeIcons.solidStar,
  828. color: Colors.amber,
  829. size: 15.0,
  830. ),
  831. ),
  832. Container(
  833. child: Icon(
  834. FontAwesomeIcons.solidStar,
  835. color: Colors.amber,
  836. size: 15.0,
  837. ),
  838. ),
  839. Container(
  840. child: Icon(
  841. FontAwesomeIcons.solidStarHalf,
  842. color: Colors.amber,
  843. size: 15.0,
  844. ),
  845. ),
  846. Container(
  847. child: Text(
  848. "(946)",
  849. style: TextStyle(
  850. color: Colors.black54,
  851. fontSize: 18.0,
  852. ),
  853. )),
  854. ],
  855. )),
  856. SizedBox(height: 5.0),
  857. Container(
  858. child: Text(
  859. "American \u00B7 \u0024\u0024 \u00B7 1.6 mi",
  860. style: TextStyle(
  861. color: Colors.black45,
  862. fontSize: 18.0,
  863. ),
  864. )),
  865. SizedBox(height: 5.0),
  866. Container(
  867. child: Text(
  868. "American \u00B7 \u0024\u0024 \u00B7 1.6 mi",
  869. style: TextStyle(
  870. color: Colors.black54,
  871. fontSize: 18.0,
  872. ),
  873. )),
  874. Container(
  875. child: Text(
  876. "Closed \u00B7 Open 17:00 Thu",
  877. style: TextStyle(
  878. color: Colors.black54,
  879. fontSize: 18.0,
  880. fontWeight: FontWeight.bold),
  881. ),
  882. ),
  883. ],
  884. );
  885. }
  886.  
  887. Widget _buildGoogleMap(BuildContext context) {
  888. return Container(
  889. height: MediaQuery.of(context).size.height,
  890. width: MediaQuery.of(context).size.width,
  891. child: GoogleMap(
  892. mapType: MapType.normal,
  893. initialCameraPosition: CameraPosition(target: LatLng(16.9284, 96.2346), zoom: 12),
  894. onMapCreated: (GoogleMapController controller) {
  895. _controller.complete(controller);
  896. },
  897. markers: {
  898. ygn1Marker,ygn2Marker,ygn3Marker,gramercyMarker,bernardinMarker,blueMarker
  899. },
  900. ),
  901. );
  902. }
  903.  
  904. Future<void> _gotoLocation(double lat,double long) async {
  905. final GoogleMapController controller = await _controller.future;
  906. controller.animateCamera(CameraUpdate.newCameraPosition(CameraPosition(target: LatLng(lat, long), zoom: 15,tilt: 50.0,
  907. bearing: 45.0,)));
  908. }
  909. }
  910.  
  911. Marker gramercyMarker = Marker(
  912. markerId: MarkerId('gramercy'),
  913. position: LatLng(16.9284, 96.2346),
  914. infoWindow: InfoWindow(title: 'Gramercy Tavern'),
  915. icon: BitmapDescriptor.defaultMarkerWithHue(
  916. BitmapDescriptor.hueViolet,
  917. ),
  918. );
  919.  
  920. Marker bernardinMarker = Marker(
  921. markerId: MarkerId('bernardin'),
  922. position: LatLng(16.8360031,96.1332521),
  923. infoWindow: InfoWindow(title: 'MHTi'),
  924. icon: BitmapDescriptor.defaultMarkerWithHue(
  925. BitmapDescriptor.hueViolet,
  926. ),
  927. );
  928.  
  929. Marker blueMarker = Marker(
  930. markerId: MarkerId('bluehill'),
  931. position: LatLng(16.8293115,96.1549398), // s e do na
  932. infoWindow: InfoWindow(title: 'Sedona Hotel'),
  933. icon: BitmapDescriptor.defaultMarkerWithHue(
  934. BitmapDescriptor.hueViolet,
  935. ),
  936. );
  937.  
  938. Marker ygn1Marker = Marker(
  939. markerId: MarkerId('ygn1Marker'),
  940. position: LatLng(17.132582, 96.141762),
  941. infoWindow: InfoWindow(title: 'MHT Institute'),
  942. icon: BitmapDescriptor.defaultMarkerWithHue(
  943. BitmapDescriptor.hueViolet,
  944. ),
  945. );
  946.  
  947. Marker ygn2Marker = Marker(
  948. markerId: MarkerId('ygn2Marker'),
  949. position: LatLng(16.8293115,96.1549398),
  950. infoWindow: InfoWindow(title: 'Sedona 2'),class PointApp extends StatefulWidget {
  951. @override
  952. PointAppState createState() => PointAppState();
  953. }
  954.  
  955. class PointAppState extends State<PointApp> {
  956. Completer<GoogleMapController> _controller = Completer();
  957.  
  958. @override
  959. void initState() {
  960. super.initState();
  961. }
  962. double zoomVal = 5.0;
  963.  
  964. @override
  965. Widget build(BuildContext context) {
  966. return Scaffold(
  967. appBar: AppBar(
  968. leading: IconButton(
  969. icon: Icon(FontAwesomeIcons.arrowLeft),
  970. onPressed: () {
  971. Navigator.push(
  972. context,
  973. MaterialPageRoute(builder: (context) => NavigationDrawerDemo()),
  974. );
  975. },),
  976. title: Text("Yangon"),
  977. actions: <Widget>[
  978. IconButton(
  979. icon: Icon(FontAwesomeIcons.search),
  980. onPressed: () {
  981. //Need to Route n add Search Page
  982. }),
  983. ],
  984. ),
  985. body: Stack(
  986. children: <Widget>[
  987. _buildGoogleMap(context),
  988. _zoominusfunction(),
  989. _zoomplusfunction(),
  990. _buildContainer(),
  991. ],
  992. ),
  993. );
  994. }
  995.  
  996. Widget _zoominusfunction() {
  997. return Align(
  998. alignment: Alignment.topLeft,
  999. child: IconButton(
  1000. icon: Icon(FontAwesomeIcons.searchMinus,color:Color(0xff6200ee)),
  1001. onPressed: () {
  1002. zoomVal--;
  1003. _minus(zoomVal);
  1004. }),
  1005. );
  1006. }
  1007.  
  1008. Widget _zoomplusfunction() {
  1009. return Align(
  1010. alignment: Alignment.topRight,
  1011. child: IconButton(
  1012. icon: Icon(FontAwesomeIcons.searchPlus,color:Color(0xff6200ee)),
  1013. onPressed: () {
  1014. zoomVal++;
  1015. _plus(zoomVal);
  1016. }),
  1017. );
  1018. }
  1019. // for _minus Func
  1020. Future<void> _minus(double zoomVal) async {
  1021. final GoogleMapController controller = await _controller.future;
  1022. controller.animateCamera(CameraUpdate.newCameraPosition(CameraPosition(target: LatLng(16.9284, 96.2346), zoom: zoomVal)));
  1023. }
  1024. Future<void> _plus(double zoomVal) async {
  1025. final GoogleMapController controller = await _controller.future;
  1026. controller.animateCamera(CameraUpdate.newCameraPosition(CameraPosition(target: LatLng(17.132582, 96.141762), zoom: zoomVal)));
  1027. }
  1028. // this method create Wid of Slide var
  1029. Widget _buildContainer() {
  1030. return Align(
  1031. alignment: Alignment.bottomLeft,
  1032. child: Container(
  1033. margin: EdgeInsets.symmetric(vertical: 20.0),
  1034. height: 150.0,
  1035. child: ListView(
  1036. scrollDirection: Axis.horizontal,
  1037. children: <Widget>[
  1038. SizedBox(width: 10.0),
  1039. Padding(
  1040. padding: const EdgeInsets.all(8.0),
  1041. child: _boxes(
  1042. "https://lh5.googleusercontent.com/p/AF1QipPcBXXmL5oczBzicqAhoQkzsX5SfOqVqmPlOlvQ=w225-h160-k-no",
  1043. 16.8360031,96.1332521, "MHTi"),
  1044. ),
  1045. SizedBox(width: 10.0),
  1046. Padding(
  1047. padding: const EdgeInsets.all(8.0),
  1048. child: _boxes(
  1049. "https://lh5.googleusercontent.com/p/AF1QipMKRN-1zTYMUVPrH-CcKzfTo6Nai7wdL7D8PMkt=w340-h160-k-no",
  1050. 16.7984618,96.1490159, "Shwe Dagon Pagoda"),
  1051. ),
  1052. SizedBox(width: 10.0),
  1053. Padding(
  1054. padding: const EdgeInsets.all(8.0),
  1055. child: _boxes(
  1056. "https://images.unsplash.com/photo-1504940892017-d23b9053d5d4?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=60",
  1057. 16.7783961,96.1532603, "BoGyoke Zay"),
  1058. ),
  1059. ],
  1060. ),
  1061. ),
  1062. );
  1063. }
  1064. // box wid get goes h3r3
  1065. Widget _boxes(String _image, double lat,double long,String pagodaName) {
  1066. return GestureDetector(
  1067. onTap: () {
  1068. _gotoLocation(lat,long);
  1069. },
  1070. child: Container(
  1071. child: new FittedBox(
  1072. child: Material(
  1073. color: Colors.white10,
  1074. elevation: 14.0,
  1075. borderRadius: BorderRadius.circular(24.0),
  1076. shadowColor: Color(0x802196F3),
  1077. child: Row(
  1078. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  1079. children: <Widget>[
  1080. Container(
  1081. width: 180,
  1082. height: 200,
  1083. child: ClipRRect(
  1084. borderRadius: new BorderRadius.circular(24.0),
  1085. child: Image(
  1086. fit: BoxFit.fill,
  1087. image: NetworkImage(_image),
  1088. ),
  1089. ),
  1090. ),
  1091. Container(
  1092. child: Padding(
  1093. padding: const EdgeInsets.all(8.0),
  1094. child: myDetailsContainer1(pagodaName),
  1095. ),
  1096. ),
  1097. ],
  1098. ),
  1099. ),
  1100. ),
  1101. ),
  1102. );
  1103. }
  1104.  
  1105. Widget myDetailsContainer1(String pagodaName) {
  1106. return Column(
  1107. mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  1108. children: <Widget>[
  1109. Padding(
  1110. padding: const EdgeInsets.only(left: 8.0),
  1111. child: Container(
  1112. child: Text(pagodaName,
  1113. style: TextStyle(
  1114. color: Color(0xff6200ee),
  1115. fontSize: 24.0,
  1116. fontWeight: FontWeight.bold),
  1117. )),
  1118. ),
  1119. SizedBox(height: 5.0),
  1120. Container(
  1121. child: Row(
  1122. mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  1123. children: <Widget>[
  1124. Container(
  1125. child: Text(
  1126. "4.1",
  1127. style: TextStyle(
  1128. color: Colors.black54,
  1129. fontSize: 18.0,
  1130. ),
  1131. )),
  1132. Container(
  1133. child: Icon(
  1134. FontAwesomeIcons.solidStar,
  1135. color: Colors.amber,
  1136. size: 15.0,
  1137. ),
  1138. ),
  1139. Container(
  1140. child: Icon(
  1141. FontAwesomeIcons.solidStar,
  1142. color: Colors.amber,
  1143. size: 15.0,
  1144. ),
  1145. ),
  1146. Container(
  1147. child: Icon(
  1148. FontAwesomeIcons.solidStar,
  1149. color: Colors.amber,
  1150. size: 15.0,
  1151. ),
  1152. ),
  1153. Container(
  1154. child: Icon(
  1155. FontAwesomeIcons.solidStar,
  1156. color: Colors.amber,
  1157. size: 15.0,
  1158. ),
  1159. ),
  1160. Container(
  1161. child: Icon(
  1162. FontAwesomeIcons.solidStarHalf,
  1163. color: Colors.amber,
  1164. size: 15.0,
  1165. ),
  1166. ),
  1167. Container(
  1168. child: Text(
  1169. "(946)",
  1170. style: TextStyle(
  1171. color: Colors.black54,
  1172. fontSize: 18.0,
  1173. ),
  1174. )),
  1175. ],
  1176. )),
  1177. SizedBox(height: 5.0),
  1178. Container(
  1179. child: Text(
  1180. "American \u00B7 \u0024\u0024 \u00B7 1.6 mi",
  1181. style: TextStyle(
  1182. color: Colors.black45,
  1183. fontSize: 18.0,
  1184. ),
  1185. )),
  1186. SizedBox(height: 5.0),
  1187. Container(
  1188. child: Text(
  1189. "American \u00B7 \u0024\u0024 \u00B7 1.6 mi",
  1190. style: TextStyle(
  1191. color: Colors.black54,
  1192. fontSize: 18.0,
  1193. ),
  1194. )),
  1195. Container(
  1196. child: Text(
  1197. "Closed \u00B7 Open 17:00 Thu",
  1198. style: TextStyle(
  1199. color: Colors.black54,
  1200. fontSize: 18.0,
  1201. fontWeight: FontWeight.bold),
  1202. ),
  1203. ),
  1204. ],
  1205. );
  1206. }
  1207.  
  1208. Widget _buildGoogleMap(BuildContext context) {
  1209. return Container(
  1210. height: MediaQuery.of(context).size.height,
  1211. width: MediaQuery.of(context).size.width,
  1212. child: GoogleMap(
  1213. mapType: MapType.normal,
  1214. initialCameraPosition: CameraPosition(target: LatLng(16.9284, 96.2346), zoom: 12),
  1215. onMapCreated: (GoogleMapController controller) {
  1216. _controller.complete(controller);
  1217. },
  1218. markers: {
  1219. ygn1Marker,ygn2Marker,ygn3Marker,gramercyMarker,bernardinMarker,blueMarker
  1220. },
  1221. ),
  1222. );
  1223. }
  1224.  
  1225. Future<void> _gotoLocation(double lat,double long) async {
  1226. final GoogleMapController controller = await _controller.future;
  1227. controller.animateCamera(CameraUpdate.newCameraPosition(CameraPosition(target: LatLng(lat, long), zoom: 15,tilt: 50.0,
  1228. bearing: 45.0,)));
  1229. }
  1230. }
  1231.  
  1232. Marker gramercyMarker = Marker(
  1233. markerId: MarkerId('gramercy'),
  1234. position: LatLng(16.9284, 96.2346),
  1235. infoWindow: InfoWindow(title: 'Gramercy Tavern'),
  1236. icon: BitmapDescriptor.defaultMarkerWithHue(
  1237. BitmapDescriptor.hueViolet,
  1238. ),
  1239. );
  1240.  
  1241. Marker bernardinMarker = Marker(
  1242. markerId: MarkerId('bernardin'),
  1243. position: LatLng(16.8360031,96.1332521),
  1244. infoWindow: InfoWindow(title: 'MHTi'),
  1245. icon: BitmapDescriptor.defaultMarkerWithHue(
  1246. BitmapDescriptor.hueViolet,
  1247. ),
  1248. );
  1249.  
  1250. Marker blueMarker = Marker(
  1251. markerId: MarkerId('bluehill'),
  1252. position: LatLng(16.8293115,96.1549398), // s e do na
  1253. infoWindow: InfoWindow(title: 'Sedona Hotel'),
  1254. icon: BitmapDescriptor.defaultMarkerWithHue(
  1255. BitmapDescriptor.hueViolet,
  1256. ),
  1257. );
  1258.  
  1259. Marker ygn1Marker = Marker(
  1260. markerId: MarkerId('ygn1Marker'),
  1261. position: LatLng(17.132582, 96.141762),
  1262. infoWindow: InfoWindow(title: 'MHT Institute'),
  1263. icon: BitmapDescriptor.defaultMarkerWithHue(
  1264. BitmapDescriptor.hueViolet,
  1265. ),
  1266. );
  1267.  
  1268. Marker ygn2Marker = Marker(
  1269. markerId: MarkerId('ygn2Marker'),
  1270. position: LatLng(16.8293115,96.1549398),
  1271. infoWindow: InfoWindow(title: 'Sedona 2'),
  1272. icon: BitmapDescriptor.defaultMarkerWithHue(
  1273. BitmapDescriptor.hueViolet,
  1274. ),
  1275. );
  1276.  
  1277. Marker ygn3Marker = Marker(
  1278. markerId: MarkerId('ygn3Marker'),
  1279. position: LatLng(16.8092588,96.1593468),
  1280. infoWindow: InfoWindow(title: 'Tarmwe Township'),
  1281. icon: BitmapDescriptor.defaultMarkerWithHue(
  1282. BitmapDescriptor.hueViolet,
  1283. ),
  1284. );
  1285. icon: BitmapDescriptor.defaultMarkerWithHue(
  1286. BitmapDescriptor.hueViolet,
  1287. ),
  1288. );
  1289.  
  1290. Marker ygn3Marker = Marker(
  1291. markerId: MarkerId('ygn3Marker'),
  1292. position: LatLng(16.8092588,96.1593468),
  1293. infoWindow: InfoWindow(title: 'Tarmwe Township'),
  1294. icon: BitmapDescriptor.defaultMarkerWithHue(
  1295. BitmapDescriptor.hueViolet,
  1296. ),
  1297. );
  1298. position: LatLng(16.8293115,96.1549398),
  1299. infoWindow: InfoWindow(title: 'Sedona 2'),
  1300. icon: BitmapDescriptor.defaultMarkerWithHue(
  1301. BitmapDescriptor.hueViolet,
  1302. ),
  1303. );
  1304.  
  1305. Marker ygn3Marker = Marker(
  1306. markerId: MarkerId('ygn3Marker'),
  1307. position: LatLng(16.8092588,96.1593468),
  1308. infoWindow: InfoWindow(title: 'Tarmwe Township'),
  1309. icon: BitmapDescriptor.defaultMarkerWithHue(
  1310. BitmapDescriptor.hueViolet,
  1311. ),
  1312. );
  1313. ),
  1314. );
  1315.  
  1316. Marker ygn1Marker = Marker(
  1317. markerId: MarkerId('ygn1Marker'),
  1318. position: LatLng(17.132582, 96.141762),
  1319. infoWindow: InfoWindow(title: 'MHT Institute'),
  1320. icon: BitmapDescriptor.defaultMarkerWithHue(
  1321. BitmapDescriptor.hueViolet,
  1322. ),
  1323. );
  1324.  
  1325. Marker ygn2Marker = Marker(
  1326. markerId: MarkerId('ygn2Marker'),
  1327. position: LatLng(16.8293115,96.1549398),
  1328. infoWindow: InfoWindow(title: 'Sedona 2'),
  1329. icon: BitmapDescriptor.defaultMarkerWithHue(
  1330. BitmapDescriptor.hueViolet,
  1331. ),
  1332. );
  1333.  
  1334. Marker ygn3Marker = Marker(
  1335. markerId: MarkerId('ygn3Marker'),
  1336. position: LatLng(16.8092588,96.1593468),
  1337. infoWindow: InfoWindow(title: 'Tarmwe Township'),
  1338. icon: BitmapDescriptor.defaultMarkerWithHue(
  1339. BitmapDescriptor.hueViolet,
  1340. ),
  1341. );
Add Comment
Please, Sign In to add comment