随笔分类 -  flutter+dart

上一页 1 ··· 4 5 6 7 8 9 下一页
摘要:现在的手机品牌和型号越来越多,导致我们平时写布局的时候会在个不同的移动设备上显示的效果不同, 比如我们的设计稿一个View的大小是300px,如果直接写300px,可能在当前设备显示正常,但到了其他设备可能就会偏小或者偏大,这就需要我们对屏幕进行适配。 安卓原生的话有自己的适配规则,可以根据不同的尺 阅读全文
posted @ 2019-03-26 12:22 CrossPython 阅读(2993) 评论(0) 推荐(0)
摘要:1. 插件必须渲染好, 2. 可以通过context.size获取当前控件的尺寸和位置offset信息 阅读全文
posted @ 2019-03-26 12:16 CrossPython 阅读(9905) 评论(0) 推荐(0)
摘要:在Dart中实现并发可以用Isolate,它是类似于线程(thread)但不共享内存的独立运行的worker,是一个独立的Dart程序执行环境。其实默认环境就是一个main isolate。 在Dart语言中,所有的Dart代码都运行在某个isolate中,代码只能使用所属isolate的类和值。不 阅读全文
posted @ 2019-03-25 10:31 CrossPython 阅读(1004) 评论(0) 推荐(0)
摘要:由于前面的HTTP请求用到了异步操作,不少小伙伴都被这个问题折了下腰,今天总结分享下实战成果。Dart是一个单线程的语言,遇到有延迟的运算(比如IO操作、延时执行)时,线程中按顺序执行的运算就会阻塞,用户就会感觉到卡顿,于是通常用异步处理来解决这个问题。当遇到有需要延迟的运算(async)时,将其放 阅读全文
posted @ 2019-03-25 10:17 CrossPython 阅读(2865) 评论(0) 推荐(0)
摘要:随意点开一个Widget,就会发现,可以传递一个参数Key.那这个Key到底是干啥子,有什么用呢? Flutter是受React启发的,所以Virtual Dom的diff算法也参考过来了(应该是略有修改),在diff的过程中如果节点有Key来比较的话,能够最大程度重用已有的节点(特别在列表的场景) 阅读全文
posted @ 2019-03-24 20:05 CrossPython 阅读(575) 评论(0) 推荐(0)
摘要:一个 App 通常会有多个界面,每个界面实现不同的功能,并在多个界面之间跳转。在 Flutter 中多个界面的跳转是通过 Navigator 来实现的。 在 Flutter 中定义了一个 Overlay Widget 用来管理多个界面,Overlay 里面使用 Stack 来显示当前的界面。通常不直 阅读全文
posted @ 2019-03-22 13:25 CrossPython 阅读(2310) 评论(0) 推荐(0)
摘要:paddingwrapcontainercolumnrowtextexpandedflexFractionallySizedBox 阅读全文
posted @ 2019-03-21 13:29 CrossPython 阅读(470) 评论(0) 推荐(0)
摘要:import 'package:flutter/material.dart'; void main() { runApp(MaterialApp(home: new MyApp())); } class MyApp extends StatelessWidget { var width = 80.0; var height = 60.0; @override Widg... 阅读全文
posted @ 2019-03-21 13:16 CrossPython 阅读(439) 评论(0) 推荐(0)
摘要:当需要在一个区域里面取百分比尺寸的时候,可以使用这个,比方说,高度40%宽度70%的区域。当然,AspectRatio也可以达到近似的效果。 阅读全文
posted @ 2019-03-21 12:32 CrossPython 阅读(268) 评论(0) 推荐(0)
摘要:import 'package:flutter/material.dart'; void main() { runApp(MaterialApp(home: new MyApp())); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { // TO... 阅读全文
posted @ 2019-03-21 11:49 CrossPython 阅读(516) 评论(0) 推荐(0)
摘要:The problem is not that you have not wrapped your widgets into MaterialApp. As the documentation says this error occurs due to the nesting of the same 阅读全文
posted @ 2019-03-21 09:48 CrossPython 阅读(1175) 评论(0) 推荐(0)
摘要:card ? Overlay https://docs.flutter.io/flutter/widgets/Overlay-class.html pending.... 阅读全文
posted @ 2019-03-20 21:23 CrossPython 阅读(292) 评论(0) 推荐(0)
摘要:import 'dart:ui'; var s = window.physicalSize;print(s); 阅读全文
posted @ 2019-03-20 21:22 CrossPython 阅读(3108) 评论(0) 推荐(0)
摘要:1.字符串创建(1)使用单引号,双引号创建字符串(2)使用三个引号或双引号创建多行字符串(3)使用r创建原始raw字符串(转义字符等特殊字符会输出出来,而不会自动被转义) (1)例如:String str1='Hello World';(单引号创建字符串) 例如:String str2="Hello 阅读全文
posted @ 2019-03-20 21:20 CrossPython 阅读(5571) 评论(0) 推荐(1)
摘要:https://blog.csdn.net/hekaiyou/article/details/51525156 这个不错,留着。 阅读全文
posted @ 2019-03-20 11:16 CrossPython 阅读(154) 评论(0) 推荐(0)
摘要:https://blog.csdn.net/hekaiyou/article/details/46774727 阅读全文
posted @ 2019-03-19 16:28 CrossPython 阅读(267) 评论(0) 推荐(0)
摘要:有状态widget:StatefulWidget和无状态widget:StatelessWidget 前者不需要实现Widget build(BuildContext context)。 具体的选择取决于widget是否需要管理一些状态 在Dart语言中使用下划线前缀标识符,会强制其变成私有的。 I 阅读全文
posted @ 2019-03-19 16:26 CrossPython 阅读(552) 评论(0) 推荐(0)
摘要:audio_recorder: any #录音、播放 flutter_sound: ^1.1.5#录音 dropdown_menu: ^1.1.0#下拉菜单 simple_permissions:#权限获取 easy_alert:#弹框 amap_location: any #高德地图 locati 阅读全文
posted @ 2019-03-19 16:10 CrossPython 阅读(4183) 评论(1) 推荐(0)
摘要:Dart基础入门语法介绍,详细说明可以查看相关视频《Dart编程语言入门》。 变量与常量 变量与常量 变量 变量 1.使用 var 声明变量,默认值为 null 1.使用 var 声明变量,默认值为 null var a;//null a = 10; 2.显示类型声明 2.显示类型声明 int a; 阅读全文
posted @ 2019-03-19 11:04 CrossPython 阅读(454) 评论(0) 推荐(0)
摘要:python贪婪和非贪婪 正则表达式通常用于在文本中查找匹配的字符串。Python里数量词默认是贪婪的(在少数语言里也可能是默认非贪婪),总是尝试匹配尽可能多的字符;非贪婪则相反,总是尝试匹配尽可能少的字符。在"*","?","+","{m,n}"后面加上?,使贪婪变成非贪婪。 >>> s="Thi 阅读全文
posted @ 2019-02-06 20:03 CrossPython 阅读(1406) 评论(0) 推荐(0)

上一页 1 ··· 4 5 6 7 8 9 下一页