Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Flutter 颤振firebase I/BufferBuffer:插槽0已丢弃,句柄=0x79c7c5ec00_Flutter_Google Maps_Dart_Firebase Realtime Database_Mobile - Fatal编程技术网

Flutter 颤振firebase I/BufferBuffer:插槽0已丢弃,句柄=0x79c7c5ec00

Flutter 颤振firebase I/BufferBuffer:插槽0已丢弃,句柄=0x79c7c5ec00,flutter,google-maps,dart,firebase-realtime-database,mobile,Flutter,Google Maps,Dart,Firebase Realtime Database,Mobile,我正在使用flatter、firebase和googleapi创建一个uber克隆,这是我的主页,在这里我使用googlemapapi呈现googlemap 它起作用了,但在控制台中,它呈现出这样的基调: I/BufferQueueProducer(4851):[SurfaceTexture-0-4851-0](此:0x79990db000,id:0,api:1,p:471,c:-1)队列缓冲区:插槽0被丢弃,句柄=0x79c7c5ec00 这是主页的代码。dart: import 'dart:

我正在使用flatter、firebase和googleapi创建一个uber克隆,这是我的主页,在这里我使用googlemapapi呈现googlemap

它起作用了,但在控制台中,它呈现出这样的基调:

I/BufferQueueProducer(4851):[SurfaceTexture-0-4851-0](此:0x79990db000,id:0,api:1,p:471,c:-1)队列缓冲区:插槽0被丢弃,句柄=0x79c7c5ec00

这是
主页的代码。dart

import 'dart:async';

import 'package:firebase_database/firebase_database.dart';
import 'package:flutter/material.dart';
import 'package:flutter_polyline_points/flutter_polyline_points.dart';
import 'package:geolocator/geolocator.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:provider/provider.dart';
import 'package:uber_clone/BrandColors.dart';
import 'package:uber_clone/DataModels/DirectionDetail.dart';
import 'package:uber_clone/GlobalVariables.dart';
import 'package:uber_clone/Helpers/HelperMethods.dart';
import 'package:uber_clone/Providers/AppData.dart';
import 'package:uber_clone/Screens/SearchPage.dart';
import 'package:uber_clone/Widgets/CustomedBackButton.dart';
import 'package:uber_clone/Widgets/DrawerListItem.dart';
import 'package:uber_clone/Widgets/TaxiButton.dart';

class MainPage extends StatefulWidget {
  static const String id = 'main';

  @override
  _MainPageState createState() => _MainPageState();
}

class _MainPageState extends State<MainPage> with TickerProviderStateMixin {
  GlobalKey<ScaffoldState> scaffoldKey = new GlobalKey<ScaffoldState>();
  Completer<GoogleMapController> _controller = Completer();
  GoogleMapController mapController;
  Position currentPosition;
  double rideDetailSheetHeight = 0;
  double searchSheetHeight = 300;
  double requestRideSheetHeight = 0;
  double mapPaddingBottom = 300;
  List<LatLng> polylineCoordinates = [];
  Set<Polyline> _polylines = {};
  Set<Marker> _Markers = {};
  Set<Circle> _Circles = {};

  DirectionDetail tripDirectionDetails;

  AnimationController controller;

  @override
  void initState() {
    controller = AnimationController(
      vsync: this,
      duration: const Duration(seconds: 5),
    );
    controller.repeat(reverse: true);
    super.initState();
    print('int the init');
    HelperMethods.getCurrentUserInfo();
  }

  @override
  void dispose() {
    controller.dispose();
    super.dispose();
  }

  void setupPositionLocator() async {
    Position position = await Geolocator.getCurrentPosition(
        desiredAccuracy: LocationAccuracy.high);
    currentPosition = position;
    LatLng pos = LatLng(position.latitude, position.longitude);
    CameraPosition cp = new CameraPosition(target: pos, zoom: 14);
    mapController.animateCamera(CameraUpdate.newCameraPosition(cp));
    String address =
        await HelperMethods.findCordinateAddress(position, context);
  }

  Future<void> getDirection() async {
   // logic here is not important
  }

  void showDetailSheet() async {
    // logic here is not important
  }

  void createRideRequest() {
    // logic here is not important
  }

  void backToSeach() {
   // logic here is not important
  }

  void cancelRideRequest() {
    logic here is not important
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      key: scaffoldKey,
      drawer: Container(
        width: 250,
        color: Colors.white,
        child: Drawer(
          child: ListView(
            padding: EdgeInsets.all(0),
            children: <Widget>[
              Container(
                  color: Colors.white,
                  height: 160,
                  child: DrawerHeader(
                    decoration: BoxDecoration(color: Colors.white),
                    child: Row(
                      children: <Widget>[
                        Image.asset(
                          'images/user_icon.png',
                          height: 60,
                          width: 60,
                        ),
                        SizedBox(
                          width: 15,
                        ),
                        Column(
                          mainAxisAlignment: MainAxisAlignment.center,
                          crossAxisAlignment: CrossAxisAlignment.start,
                          children: <Widget>[
                            Text(
                              currentUserInfo.fullName,
                              style: TextStyle(
                                  fontSize: 20, fontFamily: 'Brand-Bold'),
                            ),
                            SizedBox(
                              height: 5,
                            ),
                            Text('View Profile')
                          ],
                        )
                      ],
                    ),
                  )),
              SizedBox(
                height: 10,
              ),
              DrawerListItem(
                icon: Icons.card_giftcard,
                title: currentUserInfo.phone,
              ),
              DrawerListItem(
                icon: Icons.card_giftcard,
                title: 'Free Rides',
              ),
              DrawerListItem(
                icon: Icons.credit_card,
                title: 'Payments',
              ),
              DrawerListItem(icon: Icons.history, title: 'Ride History'),
              DrawerListItem(
                icon: Icons.contact_support,
                title: 'Support',
              ),
              DrawerListItem(
                icon: Icons.info,
                title: 'About',
              )
            ],
          ),
        ),
      ),
      body: Stack(
        children: <Widget>[
          GoogleMap(
            padding: EdgeInsets.only(bottom: mapPaddingBottom),
            mapType: MapType.normal,
            myLocationButtonEnabled: true,
            initialCameraPosition: googlePlex,
            myLocationEnabled: true,
            zoomGesturesEnabled: true,
            zoomControlsEnabled: true,
            markers: _Markers,
            circles: _Circles,
            polylines: _polylines,
            onMapCreated: (GoogleMapController controller) async {
              _controller.complete(controller);
              mapController = controller;

              setupPositionLocator();
            },
          ),

          /// Open Drawer Button
          Positioned(
            top: 60,
            left: 20,
            child: GestureDetector(
              onTap: () {
                scaffoldKey.currentState.openDrawer();
              },
              child: Container(
                decoration: BoxDecoration(
                    color: Colors.white,
                    borderRadius: BorderRadius.circular(20),
                    boxShadow: [
                      BoxShadow(
                          color: Colors.black26,
                          blurRadius: 5.0,
                          spreadRadius: 0.5,
                          offset: Offset(0.7, 0.7))
                    ]),
                child: CircleAvatar(
                  backgroundColor: Colors.white,
                  radius: 20,
                  child: Icon(Icons.menu),
                ),
              ),
            ),
          ),

          /// Menu Sheet
          Positioned(
            left: 0,
            right: 0,
            bottom: 0,
            child: AnimatedSize(
              vsync: this,
              duration: new Duration(milliseconds: 150),
              child: Container(
                height: searchSheetHeight,
                decoration: BoxDecoration(
                    color: Colors.white,
                    borderRadius: BorderRadius.only(
                        topRight: Radius.circular(15),
                        topLeft: Radius.circular(15)),
                    boxShadow: [
                      BoxShadow(
                          color: Colors.black26,
                          blurRadius: 15.0,
                          spreadRadius: 0.5,
                          offset: Offset(0.7, 0.7))
                    ]),
                child: Padding(
                  padding: EdgeInsets.symmetric(horizontal: 24, vertical: 18),
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: <Widget>[
                      SizedBox(
                        height: 5,
                      ),
                      Text(
                        'Nice to meet you!',
                        style: TextStyle(fontSize: 10),
                      ),
                      Text(
                        'Where are you going?',
                        style:
                            TextStyle(fontSize: 18, fontFamily: 'Brand-Bold'),
                      ),
                      SizedBox(
                        height: 20,
                      ),
                      GestureDetector(
                        onTap: () async {
                          var response = await Navigator.push(
                              context,
                              MaterialPageRoute(
                                  builder: (context) => SearchPage()));

                          if (response == 'getDirection') {
                            await getDirection();
                            showDetailSheet();
                          }
                        },
                        child: Container(
                          decoration: BoxDecoration(
                              color: Colors.white,
                              borderRadius: BorderRadius.circular(10.0),
                              boxShadow: [
                                BoxShadow(
                                    color: Colors.black26,
                                    blurRadius: 5.0,
                                    spreadRadius: 0.2,
                                    offset: Offset(0.4, 0.4))
                              ]),
                          child: Padding(
                            padding: EdgeInsets.all(12.0),
                            child: Row(
                              children: <Widget>[
                                Icon(
                                  Icons.search,
                                  color: Colors.blueAccent,
                                ),
                                SizedBox(
                                  width: 10,
                                ),
                                Text('Search Destination')
                              ],
                            ),
                          ),
                        ),
                      ),
                      SizedBox(
                        height: 10,
                      ),
                      Container(
                        decoration: BoxDecoration(
                            color: Colors.white,
                            borderRadius: BorderRadius.circular(10.0),
                            boxShadow: [
                              BoxShadow(
                                  color: Colors.black26,
                                  blurRadius: 5.0,
                                  spreadRadius: 0.2,
                                  offset: Offset(0.4, 0.4))
                            ]),
                        child: Padding(
                          padding: EdgeInsets.all(12.0),
                          child: Row(
                            children: <Widget>[
                              Icon(
                                Icons.home,
                                color: BrandColors.colorDimText,
                              ),
                              SizedBox(
                                width: 10,
                              ),
                              Column(
                                crossAxisAlignment: CrossAxisAlignment.start,
                                children: <Widget>[
                                  Text((Provider.of<AppData>(context)
                                              .pickupAddress !=
                                          null)
                                      ? Provider.of<AppData>(context)
                                          .pickupAddress
                                          .placeName
                                      : 'Add Home'),
                                  SizedBox(
                                    height: 3,
                                  ),
                                  Text(
                                    'Your residential address',
                                    style: TextStyle(
                                        fontSize: 11,
                                        color: BrandColors.colorDimText),
                                  )
                                ],
                              )
                            ],
                          ),
                        ),
                      ),
                      SizedBox(
                        height: 10,
                      ),
                      Container(
                        decoration: BoxDecoration(
                            color: Colors.white,
                            borderRadius: BorderRadius.circular(10.0),
                            boxShadow: [
                              BoxShadow(
                                  color: Colors.black26,
                                  blurRadius: 5.0,
                                  spreadRadius: 0.2,
                                  offset: Offset(0.4, 0.4))
                            ]),
                        child: Padding(
                          padding: EdgeInsets.all(12.0),
                          child: Row(
                            children: <Widget>[
                              Icon(
                                Icons.work,
                                color: BrandColors.colorDimText,
                              ),
                              SizedBox(
                                width: 10,
                              ),
                              Column(
                                crossAxisAlignment: CrossAxisAlignment.start,
                                children: <Widget>[
                                  Text('Add Work'),
                                  SizedBox(
                                    height: 3,
                                  ),
                                  Text(
                                    'Your office address',
                                    style: TextStyle(
                                        fontSize: 11,
                                        color: BrandColors.colorDimText),
                                  )
                                ],
                              )
                            ],
                          ),
                        ),
                      )
                    ],
                  ),
                ),
              ),
            ),
          ),

          /// RideDetail Sheet
          Positioned(
              left: 0,
              right: 0,
              bottom: 0,
              child: AnimatedSize(
                vsync: this,
                duration: new Duration(milliseconds: 150),
                child: Container(
                  decoration: BoxDecoration(
                      color: Colors.white,
                      borderRadius: BorderRadius.only(
                          topLeft: Radius.circular(15),
                          topRight: Radius.circular(15)),
                      boxShadow: [
                        BoxShadow(
                            color: Colors.black26,
                            blurRadius: 15.0,
                            spreadRadius: 0.5,
                            offset: Offset(0.7, 0.7))
                      ]),
                  height: rideDetailSheetHeight,
                  child: Column(
                    children: <Widget>[
                      Container(
                        child: Padding(
                          padding: EdgeInsets.symmetric(horizontal: 16),
                          child: Row(
                            children: <Widget>[
                              Image.asset(
                                'images/taxi.png',
                                height: 70,
                                width: 70,
                              ),
                              SizedBox(
                                width: 16,
                              ),
                              Column(
                                crossAxisAlignment: CrossAxisAlignment.start,
                                children: <Widget>[
                                  Text(
                                    'Taxi',
                                    style: TextStyle(
                                        fontSize: 18, fontFamily: 'Brand-Bold'),
                                  ),
                                  Text(
                                    (tripDirectionDetails != null)
                                        ? tripDirectionDetails.distanceText
                                        : '',
                                    style: TextStyle(
                                        fontSize: 16,
                                        color: BrandColors.colorTextLight),
                                  )
                                ],
                              ),
                              Expanded(child: Container()),
                              Text(
                                (tripDirectionDetails != null)
                                    ? '\$${HelperMethods.estimateFares(tripDirectionDetails)}'
                                    : '',
                                style: TextStyle(
                                    fontSize: 18, fontFamily: 'Brand-Bold'),
                              )
                            ],
                          ),
                        ),
                      ),
                      SizedBox(
                        height: 22,
                      ),
                      Padding(
                        padding: const EdgeInsets.symmetric(horizontal: 16.0),
                        child: Row(
                          children: <Widget>[
                            Icon(
                              Icons.monetization_on,
                              size: 18,
                              color: BrandColors.colorTextLight,
                            ),
                            SizedBox(
                              width: 16,
                            ),
                            Text('Cash'),
                            SizedBox(
                              width: 5,
                            ),
                            Icon(
                              Icons.keyboard_arrow_down,
                              color: BrandColors.colorTextLight,
                              size: 16,
                            )
                          ],
                        ),
                      ),
                      SizedBox(
                        height: 22,
                      ),
                      Padding(
                        padding: const EdgeInsets.symmetric(horizontal: 12.0),
                        child: TaxiButton(
                            title: 'REQUEST CAB',
                            color: BrandColors.colorAccent,
                            onPressed: () => createRideRequest()),
                      ),
                      SizedBox(
                        height: 22,
                      ),
                      CustomedBackButton(
                          onTap: () => backToSeach(), text: 'back to search')
                    ],
                  ),
                ),
              )),

          /// Request Cab Sheet
          Positioned(
              left: 0,
              right: 0,
              bottom: 0,
              child: AnimatedSize(
                  vsync: this,
                  duration: new Duration(milliseconds: 150),
                  child: Container(
                    decoration: BoxDecoration(
                        color: Colors.white,
                        borderRadius: BorderRadius.only(
                            topLeft: Radius.circular(15),
                            topRight: Radius.circular(15)),
                        boxShadow: [
                          BoxShadow(
                              color: Colors.black26,
                              blurRadius: 15.0,
                              spreadRadius: 0.5,
                              offset: Offset(0.7, 0.7))
                        ]),
                    height: requestRideSheetHeight,
                    child: Container(
                      child: Padding(
                        padding: const EdgeInsets.all(12.0),
                        child: Column(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          children: <Widget>[
                            Padding(
                              padding: const EdgeInsets.symmetric(
                                  horizontal: 12, vertical: 8),
                              child: LinearProgressIndicator(
                                value: controller.value,
                                valueColor: new AlwaysStoppedAnimation<Color>(
                                    BrandColors.colorTextSemiLight),
                                backgroundColor: Colors.black12,
                              ),
                            ),
                            Text(
                              'Requesting a Ride ...',
                              style: TextStyle(
                                  fontSize: 22,
                                  fontFamily: 'Brand-Bold',
                                  color: BrandColors.colorTextLight),
                            ),
                            SizedBox(
                              height: 22,
                            ),
                            CustomedBackButton(
                                onTap: () => cancelRideRequest(),
                                text: 'cancel ride')
                          ],
                        ),
                      ),
                    ),
                  )))
        ],
      ),
    );
  }
}
导入'dart:async';
导入“package:firebase_database/firebase_database.dart”;
进口“包装:颤振/材料.省道”;
导入“包:颤振多段线点/颤振多段线点.省道”;
导入“包:地理定位器/地理定位器.dart”;
导入“包:google_-maps_-flatter/google_-maps_-flatter.dart”;
导入“包:provider/provider.dart”;
导入“package:uber_clone/BrandColors.dart”;
导入“package:uber_clone/DataModels/DirectionDetail.dart”;
导入“package:uber_clone/GlobalVariables.dart”;
导入“package:uber_clone/Helpers/HelperMethods.dart”;
导入“包:uber_clone/Providers/AppData.dart”;
导入“package:uber_clone/Screens/SearchPage.dart”;
导入“package:uber_clone/Widgets/CustomedBackButton.dart”;
导入“package:uber_clone/Widgets/DrawerListItem.dart”;
导入“package:uber_clone/Widgets/TaxiButton.dart”;
类MainPage扩展了StatefulWidget{
静态常量字符串id='main';
@凌驾
_MainPageState createState()=>\u MainPageState();
}
类_MainPageState使用TickerProviderStateMixin扩展状态{
GlobalKey scaffoldKey=新的GlobalKey();
Completer _controller=Completer();
谷歌地图控制器;
位置当前位置;
双脊尾板高度=0;
双倍搜索高度=300;
double-requests-height=0;
双mapPaddingBottom=300;
列出多段线坐标=[];
集合_polylines={};
设置_标记={};
集合_圆={};
方向详细信息tripDirectionDetails;
动画控制器;
@凌驾
void initState(){
控制器=动画控制器(
vsync:这个,,
持续时间:常数持续时间(秒数:5),
);
控制器。重复(反向:真);
super.initState();
打印('int the init');
HelperMethods.getCurrentUserInfo();
}
@凌驾
无效处置(){
controller.dispose();
super.dispose();
}
无效setupPositionLocator()异步{
位置=等待地理定位器。getCurrentPosition(
所需精度:定位精度高);
当前位置=位置;
LatLng pos=LatLng(位置、纬度、位置、经度);
CameraPosition cp=新的CameraPosition(目标:位置,缩放:14);
mapController.animateCamera(CameraUpdate.newCameraPosition(cp));
字符串地址=
等待帮助方法。查找协调地址(位置、上下文);
}
Future getDirection()异步{
//这里的逻辑并不重要
}
void showtailsheet()异步{
//这里的逻辑并不重要
}
void createRideRequest(){
//这里的逻辑并不重要
}
void backToSeach(){
//这里的逻辑并不重要
}
作废取消请求(){
这里的逻辑并不重要
}
@凌驾
小部件构建(构建上下文){
返回脚手架(
钥匙:脚手架钥匙,
抽屉:集装箱(
宽度:250,
颜色:颜色,白色,
孩子:抽屉(
子:ListView(
填充:边缘集。全部(0),
儿童:[
容器(
颜色:颜色,白色,
身高:160,
儿童:抽屉阅读器(
装饰:盒子装饰(颜色:彩色。白色),
孩子:排(
儿童:[
影像资产(
“images/user_icon.png”,
身高:60,
宽度:60,
),
大小盒子(
宽度:15,
),
纵队(
mainAxisAlignment:mainAxisAlignment.center,
crossAxisAlignment:crossAxisAlignment.start,
儿童:[
正文(
currentUserInfo.fullName,
样式:TextStyle(
fontSize:20,fontFamily:“品牌粗体”),
),
大小盒子(
身高:5,,
),
文本(“视图配置文件”)
],
)
],
),
)),
大小盒子(
身高:10,
),
抽屉式(
图标:Icons.card\u giftcard,
标题:currentUserInfo.phone,
),
抽屉式(
图标:Icons.card\u giftcard,
标题:“免费乘车”,
),
抽屉式(
icon:Icons.credit_卡,
标题:“付款”,
),
DroperListItem(图标:Icons.history,标题:“骑行历史”),
抽屉式(
icon:Icons.contact_支持,
标题:"支持",,
),
抽屉式(
icon:Icons.info,
标题:"关于",,
)
],
),
),
),
主体:堆栈(
儿童:[
谷歌地图(
填充:仅限边集(底部:mapPaddingBottom),
mapType:mapType.normal,
myLocationButtonEnabled:正确,
initialCameraPosition:googlePlex,
myLocationEnabled:对,
zoomGesturesEnabled:对,
ZoomControl启用:对,
标记:_标记,