小编Aki*_*kif的帖子

ios 上的 Flutter 文本转语音低音量

在我的 ios 应用程序中,我使用flutter tts。它在 Android 上按预期工作,但在 ios 上音量非常低,因为音频来自耳机(而不是扬声器)。因此,音量非常非常低。如何将音频输出切换到扬声器?欢迎任何建议。提前致谢。

这是我的代码:

    await flutterTts.setSpeechRate(Platform.android == true ? 0.97 : 0.53);
    await flutterTts.speak("I am a Flutter developer");
Run Code Online (Sandbox Code Playgroud)

flutter

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

警告数据库已锁定 0:00:10.000000。确保在事务期间始终使用事务对象进行数据库操作

我正在尝试从远程服务器获取图像。我不断收到此错误:

  Warning database has been locked for 0:00:10.000000. 
  Make sure you always use the transaction object for database operations during a transaction
Run Code Online (Sandbox Code Playgroud)

之后我的应用程序崩溃了。


Widget carousel = new Container(
      height: 200,
      child: FutureBuilder<List<String>>(
          future: getPropImgs(),
          builder: (context, snapshot) {
            if (snapshot.hasData) {
              return new Carousel(
                
                boxFit: BoxFit.cover,
                images: snapshot.data.map((f) {
                  return new CachedNetworkImage(
                    imageUrl: f.toString(),
                    imageBuilder: (context, imageProvider) => Container(
                      decoration: BoxDecoration(
                        image: DecorationImage(
                            image: imageProvider,
                            fit: BoxFit.cover,
                            colorFilter:
                                ColorFilter.mode(Colors.blue, BlendMode.dstIn)),
                      ),
                    ),
                    placeholder: (context, url) => Center(
                        child: Container(
                            height: …
Run Code Online (Sandbox Code Playgroud)

android flutter

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

错误:未为类“Geolocator”定义方法“getPositionStream”

使用颤振,我尝试在地理定位器中使用 StreamSubscription 和 getPositionStream 检索当前位置。但我不断收到错误消息:错误:未为类“Geolocator”定义方法“getPostionStream”。

这是我的功能:

void getLocationUpdates(){
StreamSubscription<Position> homeTabPostionStream;

homeTabPostionStream = geoLocator.getPositionStream(locationOptions).listen((Position position){
  currentPosition = position;
});
Run Code Online (Sandbox Code Playgroud)

在这里我创建了变量:

var geoLocator = Geolocator();
var locationOptions = LocationOptions(accuracy: LocationAccuracy.bestForNavigation, distanceFilter: 4);
Run Code Online (Sandbox Code Playgroud)

根据您的要求,我编写了整个代码以供参考。

这是整个代码:

class HomeTab extends StatefulWidget {
  @override
  _HomeTabState createState() => _HomeTabState();
}

class _HomeTabState extends State<HomeTab> {

  GoogleMapController mapController;
  Completer<GoogleMapController> _controller = Completer();

  Position currentPosition;

  DatabaseReference tripRequestRef;

  var geoLocator = Geolocator();
  var locationOptions = LocationOptions(accuracy: LocationAccuracy.bestForNavigation, distanceFilter: 4);


  void getCurrentPosition() async{

    Position position = await Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.bestForNavigation);
    currentPosition = …
Run Code Online (Sandbox Code Playgroud)

geolocation dart firebase dart-pub flutter

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

签约“Runner”需要一个开发团队。在 Signing &amp; Capabilities 编辑器中选择一个开发团队

我无法在 iPhone 上以发布模式运行我的应用程序,但我可以在调试模式下运行它。在发布模式下,即使我已签约到团队,我也会收到此错误。

Signing for "Runner" requires a development team. Select a development team in the Signing & Capabilities editor.

我尝试从团队注销并再次登录,我也重新启动了 Xcode。

感谢您的任何帮助 LG

这是正确的吗? 在此处输入图片说明

xcode ios flutter

4
推荐指数
2
解决办法
1971
查看次数

http.dart onError 的无效参数:无效参数 (onError):错误处理程序必须接受一个对象或一个对象和一个 StackTrace 作为参数

我是 Flutter 新手,我想了解我的错误处理程序出了什么问题:

import 'package:http/http.dart' as http;
try {
  var response = await client.get('$endpoint/users/$userId');

  // Convert and return
  return User.fromJson(json.decode(response.body));
} on HttpException catch (ex) {
  print('http');
  print(ex);
  print('exception');
  return null;
} on Error catch (error) {
  // code will go here
  print(error);
  return null;
}
Run Code Online (Sandbox Code Playgroud)

结果是:

I/flutter ( 3103): Invalid argument (onError): Error handler must accept one Object or one Object and a StackTrace as arguments.: Closure: (HttpException) => Null
Run Code Online (Sandbox Code Playgroud)

这和我没有做任何事情是完全一样的try/catch,有人可以建议我应该如何做错误处理程序吗?根据我的理解,(error)这里应该是“一个对象”,如果我错了,请纠正我。蒂亚!

http dart flutter

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

如何为 Hololens2 正确重新加载使用 MRTK 的 Unity 场景?

这是我使用 Hololens 和 MRTK for Unity 的第一个项目。我想制作一个按钮,按下时可以重新启动玩家的体验。

我使用以下代码将按钮连接到新脚本:

SceneManager.LoadScene(SceneManager.GetActiveScene().name);
Run Code Online (Sandbox Code Playgroud)

当按下按钮时,场景似乎会重新加载,但所有 MRTK/Hololens 功能都会停止。手部和眼球追踪没有反应,我无法与全息图交互。

我知道我可以手动创建一个重置方法来移动场景中的所有对象并重置特定脚本,但我试图通过按一下按钮来完全卸载并重新加载尽可能多的 Unity 应用程序。

那么,如何在 Hololens2 上正确重新加载 Unity 场景?我仍在对此进行研究,并将更新我在这里找到的内容。我非常感谢这里的任何帮助,谢谢!

c# unity-game-engine virtual-reality hololens mrtk

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

如何在数组 flutter Firestore 中添加地图

So I have this array in firestore called members and what it does so far is simply hold a list of user display names who have joined the list. However, what I need is to be able to create a map within this array that will hold two values unique to each member, their name, and the number of plastics they collected. I'm quite confused about how to accomplish this.

Here is what I think a map structure should look …

firebase flutter google-cloud-firestore

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

Dart 地图,如何根据其键 id 替换列表&lt;map&gt; 中的特定键值?

void main() {
  List<Map<String, dynamic>> products = [
    {'id': 24, 'time': '2019-11-24 00:00:00.000'},
    {'id': 36, 'time': '2019-11-23 00:00:00.000'},
    {'id': 48, 'time': '2019-11-24 00:00:00.000'},
  ];
Run Code Online (Sandbox Code Playgroud)

在上面的代码中,我想将“id”48的“时间”条目“2019-11-24 00:00:00.000”替换为“2019-10-26 00:00:00.000”。

dictionary list dart flutter

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

如何在flutter中删除文本字段光标气泡

在此处输入图片说明

如何在文本字段中输入时消除颤动中的气泡。有什么解决办法吗?

flutter

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

如何在flutter中缓存图像?

我有一个颤振应用程序。我通过 HTTP 在那里拍摄图像并希望缓存它们,因为滚动时所有内容都会再次加载并需要时间。\n我该如何解决这个问题?如果你能给出一个例子,请。\n有必要不再下载它。那些已加载的产品最好已经在缓存中或者至少是图片中。我怎样才能做到这一点?

\n
//method gets products\nFuture<List<Product>> getProducts(int id) async {\nvar response = await http.get(Uri.parse('...'));\nfinal products = jsonDecode(response.body).cast<Map<String, dynamic>>();\n\nList<Product> list = products.map<Product>((json) => Product.fromJson(json)).toList();\n\nreturn list;}\n// parse json\nfactory Product.fromJson(Map<String, dynamic> data) {\nreturn Product(\n    id: data['id'] as int,\n    title: data['name'] as String,\n    description: data['description'] as String,\n    imgUrl: data['images'][0]['src'] as String,\n    price: num.tryParse(data['price'])\n);}\n//draw products\nWidget build(BuildContext context) {\nfinal product = Provider.of<Product>(context, listen: false);\n\nreturn Container(\n  width: 150,\n  padding: const EdgeInsets.all(10.0),\n  margin: const EdgeInsets.all(5.0),\n  decoration: BoxDecoration(\n    borderRadius: BorderRadius.circular(15.0),\n    color: Color(422),\n  ),\n  child: Column(\n    mainAxisAlignment: MainAxisAlignment.spaceBetween,\n    crossAxisAlignment: …
Run Code Online (Sandbox Code Playgroud)

dart flutter

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