草庐IT

mobile-sharing

全部标签

mobile - Flutter 无法更改路由,因为 undefined name context with PopupMenuButton 如何解决?

我想单击一个项目菜单(PopupMenuItem)并使用Navigator.push转到另一条路线,但方法内未定义上下文。import'package:flutter/material.dart';voidmain()=>runApp(newMyApp());classMyAppextendsStatelessWidget{finalListchoices=const[constChoice(title:'Settings',icon:Icons.settings),constChoice(title:'Logout',icon:Icons.exit_to_app),];@overri

mobile - Flutter 无法更改路由,因为 undefined name context with PopupMenuButton 如何解决?

我想单击一个项目菜单(PopupMenuItem)并使用Navigator.push转到另一条路线,但方法内未定义上下文。import'package:flutter/material.dart';voidmain()=>runApp(newMyApp());classMyAppextendsStatelessWidget{finalListchoices=const[constChoice(title:'Settings',icon:Icons.settings),constChoice(title:'Logout',icon:Icons.exit_to_app),];@overri

mobile - 如何从 Dart 中的异步数据中提取?

我正在尝试读取文件(异步)并返回数据列表。然后,我想在每个给定的数字都是线高时使用CustomPainter画线(我想画多条线)classBarChartPainterextendsCustomPainter{@overridepaint(Canvascanvas,Sizesize){finalpaint=newPaint()..color=AppColors.primaryColor..style=PaintingStyle.fill;varfuturePath=run();futurePath.then((height){print('1:$height');for(varline

mobile - 如何从 Dart 中的异步数据中提取?

我正在尝试读取文件(异步)并返回数据列表。然后,我想在每个给定的数字都是线高时使用CustomPainter画线(我想画多条线)classBarChartPainterextendsCustomPainter{@overridepaint(Canvascanvas,Sizesize){finalpaint=newPaint()..color=AppColors.primaryColor..style=PaintingStyle.fill;varfuturePath=run();futurePath.then((height){print('1:$height');for(varline

mobile - Flutter Tabs 抛出空指针异常 -> Material.of(context).color 计算为 null

我正在关注找到的flutter画廊中提供的示例expansiona_panels_demo.darthere.我的目标是在扩展面板主体中引入TabBar和TabBarView。截至目前,这正在中断,因为在tabs.dart中抛出了一个空指针异常。这是在_TabBarState中,它正在与widget.indicatorColor进行比较。如果您要查看演示,我将尝试在第251行调用newBookTabs()。if(color.value==Material.of(context).color.value)这里Material.of(context).color为空为了整合代码,我将选项卡

mobile - Flutter Tabs 抛出空指针异常 -> Material.of(context).color 计算为 null

我正在关注找到的flutter画廊中提供的示例expansiona_panels_demo.darthere.我的目标是在扩展面板主体中引入TabBar和TabBarView。截至目前,这正在中断,因为在tabs.dart中抛出了一个空指针异常。这是在_TabBarState中,它正在与widget.indicatorColor进行比较。如果您要查看演示,我将尝试在第251行调用newBookTabs()。if(color.value==Material.of(context).color.value)这里Material.of(context).color为空为了整合代码,我将选项卡

mobile - 卡片布局 - Flutter

我正在尝试使用flutter构建一张卡片,看起来像下面显示的概念,但我得到的却是这个。这是Dart中的卡片小部件代码:@overrideWidgetbuild(BuildContextcontext){returnCenter(child:Card(margin:EdgeInsets.symmetric(horizontal:14.0),color:Colors.white,elevation:6.0,child:InkWell(splashColor:Colors.blue.withAlpha(30),onLongPress:(){_copy();},onTap:(){},child

mobile - 卡片布局 - Flutter

我正在尝试使用flutter构建一张卡片,看起来像下面显示的概念,但我得到的却是这个。这是Dart中的卡片小部件代码:@overrideWidgetbuild(BuildContextcontext){returnCenter(child:Card(margin:EdgeInsets.symmetric(horizontal:14.0),color:Colors.white,elevation:6.0,child:InkWell(splashColor:Colors.blue.withAlpha(30),onLongPress:(){_copy();},onTap:(){},child

Flutter 数据存储--shared_preferences使用详情

1.shared_preferences介绍shared_preferences主要的作用是用于将数据异步持久化到磁盘,因为持久化数据只是存储到临时目录,当app删除时该存储的数据就是消失,web开发时清除浏览器存储的数据也将消失。支持存储类型:boolintdoublestringstringListshared_preferences应用场景主要用于持久化数据,如持久化用户信息、列表数据等。持久化用户信息因为用户信息基本是不改变的,而在一个应用程序中常常会有多个页面需要展示用户信息,我们不可能每次都去获取接口,那么本地持久化就会变得很方便。持久化列表数据为了给用户更好的体验,在获取列表数据

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