小编Uma*_*han的帖子

Flutter _debugLifecycleState!= _ElementLifecycle.defunct':不正确

我在我的应用程序中显示一些动画自定义画家进度条,它显示一些错误

Error: The following assertion was thrown while notifying listeners for AnimationController:
'package:flutter/src/widgets/framework.dart': Failed assertion: line 4263 pos 12: '_debugLifecycleState != _ElementLifecycle.defunct': is not true.
Run Code Online (Sandbox Code Playgroud)

我有一个简单的主页,其中有一个导航栏。当导航发生这样的变化时,我只是显示容器

SingleChildScrollView(
            child: Container(
                decoration: BoxDecoration(
                  image: DecorationImage(
                    image: AssetImage("images/sidebg.png"),
                    fit: BoxFit.cover,
                  ),
                ),
                child: Column(
                  children: [
                    pageIndex == 0 ? DashboardScreen() : Container(),
                    pageIndex == 1 ? MapScreen() : Container(),
                    pageIndex == 3 ? ServiceCenter() : Container(),
                    pageIndex == 4 ? ProfileScreen() : Container(),
                  ],
                )),
          ),
Run Code Online (Sandbox Code Playgroud)

问题是,当索引更改时,您可以看到页面发生更改,但是当我更改页面时,它会显示错误,正如我上面在持续循环中提到的那样,不会停止。

如果我删除这个进度指示器,一切都会正常工作。

这是进度指示器屏幕

import 'dart:math' as …
Run Code Online (Sandbox Code Playgroud)

flutter

15
推荐指数
2
解决办法
1万
查看次数

Flutter 在 2 个标记之间绘制路线

我通过给出 long 和 lat 在地图上显示 2 个标记,那里 2 个值基本上是开始和结束。我需要知道如何在这两个点之间绘制一条路线。我启用了 API 意味着我已经支付了 API。我只需要在这两个点之间画一条路线

这是我的代码

import 'package:flutter/material.dart';
import 'package:flutter_polyline_points/flutter_polyline_points.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';

class TripRouteScreen extends StatefulWidget {
  final data;

  const TripRouteScreen({Key key, @required this.data}) : super(key: key);
  @override
  _TripRouteScreenState createState() => _TripRouteScreenState();
}

class _TripRouteScreenState extends State<TripRouteScreen> {
  var start_currentPostion;
  var end_currentPostion;
  BitmapDescriptor pinLocationIcon;
  PolylinePoints polylinePoints = PolylinePoints();
  Map<PolylineId, Polyline> polylines = {};
  List<LatLng> polylineCoordinates = [];

  Map<MarkerId, Marker> setmarkers = {};
  List listMarkerIds = List(); // For store data of your markers …
Run Code Online (Sandbox Code Playgroud)

dart flutter

10
推荐指数
1
解决办法
733
查看次数

位置或基于经度和纬度的离子设置标记

我正在关注一些教程,我想在当前位置设置标记。我正在获取用户的经度和纬度值,并且需要在当前位置或可能的经度和纬度值上显示标记。我还能在地图上显示该位置的地址吗?在某些答案中,我检查是否只有在中心设置标记的选项,是否有任何选项可以在当前位置设置标记?

 constructor(public navCtrl: NavController, public navParams: NavParams, public geolocation: Geolocation, private locationAccuracy: LocationAccuracy) {

   this.catdata = this.navParams.get('for1');
   this.areadata = this.navParams.get('for2');
   console.log(this.catdata);
   console.log(this.areadata);

  this.locationAccuracy.canRequest().then((canRequest: boolean) => {
    if(canRequest) {
     // the accuracy option will be ignored by iOS
     this.locationAccuracy.request(this.locationAccuracy.REQUEST_PRIORITY_HIGH_ACCURACY).then(
       () => {
         this.isGpsOn = true;
       },
       error => console.log('Error requesting location permissions', error)
     );
   }

  });

 this.addMarker();

  }

 ionViewDidLoad() {
   this.loadMap();
   }

 next(){
   this.navCtrl.push(Order4Page, {catdata:this.catdata,
                             areadata:this.areadata});
 }

  loadMap(){
   this.geolocation.getCurrentPosition().then((position) => {

    let latLng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
     console.log(position.coords.latitude);
        console.log(position.coords.longitude);


  let mapOptions …
Run Code Online (Sandbox Code Playgroud)

ionic-framework angular

6
推荐指数
1
解决办法
104
查看次数

Ionic 4 Loadingcontroller 覆盖不存在

我创建了一个简单的函数来创建这样的加载

async presentLoading() {
  const loading = await this.loadingController.create({
    message: 'Please Wait...',
  });
  await loading.present();
}
Run Code Online (Sandbox Code Playgroud)

当像这样获取数据时,我正在关闭加载程序

  getUserData(){
  console.log(this.userID);
    this.api.getCompanyEmploye(this.userID).subscribe(res => {
     this.loadingController.dismiss(); //closing here 

      console.log(res);
      this.user = res.records[0];
      this.familyMembers = res.records[0].family_members;
    });
  }
Run Code Online (Sandbox Code Playgroud)

我在构造函数中调用这两个函数

constructor(public loadingController: LoadingController){
  this.presentLoading();
  this.getUserData();
}
Run Code Online (Sandbox Code Playgroud)

它的显示错误 ERROR Error: Uncaught (in promise): overlay does not exist

ionic-framework ionic4

5
推荐指数
1
解决办法
2889
查看次数

Flutter 如何显示当前日期和未来 5 天的日期?

我需要在文本小部件中显示当前日期和月份以及接下来 5 天的日期和月份。

简直就是这样

                  Column(
                    children: [
                      Text('09'),
                      Text('Nov')
                    ],
                  )
Run Code Online (Sandbox Code Playgroud)

我需要连续显示今天的日期或月份以及接下来 5 天的日期和月份。代码中的任何指南我该如何做这件事?

预期输出是

28NOV, 29NOV, 30NOV, 1Dec, 2Dec
Run Code Online (Sandbox Code Playgroud)

flutter

4
推荐指数
1
解决办法
7046
查看次数

Angular ngx-spinner 不显示

我需要显示微调器,直到从 httpclient 获取数据。但是微调器没有显示。

我只需要显示微调器或加载器,直到数据来自 API,以便用户可以看到数据正在加载。我的有什么问题.html吗?。

它在我过滤数据时显示,但在页面加载时不显示。

    import { Component, OnInit } from '@angular/core';
    import { ApiService } from 'app/services/api/api.service';
    import { map } from 'rxjs/operators';
    import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
    import { HttpClient, HttpHeaders } from '@angular/common/http';
    import { NgxSpinnerService } from 'ngx-spinner';
    import { Observable } from 'rxjs/Observable';
    import 'rxjs/add/operator/map'

    @Component({
    selector: 'app-home',
    templateUrl: './home.component.html',
    styleUrls: ['./home.component.scss']
    })
    export class HomeComponent {

      clientData: Observable<any>;
      data: any  = []; 
      status: any = [];
      countunsettled: any;
      countsettled: any; …
Run Code Online (Sandbox Code Playgroud)

spinner angular

3
推荐指数
2
解决办法
1万
查看次数

离子显示数据等于该值

我正在使用ngFor滑动项目。但是我需要证明那些只有事件价值即将到来的项目。

我只需要显示具有事件值活动状态的数组即可。谢谢

<ion-slide class="slide" *ngFor="let y of upcoming" (click)='details(y)'>
  <ion-card class="box" style="background-color: white">
    <img  [src]="y.picture1" class="image"/>
       <div class="row">
          <div class="column1" style="background-color: white">
              <h3> {{y.days}} Days</h3>
          </div>

           <div class="column2" style="background-color: white">
              <div class="tourdescription">{{y.title}}</div>
              <div class="tourdate">{{y.date}}</div>
           </div>    
       </div>
  </ion-card>
</ion-slide>
Run Code Online (Sandbox Code Playgroud)

.ts

  getUpcoming(){
    this.authService.getUpcoming().pipe(
    map(actions => actions.map(a => {
    const data = a.payload.doc.data();
    const id = a.payload.doc.id;

     return { id, ...data };
     }))
   ).subscribe(resp=>{
   console.log(resp);
   this.upcoming = resp; 
   });
  }
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

ionic-framework angular

3
推荐指数
1
解决办法
61
查看次数

我们如何在 Firestore 中的数组中创建数组?

我需要在类似我创建的数组中添加数组,您可以在图像中看到我需要在成员中添加 2 个数组。我需要保存 uid+name。但没有数组选项,只有字符串、数字、布尔值等。 在此处输入图片说明

firebase google-cloud-firestore

2
推荐指数
1
解决办法
578
查看次数

Ionic 4如何显示更多/更少的文本?

我需要显示文本,但以两行显示,但当用户单击“显示更多”时,他/她可以看到所有文本。这是我的代码

   <div *ngFor="let x of announcement">
         <ion-card class="group-box">
           <div text-left style="font-size: 16px; font-weight: bold; color: white; top: 10%;position: relative; margin-left: 10px;">
             {{x.announcementTitle}}
           </div>
           <div class="" text-left style="font-size: 16px; font-weight: bold; color: white; top: 25%;position: relative; margin-left: 10px;">
             {{x.announcementDetails}}
           </div>

           <div text-right class="announcement-username">
             {{x.createrName}}
           </div>
         </ion-card>
   </div>
Run Code Online (Sandbox Code Playgroud)

我需要在announcementDetails中添加关闭seemore/less的选项

ionic-framework angular

2
推荐指数
1
解决办法
4063
查看次数

按过滤器进行角度比较 2 个数组

我有 2 个数组,我只需要显示与第一个数组匹配的数据。

例子

第一个数组就像

["1", "2" , "3"]
Run Code Online (Sandbox Code Playgroud)

第二个就像

[{"name": "xyz", "id": "1"},{"name":"abc", "id": "3"}, ,{"name":"def", "id": "4"}]
Run Code Online (Sandbox Code Playgroud)

结果

[{"name": "xyz", "id": "1"},{"name":"abc", "id": "3"}}
Run Code Online (Sandbox Code Playgroud)

我尝试这样但显示空数组

console.log(this.secondArr.filter(d => d.id === firstArr));
Run Code Online (Sandbox Code Playgroud)

typescript angular

1
推荐指数
1
解决办法
40
查看次数

Flutter如何获取assets_audio_player中当前的持续时间

我以前使用 just_audio 并且我正在像这样获取当前时间

player.positionStream.listen((event) {
  playerTimeNow = event;
  updatePlayerBar();
});
Run Code Online (Sandbox Code Playgroud)

现在我需要知道如何在这个asset_audio_player中获得时间

audio-player dart flutter flutter-dependencies just-audio

1
推荐指数
1
解决办法
5870
查看次数