草庐IT

dart-webui

全部标签

dart - DropdownButtonFormField,具有固定宽度但动态文本项

我认为我不太了解Flutter中的约束,所以请耐心等待!我想要DropdownButtonFormField从数据库中填充其项目。该字符串可以是任何动态长度。所以我决定使用固定宽度的DropdownButtonFormField并且DropdownMenuItem将省略Text。这是我试过的。SizedBox(width:136.0,child:DropdownButtonFormField(hint:Text("hintText")decoration:InputDecoration(contentPadding:constEdgeInsets.all(0.0),enabledBor

dart - 在 Flutter 中关闭应用程序后,如何使本地存储持久存在?

我正在使用本地存储包-https://pub.dartlang.org/packages/localstorage#-installing-tab-这是我的代码:import'package:flutter/material.dart';import'package:localstorage/localstorage.dart';voidmain()=>runApp(MyApp());classMyAppextendsStatelessWidget{Widgetbuild(BuildContextcontext){returnMaterialApp(home:MyHomePage(),

dart - 在 Flutter 中关闭应用程序后,如何使本地存储持久存在?

我正在使用本地存储包-https://pub.dartlang.org/packages/localstorage#-installing-tab-这是我的代码:import'package:flutter/material.dart';import'package:localstorage/localstorage.dart';voidmain()=>runApp(MyApp());classMyAppextendsStatelessWidget{Widgetbuild(BuildContextcontext){returnMaterialApp(home:MyHomePage(),

unit-testing - Flutter: 'package:shared_preferences/shared_preferences.dart':断言失败:第 33 行 pos 16: 'key.startsWith(_prefix)':不正确

我正在对共享首选项运行一些单元测试。我正在制作一个帮助程序类,这样我们就不必一遍又一遍地编写相同的代码。无论我尝试什么,我总是一遍又一遍地得到同样的错误。您将找到我正在测试的类、测试类和堆栈跟踪。我希望这是我忘记的蠢事。我尝试了这些资源:https://pub.dartlang.org/packages/shared_preferencesunittestingflutterhttps://flutter.dev/docs/cookbook/persistence/key-valueshared_preferences_helper_test.dart:import'package:f

unit-testing - Flutter: 'package:shared_preferences/shared_preferences.dart':断言失败:第 33 行 pos 16: 'key.startsWith(_prefix)':不正确

我正在对共享首选项运行一些单元测试。我正在制作一个帮助程序类,这样我们就不必一遍又一遍地编写相同的代码。无论我尝试什么,我总是一遍又一遍地得到同样的错误。您将找到我正在测试的类、测试类和堆栈跟踪。我希望这是我忘记的蠢事。我尝试了这些资源:https://pub.dartlang.org/packages/shared_preferencesunittestingflutterhttps://flutter.dev/docs/cookbook/persistence/key-valueshared_preferences_helper_test.dart:import'package:f

dart - 如何将我的 List<Object> 显示到 Listview 中?

我有一个Json文件作为Assets。解析工作完美,但是当我使用我的json中的列表时,会抛出一个错误。“在null时调用了getter”这是我的JsonCode:classBiersorten{finalListbiersorten;Biersorten({this.biersorten});factoryBiersorten.fromJson(ListparsedJson){ListlistBiersorten=newList();listBiersorten=parsedJson.map((i)=>Bier.fromJson(i)).toList();returnnewBiers

dart - 如何将我的 List<Object> 显示到 Listview 中?

我有一个Json文件作为Assets。解析工作完美,但是当我使用我的json中的列表时,会抛出一个错误。“在null时调用了getter”这是我的JsonCode:classBiersorten{finalListbiersorten;Biersorten({this.biersorten});factoryBiersorten.fromJson(ListparsedJson){ListlistBiersorten=newList();listBiersorten=parsedJson.map((i)=>Bier.fromJson(i)).toList();returnnewBiers

dart - 如何在 flutter 集成测试中模拟 http 请求?

我正在尝试使用Mockito这样做,这是我的测试:import'package:http/http.dart'ashttp;import'package:utgard/globals.dart'asglobals;import'package:flutter_driver/flutter_driver.dart';import'package:test/test.dart';import'package:mockito/mockito.dart';classMockClientextendsMockimplementshttp.Client{}voidmain(){group('Log

dart - 如何在 flutter 集成测试中模拟 http 请求?

我正在尝试使用Mockito这样做,这是我的测试:import'package:http/http.dart'ashttp;import'package:utgard/globals.dart'asglobals;import'package:flutter_driver/flutter_driver.dart';import'package:test/test.dart';import'package:mockito/mockito.dart';classMockClientextendsMockimplementshttp.Client{}voidmain(){group('Log

dart - 如何使用 Flutter Cupertino 图标?

我知道要使用它们,您必须导入'package:flutter/cupertino.dart';并像这样使用它Icon(CupertinoIcons.info);但是很难选择需要的图标。亲爱的Flutter团队,请在某处制作完整的Cupertino图标引用。一place有没有图标的名字和other有没有名字的图标。更新:正如Mariano所指出的,并在此answer中显示名称映射尚未完成,我们可以按如下方式使用图标:constIconDatabaseball=constIconData(0xf3dd,fontFamily:CupertinoIcons.iconFont,fontPacka