Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import 'dart:async';
- import 'package:flutter/material.dart';
- import 'package:google_maps_flutter/google_maps_flutter.dart';
- class MyApp extends StatefulWidget {
- @override
- _MyAppState createState() => _MyAppState();
- }
- class _MyAppState extends State<MyApp> {
- Completer<GoogleMapController> _controller = Completer();
- static const LatLng _center = const LatLng(45.521563, -122.677433);
- final Set<Marker> _markers = Set<Marker>();
- final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
- VoidCallback _showBottomSheetCallback;
- @override
- void initState() {
- super.initState();
- _showBottomSheetCallback = _showBottomSheet;
- }
- void _showBottomSheet() {
- setState(() { // disable the button
- _showBottomSheetCallback = null;
- });
- _scaffoldKey.currentState.showBottomSheet<void>((BuildContext context) {
- final ThemeData themeData = Theme.of(context);
- return Container(
- decoration: BoxDecoration(
- border: Border(top: BorderSide(color: themeData.disabledColor))
- ),
- child: Padding(
- padding: const EdgeInsets.all(32.0),
- child: Text('This is a Material persistent bottom sheet. Drag downwards to dismiss it.',
- textAlign: TextAlign.center,
- style: TextStyle(
- color: themeData.accentColor,
- fontSize: 24.0,
- ),
- ),
- ),
- );
- })
- .closed.whenComplete(() {
- if (mounted) {
- setState(() { // re-enable the button
- _showBottomSheetCallback = _showBottomSheet;
- });
- }
- });
- }
- void _showMessage() {
- showDialog<void>(
- context: context,
- builder: (BuildContext context) {
- return AlertDialog(
- content: const Text('You tapped the floating action button.'),
- actions: <Widget>[
- FlatButton(
- onPressed: () {
- Navigator.pop(context);
- },
- child: const Text('OK'),
- ),
- ],
- );
- },
- );
- }
- void _onMapCreated(GoogleMapController controller) {
- this._markers.add(Marker(
- // This marker id can be anything that uniquely identifies each marker.
- markerId: MarkerId("asdas"),
- position: LatLng(45.521563, -122.677433),
- infoWindow: InfoWindow(
- title: 'Really cool place',
- snippet: '5 Star Rating',
- ),
- icon: BitmapDescriptor.defaultMarkerWithHue(1.0),
- ));
- _controller.complete(controller);
- }
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- key: _scaffoldKey,
- appBar: AppBar(
- leading: Builder(
- builder: (BuildContext context) {
- return IconButton(
- icon: const Icon(Icons.menu),
- onPressed: () { Scaffold.of(context).openDrawer(); },
- tooltip: MaterialLocalizations.of(context).openAppDrawerTooltip,
- );
- },
- ),
- title: Text('Locales'),
- actions: <Widget>[
- IconButton(
- icon: Icon(Icons.favorite_border),
- tooltip: 'Favorito',
- onPressed: () {
- // ...
- },
- ),
- ],
- ),
- body: Column(
- children: <Widget>[
- Container(
- color: Theme.of(context).primaryColor,
- child: Container(
- margin: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 14.0),
- decoration: new BoxDecoration(
- border: new Border.all(color: Colors.white),
- borderRadius: BorderRadius.all(Radius.circular(4.0)),
- color: Theme.of(context).primaryColor,
- ),
- child: Padding(
- padding: const EdgeInsets.all(8.0),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: <Widget>[
- Text(
- 'Buscar por zona',
- style: TextStyle(
- color: Colors.white,
- fontFamily: 'Google',
- ),
- ),
- Icon(
- Icons.search,
- color: Colors.white,
- ),
- ],
- ),
- ),
- ),
- ),
- Flexible(
- flex: 3,
- child: GoogleMap(
- markers: _markers,
- onMapCreated: _onMapCreated,
- initialCameraPosition: CameraPosition(
- target: _center,
- zoom: 11.0,
- ),
- ),
- ),
- Draggable(
- axis: Axis.vertical,
- child: Container(
- color: Colors.blue,
- child: Row(
- mainAxisAlignment: MainAxisAlignment.center,
- children: <Widget>[
- Column(
- children: <Widget>[
- Icon(Icons.keyboard_arrow_up),
- Icon(Icons.keyboard_arrow_down),
- ],
- ),
- ],
- ),
- ),
- feedback: Container(
- color: Colors.blue,
- child: Row(
- mainAxisAlignment: MainAxisAlignment.center,
- children: <Widget>[
- Column(
- children: <Widget>[
- Icon(Icons.keyboard_arrow_up),
- Icon(Icons.keyboard_arrow_down),
- ],
- ),
- ],
- ),
- ),
- ),
- Expanded(
- child: Center(
- child: ListView.separated(
- separatorBuilder: (context, index) => Divider(
- height: 3.0,
- color: Colors.blue,
- indent: 8.0,
- ),
- itemCount: 8,
- itemBuilder: (BuildContext ctxt, int Index) {
- return ListTile(
- title: Text(
- 'akjsdh',
- style: TextStyle(
- color: Colors.black
- ),
- ),
- subtitle: Text('198273'),
- trailing: Icon(Icons.chevron_right),
- );
- }
- ),
- ),
- ),
- ],
- ),
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement