
flutter dart
hanyingzhong
这个作者很懒,什么都没留下…
展开
-
flutter Get list observable
Note about ListsLists are completely observable as are the objects within it. That way, if you add a value to a list, it will automatically rebuild the widgets that use it.You also don't need to use ".value" with lists, the amazing dart api allowed us原创 2020-11-30 11:42:47 · 470 阅读 · 1 评论 -
flutter中如何实现app的重启?
import 'package:flutter/material.dart'; void main() { runApp( RestartWidget( //使用StatefulWidget包装下 child: MaterialApp(), ), );} class RestartWidget extends StatefulWidget { RestartWidget({this.child}); final Widget child; .原创 2020-11-25 15:46:21 · 4271 阅读 · 0 评论 -
flutter ValueNotifier ValueListenableBuilder
import 'package:flutter/foundation.dart';import 'package:flutter/material.dart';class ValueListenablePage extends StatefulWidget { @override _ValueListenablePageState createState() => _ValueListenablePageState();}class _ValueListenablePageSta.原创 2020-11-25 15:07:40 · 307 阅读 · 0 评论 -
flutter dio 上传 下载 进展
//文件下载//url 下载的地址//progressCallback 下载进度变化时的回调,用来实现进度条Future<Response> dioDownload(String url, progressCallback) async { Dio dio = Dio(); CancelToken cancelToken = CancelToken();//可以用来取消操作 String docPath = await Application.fileUtil.getDocP.原创 2020-11-25 14:03:13 · 2348 阅读 · 1 评论 -
How do I check if the Flutter application is in the foreground or not?
I don't want to show notification when the app is in foreground. How can I check live state of my app?4 AnswersIn your State<...> class you need to implementWidgetsBindingObserverinterface and listen for widget state changes. Something like t..原创 2020-11-25 08:48:56 · 525 阅读 · 0 评论 -
flutter TextFormField validate
import 'dart:math';import 'package:flutter/material.dart';void main() { runApp(MyApp());}class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( home: Scaffold( appBar: AppBar.原创 2020-11-18 11:02:31 · 2139 阅读 · 0 评论 -
flutter PopupMenu
onTap: () async { final result = await showMenu( context: context, position: RelativeRect.fromLTRB(100.0, 200.0, 100.0, 100.0),// position: RelativeRect.fromLTRB(1000.0, 1000.0, 0.0, 10.0), items: <PopupMenuItem<String>>[ .原创 2020-11-17 13:24:10 · 1318 阅读 · 0 评论 -
Flutter 透明背景色弹窗
showGeneralDialog( context: context, barrierDismissible:true, barrierLabel: '', transitionDuration: Duration(milliseconds: 200), pageBuilder: (BuildContext context, Animation<double> animation,Animation<double> secondaryAnimation) {.原创 2020-11-13 15:42:28 · 3584 阅读 · 0 评论 -
flutter upload dio elfinder
IconButton( onPressed: loadAssets, icon: Icon(Icons.photo),),Future<void> loadAssets() async { List<Asset> resultList = List<Asset>(); String error = 'No Error Dectected'; try { resultList = await MultiImageP...原创 2020-11-11 10:26:29 · 195 阅读 · 0 评论 -
piwigo:接口:获取相册信息和获取相册图片列表信息
http://localhost/piwigo/ws.php?format=json&method=pwg.categories.getImages&cat_id=1{ "result": { "images": [ { "categories": [ { "id": 1, "page_url": "http://localhost/piwigo/picture.php?/2/c原创 2020-10-10 19:33:07 · 4582 阅读 · 0 评论 -
flutter:dart:get IP address of a computer name
import 'dart:io';void main() async { // ignore: prefer_typing_uninitialized_variables String connect; try { final result = await InternetAddress.lookup('DESKTOP-TR4ANSP', type: InternetAddressType.IPv4); if (result.isNotEmpty &.原创 2020-09-27 06:34:45 · 1299 阅读 · 0 评论 -
dart: Extension使用实例
扩展某个Class的能力:如果你想扩展某个系统Class的能力,不需要通过继承等的方式完成,而直接通过extension .. on 的方式进行操作。如下:/// Extends the `BuildContext` class with the ability/// to perform a lookup based on a `Bloc` type.extension BlocProviderExtension on BuildContext { /// Performs a l.原创 2020-09-11 07:03:25 · 603 阅读 · 0 评论 -
dart: dynamic List类型转换
import 'dart:async';Stream get asynchronousNaturals async* { print("Begin"); int k = 0; while (k < 3) { print("Before Yield"); yield k++; } print("End");}void testAsync() { StreamSubscription subscription = asynchronousNatura.原创 2020-09-10 10:29:21 · 5182 阅读 · 0 评论 -
flutter_bloc library
flutter_bloclibraryClassesBloc<Event,State>{@template bloc} Takes aStreamofEventsas input and transforms them into aStreamofStatesas output. {@endtemplate}BlocBuilder<C extendsCubit<S>,S>BlocBuilderhandles building ...原创 2020-09-09 14:27:18 · 182 阅读 · 0 评论 -
async* get StreamSubscription Stream
import 'dart:async';Stream get asynchronousNaturals async* { print("Begin"); int k = 0; while (k < 3) { print("Before Yield"); yield k++; } print("End");}main() { StreamSubscription subscription = asynchronousNaturals.listen(.原创 2020-09-09 11:22:31 · 173 阅读 · 0 评论 -
flutter_bloc example注释
import 'dart:async';import 'package:flutter/material.dart';import 'package:flutter_bloc/flutter_bloc.dart';/// Custom [BlocObserver] which observes all bloc and cubit instances.class SimpleBlocObserver extends BlocObserver { @override void onEv.原创 2020-09-09 10:20:28 · 190 阅读 · 0 评论