网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

关于fluttermenu的信息

Flutter 22: 图解 PopupMenu 那些事儿

小菜需要处理标题栏弹出对话框 PopupMenu 样式, Flutter 当然提供了一些处理方式,类似 PopupMenuEntry 等,小菜仅就最基础的使用方式进行初步的学习和整理。

铁西网站制作公司哪家好,找创新互联!从网页设计、网站建设、微信开发、APP开发、自适应网站建设等网站项目制作,到程序开发,运营维护。创新互联于2013年开始到现在10年的时间,我们拥有了丰富的建站经验和运维经验,来保证我们的工作的顺利进行。专注于网站建设就选创新互联。

PopupMenuItem 为单个 item 的弹出样式,默认为 48px 高,可根据需求自行定义。 item 中可以自定义需要的样式,包括文字图片等一系列样式。

Tips: 若需要处理带图标的样式时,官网提供的 Demo 是借助的 ListTile 来处理的,但是小菜测试发现图标与文字距离偏大,原因在于 ListTile 默认左侧图标 leading 距离不可直接调整,建议用 Row 或其他方式调整。

CheckedPopupMenuItem 是一个带有复选标记的弹出菜单项。默认高度同样是 48px ,水平布局使用 ListTile 复选标记是 Icons.done 图标,显示在 leading 位置;同时只有在状态为选中时才会显示图标。

PopupMenuDivider 是一条水平分割线,注意数组要使用父类 PopupMenuEntry ,配合其他 item 样式共同使用。 PopupMenuDivider 可以调整高度,但无法调整颜色,有需要的话可以进行自定义。

PopupMenu 默认的弹框位置都是在右上角,且会挡住标题栏,如果有需要在其他位置弹框就需要借助 showMenu ,主要通过 position 属性定位弹框位置。

menu 的宽高与内容相关,小菜的理解是在水平和竖直方向上会将设置的 position 位置加上 menu 宽高,再与屏幕匹配,超过屏幕宽高,根据 position 按照 LTRB 顺序贴近屏幕边框展示。

Tips: 如果 item 个数过多也无需担心,Flutter 支持默认超过屏幕滑动效果。

小菜目前的学习还仅限于基本的使用,稍高级的自定义涉及较少,如果又不对的地方还希望多多指出。

flutter-动画

1.动画原理:在一段时间内快速的多次改变UI外观,由于人眼会产生视觉暂留所以最终看到的就是一个连续的动画。

UI的一次改变称为一个动画帧,对应一次屏幕刷新。

FPS:帧率,每秒的动画帧数。

flutter动画分为两类:

常见动画模式:

是一个抽象类,主要的功能是保存动画的值和状态。常用的一个Animation类是Animation double ,是一个在一段时间内依次生成一个区间之间的值的类,可以是线性或者曲线或者其他。

可以生成除double之外的其他类型值,如:Animation Color 或 Animation Size 。

是一个动画控制器,控制动画的播放状态,在屏幕刷新的每一帧,就会生成一个新的值。

包含动画的启动forward()、停止stop() 、反向播放 reverse()等方法,在给定的时间段内线性的生成从0.0到1.0(默认区间)的数字。

curve:描述动画的曲线过程。

curvedAnimation:指定动画的曲线。

常用Curve:

继承自Animatable T ,表示的就是一个 Animation 对象的取值范围,只需要设置开始和结束的边界值(值也支持泛型)。 它唯一的工作就是定义输入范围到输出范围的映射。

例如,Tween可能会生成从红到蓝之间的色值,或者从0到255。

Tween.animate:返回一个Animation。

映射过程:

1). Tween.animation通过传入 aniamtionController 获得一个_AnimatedEvaluation 类型的 animation 对象(基类为 Animation), 并且将 aniamtionController 和 Tween 对象传入了 _AnimatedEvaluation 对象。

2). animation.value方法即是调用 _evaluatable.evaluate(parent)方法, 而 _evaluatable 和 parent 分别为 Tween 对象和 AnimationController 对象。

3). 这里的 animation 其实就是前面的 AnimationController 对象, transform 方法里面的 animation.value则就是 AnimationController 线性生成的 0.0~1.0 直接的值。 在 lerp 方法里面我们可以看到这个 0.0~1.0 的值被映射到了 begin 和 end 范围内了。

接收一个TickerProvider类型的对象,它的主要职责是创建Ticker。

防止屏幕外动画消耗资源。

[图片上传失败...(image-115b94-1636441483468)]

过程:

回调:

不使用addListener()和setState()来给widget添加动画。

使用AnimatedWidget,将widget分离出来,创建一个可重用动画的widget,AnimatedWidget中会自动调用addListener()和setState()

AnimatedModalBarrier、DecoratedBoxTransition、FadeTransition、PositionedTransition、RelativePositionedTransition、RotationTransition、ScaleTransition、SizeTransition、SlideTransition

如何渲染过渡,把渲染过程也抽象出来:

AnimatedBuilder的示例包括: BottomSheet、 PopupMenu、ProgressIndicator、RefreshIndicator、Scaffold、SnackBar、TabBar。

MaterialPageRoute:平台风格一致的路由切换动画

CupertinoPageRoute:左右切换风格

自定义:PageRouteBuilder

1.要创建交织动画,需要使用多个动画对象(Animation)。

2.一个AnimationController控制所有的动画对象。

3.给每一个动画对象指定时间间隔(Interval)

可以同时对其新、旧子元素添加显示、隐藏动画.

当AnimatedSwitcher的child发生变化时(类型或Key不同),旧child会执行隐藏动画,新child会执行执行显示动画。

希望大家支持一下,感谢

[img]

Flutter Application

flutter create myApp

if wanting to specify the developing language

flutter create -i swift -a kotlin xxapp

/br/br

flutter create -t module --org com.example my_flutter

Using the File New New Module… menu in Android Studio in your existing Android project, you can either create a new Flutter module to integrate, or select an existing Flutter module that was created previously.

If you create a new module, you can use a wizard to select the module name, location, and so on.

[图片上传失败...(image-954fc0-1621912793341)]

The Android Studio plugin automatically configures your Android project to add your Flutter module as a dependency, and your app is ready to build.

[图片上传失败...(image-67093c-1621912793341)]

/br/br

flutter create --template=package xxapp_package

[图片上传失败...(image-b27285-1621912793341)]

please refer to:

Publishing packages

/br/br

flutter create --template=plugin xxapp_plugin

The whole project includes four main directories, and the corresponding Native codes are in the android and ios directories. Lib is the Flutter code of the plugin. Example is a complete Flutter App.

Before you add the android code, you need to make sure that the plug-in code is built once through the example project.

After building the Android apk package in the example project, you can open the Android project in the example project through Android Studio. Then you can edit the class file to add plug-in functionality. In the android directory, the IDE will generate an xxxplugin.java file for you. When you open it, you can see the following sample code:

There is a class FlutterPlugin that implements MethodCallHandler and a static function registerWith(which is retained to support for the old flutter version). In this static function, a new MethodChannel is created and an instance of FlutterPlugin is set to the MehodChannel. In other words, all the methodchannels and eventchannels in your plug-in are registered to the Host App through this function. the new API MethodCallHandler will be initialized and built in the onAttachedToEngine method and released in the onDetachedFromEngine method. In this way, the corresponding channel can be found when Flutter is called. we just need to rewrite the function onMethodCall.

IDE in the lib directory will automatically generate flutter_plugin.dart file for you. This is where the Flutter code of the plug-in is located. which is the packaging of Platform channels defined.

Running the following command to see if the plug-in can be published

flutter packages pub publish --dry-run

If there is a problem, it will output the error information in the terminal, and you need to modify it until it returns successfully. You can refer to the official documentation for specific problems.

At last, running the following command to publish the plug-in.

flutter packages pub publish

The registration of the plug-in is done automatically and doesn't need to register manually.

In MainActivity of example app:

GeneratedPluginRegistrant.class:

/br/br

/br/br

Flutter currently only supports building ahead-of-time (AOT) compiled libraries for x86_64, armeabi-v7a and arm64-v8a.

The Flutter engine has an x86 and x86_64 version. When using an emulator in debug Just-In-Time (JIT) mode, the Flutter module still runs correctly.

refer to:

/br/br

refer to:

A plugin for check SSL Pinning on request HTTP. Checks the equality between the known SHA-1 or SHA-256 fingerprint and the SHA-1 or SHA-256 of the target server.

There are two ways to verify the https certificate. Suppose the certificate format is PEM, the code like:

Another way is creating a SecurityContext when create the HttpClient:

In this way, the format of certificate must be PEM or PKCS12.

/br/br

sqflite

SQLite plugin for Flutter. Supports iOS, Android and MacOS.

/br/br

the official document


文章名称:关于fluttermenu的信息
转载来源:http://bjjierui.cn/article/dsoppoc.html

其他资讯