Advertisement
Guest User

Untitled

a guest
Apr 12th, 2019
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 6.57 KB | None | 0 0
  1. import 'dart:async';
  2.  
  3. import 'package:flutter/material.dart';
  4. import 'package:google_maps_flutter/google_maps_flutter.dart';
  5.  
  6.  
  7. class MyApp extends StatefulWidget {
  8.   @override
  9.   _MyAppState createState() => _MyAppState();
  10. }
  11.  
  12. class _MyAppState extends State<MyApp> {
  13.   Completer<GoogleMapController> _controller = Completer();
  14.  
  15.   static const LatLng _center = const LatLng(45.521563, -122.677433);
  16.   final Set<Marker> _markers = Set<Marker>();
  17.   final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
  18.  
  19.   VoidCallback _showBottomSheetCallback;
  20.  
  21.   @override
  22.   void initState() {
  23.     super.initState();
  24.     _showBottomSheetCallback = _showBottomSheet;
  25.   }
  26.  
  27.   void _showBottomSheet() {
  28.     setState(() { // disable the button
  29.       _showBottomSheetCallback = null;
  30.     });
  31.     _scaffoldKey.currentState.showBottomSheet<void>((BuildContext context) {
  32.       final ThemeData themeData = Theme.of(context);
  33.       return Container(
  34.         decoration: BoxDecoration(
  35.             border: Border(top: BorderSide(color: themeData.disabledColor))
  36.         ),
  37.         child: Padding(
  38.           padding: const EdgeInsets.all(32.0),
  39.           child: Text('This is a Material persistent bottom sheet. Drag downwards to dismiss it.',
  40.             textAlign: TextAlign.center,
  41.             style: TextStyle(
  42.               color: themeData.accentColor,
  43.               fontSize: 24.0,
  44.             ),
  45.           ),
  46.         ),
  47.       );
  48.     })
  49.         .closed.whenComplete(() {
  50.       if (mounted) {
  51.         setState(() { // re-enable the button
  52.           _showBottomSheetCallback = _showBottomSheet;
  53.         });
  54.       }
  55.     });
  56.   }
  57.  
  58.   void _showMessage() {
  59.     showDialog<void>(
  60.       context: context,
  61.       builder: (BuildContext context) {
  62.         return AlertDialog(
  63.           content: const Text('You tapped the floating action button.'),
  64.           actions: <Widget>[
  65.             FlatButton(
  66.               onPressed: () {
  67.                 Navigator.pop(context);
  68.               },
  69.               child: const Text('OK'),
  70.             ),
  71.           ],
  72.         );
  73.       },
  74.     );
  75.   }
  76.  
  77.  
  78.   void _onMapCreated(GoogleMapController controller) {
  79.     this._markers.add(Marker(
  80.       // This marker id can be anything that uniquely identifies each marker.
  81.       markerId: MarkerId("asdas"),
  82.       position: LatLng(45.521563, -122.677433),
  83.       infoWindow: InfoWindow(
  84.         title: 'Really cool place',
  85.         snippet: '5 Star Rating',
  86.       ),
  87.       icon: BitmapDescriptor.defaultMarkerWithHue(1.0),
  88.     ));
  89.     _controller.complete(controller);
  90.   }
  91.  
  92.   @override
  93.   Widget build(BuildContext context) {
  94.     return Scaffold(
  95.       key: _scaffoldKey,
  96.       appBar: AppBar(
  97.         leading: Builder(
  98.           builder: (BuildContext context) {
  99.             return IconButton(
  100.               icon: const Icon(Icons.menu),
  101.               onPressed: () { Scaffold.of(context).openDrawer(); },
  102.               tooltip: MaterialLocalizations.of(context).openAppDrawerTooltip,
  103.             );
  104.           },
  105.         ),
  106.         title: Text('Locales'),
  107.         actions: <Widget>[
  108.           IconButton(
  109.             icon: Icon(Icons.favorite_border),
  110.             tooltip: 'Favorito',
  111.             onPressed: () {
  112.               // ...
  113.             },
  114.           ),
  115.         ],
  116.       ),
  117.       body: Column(
  118.         children: <Widget>[
  119.           Container(
  120.             color: Theme.of(context).primaryColor,
  121.             child: Container(
  122.               margin: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 14.0),
  123.               decoration: new BoxDecoration(
  124.                 border: new Border.all(color: Colors.white),
  125.                 borderRadius: BorderRadius.all(Radius.circular(4.0)),
  126.                 color: Theme.of(context).primaryColor,
  127.               ),
  128.               child: Padding(
  129.                 padding: const EdgeInsets.all(8.0),
  130.                 child: Row(
  131.                   mainAxisAlignment: MainAxisAlignment.spaceBetween,
  132.                   children: <Widget>[
  133.                     Text(
  134.                       'Buscar por zona',
  135.                       style: TextStyle(
  136.                         color: Colors.white,
  137.                         fontFamily: 'Google',
  138.                       ),
  139.                     ),
  140.                     Icon(
  141.                       Icons.search,
  142.                       color: Colors.white,
  143.                     ),
  144.                   ],
  145.                 ),
  146.               ),
  147.             ),
  148.           ),
  149.           Flexible(
  150.             flex: 3,
  151.             child: GoogleMap(
  152.               markers: _markers,
  153.               onMapCreated: _onMapCreated,
  154.               initialCameraPosition: CameraPosition(
  155.                 target: _center,
  156.                 zoom: 11.0,
  157.               ),
  158.             ),
  159.           ),
  160.           Draggable(
  161.             axis: Axis.vertical,
  162.             child: Container(
  163.               color: Colors.blue,
  164.               child: Row(
  165.                 mainAxisAlignment: MainAxisAlignment.center,
  166.                 children: <Widget>[
  167.                   Column(
  168.                     children: <Widget>[
  169.                       Icon(Icons.keyboard_arrow_up),
  170.                       Icon(Icons.keyboard_arrow_down),
  171.  
  172.                     ],
  173.                   ),
  174.                 ],
  175.               ),
  176.             ),
  177.             feedback: Container(
  178.               color: Colors.blue,
  179.               child: Row(
  180.                 mainAxisAlignment: MainAxisAlignment.center,
  181.                 children: <Widget>[
  182.                   Column(
  183.                     children: <Widget>[
  184.                       Icon(Icons.keyboard_arrow_up),
  185.                       Icon(Icons.keyboard_arrow_down),
  186.  
  187.                     ],
  188.                   ),
  189.                 ],
  190.               ),
  191.             ),
  192.           ),
  193.           Expanded(
  194.             child: Center(
  195.               child: ListView.separated(
  196.                 separatorBuilder: (context, index) => Divider(
  197.                   height: 3.0,
  198.                   color: Colors.blue,
  199.                   indent: 8.0,
  200.                 ),
  201.                 itemCount: 8,
  202.                 itemBuilder: (BuildContext ctxt, int Index) {
  203.                   return ListTile(
  204.                     title: Text(
  205.                       'akjsdh',
  206.                       style: TextStyle(
  207.                           color: Colors.black
  208.                       ),
  209.                     ),
  210.                     subtitle: Text('198273'),
  211.                     trailing: Icon(Icons.chevron_right),
  212.                   );
  213.                 }
  214.               ),
  215.             ),
  216.           ),
  217.         ],
  218.       ),
  219.     );
  220.   }
  221. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement