草庐IT

flutter-i

全部标签

android - Flutter - 当用户移动到其他(预览)屏幕时如何正确暂停相机?

当我移动到导航树上的另一个屏幕时,我需要暂停相机以节省电池和性能。我尝试dispose()cameraController,但是当它从另一个屏幕返回时,flutter不会重新初始化状态(虽然很明显)。我使用相机的主要代码:@overridevoidinitState(){super.initState();availableCameras().then((cameras){setState((){_firstCamera=cameras.first;_controller=CameraController(_firstCamera,ResolutionPreset.high);_ini

flutter - 无法将 Row 下拉

我正在尝试将行拉到横轴的末端(到屏幕底部)。import'package:flutter/material.dart';import'package:flutter/rendering.dart';import'package:flutter/widgets.dart';import'package:provider/provider.dart';voidmain()=>runApp(MyApp());classMyAppextendsStatelessWidget{@overrideWidgetbuild(BuildContextcontext){//TODO:implementbu

flutter - 无法将 Row 下拉

我正在尝试将行拉到横轴的末端(到屏幕底部)。import'package:flutter/material.dart';import'package:flutter/rendering.dart';import'package:flutter/widgets.dart';import'package:provider/provider.dart';voidmain()=>runApp(MyApp());classMyAppextendsStatelessWidget{@overrideWidgetbuild(BuildContextcontext){//TODO:implementbu

flutter - 按钮文字颜色变化

我正在构建一个简单的测验应用程序作为一个学习项目。我只想更改单击按钮的颜色。现在它改变了所有按钮的颜色。我试图制作一个颜色列表,这样每个按钮都可以从列表中获取它的颜色。class_AnwserButtonsStateextendsState{Colorcolor=Colors.black;@overrideWidgetbuild(BuildContextcontext){returnContainer(height:200,child:ListView(children:widget.anwsers.map((anwser)=>RaisedButton(child:Text(anwse

flutter - 按钮文字颜色变化

我正在构建一个简单的测验应用程序作为一个学习项目。我只想更改单击按钮的颜色。现在它改变了所有按钮的颜色。我试图制作一个颜色列表,这样每个按钮都可以从列表中获取它的颜色。class_AnwserButtonsStateextendsState{Colorcolor=Colors.black;@overrideWidgetbuild(BuildContextcontext){returnContainer(height:200,child:ListView(children:widget.anwsers.map((anwser)=>RaisedButton(child:Text(anwse

flutter - 是否有可能监听许多 BloC 的状态?

在询问Flutter中的状态管理(DifferencebetweenChangeNotifierProviderandScopedModelinFlutter)而没有任何答案后,我决定使用BLoCPackage在我看来,这似乎是最清晰和最容易使用的。现在在我的flutter应用程序中,我有BlocA、BlocB和BlocC,我想从BlocC监听BlocA和BlocB的状态变化。所有区block上具有相同状态/事件的示例(更新、更新/更新):classBlocCextendsBloc{finalBlocAa;finalBlocBb;StreamSubscriptionaSubscript

flutter - 是否有可能监听许多 BloC 的状态?

在询问Flutter中的状态管理(DifferencebetweenChangeNotifierProviderandScopedModelinFlutter)而没有任何答案后,我决定使用BLoCPackage在我看来,这似乎是最清晰和最容易使用的。现在在我的flutter应用程序中,我有BlocA、BlocB和BlocC,我想从BlocC监听BlocA和BlocB的状态变化。所有区block上具有相同状态/事件的示例(更新、更新/更新):classBlocCextendsBloc{finalBlocAa;finalBlocBb;StreamSubscriptionaSubscript

flutter - Paragraph 类的 Flutter 宽度指标是什么意思?

documentationforParagraph有四种不同的方法来获取宽度距离:width→doubleTheamountofhorizontalspacethisparagraphoccupies.longestLine→doubleThedistancefromtheleftedgeoftheleftmostglyphtotherightedgeoftherightmostglyphintheparagraph.maxIntrinsicWidth→doubleReturnsthesmallestwidthbeyondwhichincreasingthewidthneverdecr

flutter - Paragraph 类的 Flutter 宽度指标是什么意思?

documentationforParagraph有四种不同的方法来获取宽度距离:width→doubleTheamountofhorizontalspacethisparagraphoccupies.longestLine→doubleThedistancefromtheleftedgeoftheleftmostglyphtotherightedgeoftherightmostglyphintheparagraph.maxIntrinsicWidth→doubleReturnsthesmallestwidthbeyondwhichincreasingthewidthneverdecr

flutter - 如何从一个屏幕转到另一个屏幕,从堆栈中清除所有以前的屏幕?

在我的Flutter项目中,我有三个屏幕-Screen0、Screen1、Screen2。现在,从screen0,我可以通过单击按钮转到screen1,然后从screen1我们可以通过按钮转到screen2。在screen2中,我有一个用于返回到screen0的按钮。由于Screen0是初始屏幕,我想在返回到Screen0时清除之前的所有屏幕,并且不想像这张图片中那样有任何后退选项-这是我的代码-主.dartimport'package:flutter/material.dart';import'screen0.dart';import'screen1.dart';import'scr