![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Flutter
赵健zj
致力于移动端(Android/IOS/Flutter/C++/音视频)生态的学习
展开
-
Flutter之Overlay(弹窗)
资料Flutter之使用overlay显示悬浮控件类似于Toast的弹窗class Toast { // 自定义Toast static void show({ required BuildContext context, required String message, }) { // 创建一个OverlayEntry对象 OverlayEntry overlayEntry = new OverlayEntry(builder: (context) {原创 2022-02-14 18:00:26 · 6350 阅读 · 0 评论 -
Flutter之extension
扩展在基本数据类型的应用extension IntExtension on int { toSay() { print('IntExtension Hello~'); }}extension StringExtension1 on String { // 字符串转换成Color对象 toColor() { var hexColor = this.replaceAll("#", ""); if (hexColor.length == 6) { hex原创 2022-02-14 14:40:28 · 2166 阅读 · 0 评论 -
Flutter之pigeon
资源pigeon: ^1.0.17packages/packages/pigeonFlutter官方推荐插件开发辅助工具-Pigeon安装dart pub add pigeonpubspec.yamldependencies: flutter: sdk: flutter pigeon: ^1.0.7 ...步骤1. 创建一个messages.dart模版文件messages.dartimport 'package:pigeon/pigeon.dart';cl原创 2022-02-10 14:55:48 · 2402 阅读 · 0 评论 -
Flutter之导航返回拦截(WillPopScope)
WillPopScope原创 2022-02-08 14:58:39 · 901 阅读 · 0 评论 -
Flutter之FutureBuilder
资料githubgit@github.com:AdrianAndroid/flutter_project.git分支 : learn-futurebuilder步骤在widget中创建FutureBuilder小组件Center( child : FutureBuilder<String> ( future : Future<String>, // 将要运行的Future<String>, 范型是一样的 initialData : 'App Name原创 2022-02-08 11:08:10 · 921 阅读 · 0 评论 -
Flutter之InAppWebView 官方例子转发
资料官方文档源码pubspec.yamlname: flutter_projectdescription: A new Flutter project.publish_to: 'none' # Remove this line if you wish to publish to pub.devversion: 1.0.0+1environment: sdk: '>=2.12.0 <3.0.0'dependencies: dio: ^4.0.4 cupertino_i原创 2022-01-28 15:57:46 · 3231 阅读 · 0 评论 -
Flutter之Migrating to null safety
资料Mirgating to null safety步骤在命令行输入如下命令,检查依赖状态dart pub outdated --mode=null-safety如果需要更新dart pub getMigratedart migrate原创 2022-01-24 18:12:55 · 1424 阅读 · 0 评论 -
Flutter之FutureProvider
资料Flutter中的Provider(五)-异步刷新-FutureProvider代码import 'package:flutter/foundation.dart';import 'package:flutter/material.dart';import 'package:provider/provider.dart';void main() => runApp(MyApp());// class Home {// final String city = "Portlan原创 2022-01-21 11:00:03 · 1716 阅读 · 0 评论 -
Flutter之StreamProvider
资料暂无代码import 'dart:async';import 'package:flutter/material.dart';import 'package:provider/provider.dart';void main() { runApp(MyApp());}class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { // return Stre原创 2022-01-21 10:32:33 · 1697 阅读 · 0 评论 -
Flutter之InheritedWidget
InheritedWidget原创 2022-01-20 17:49:55 · 640 阅读 · 0 评论 -
Flutter之ChangeNotifier Provider学习
最简单的使用上代码import 'package:flutter/material.dart';void main() { runApp(MyApp());}class MyApp extends StatelessWidget { // This widget is the root of your application. @override Widget build(BuildContext context) { return MaterialApp(原创 2022-01-18 16:15:19 · 1791 阅读 · 0 评论 -
Flutter之TextFormField中prefixIcon撑满了整个Field
大家有没有遇到过这种情况, prefixIcon中国添加了饿Row,导致覆盖了整个Field区域。后来发现设置了mainAxisSize: MainAxisSize.min这个属性之后,就可以满足条件了以下是完整代码,仅供参考:ThemeButton _buildPrefixButton() { return ThemeButton( onPressed: () async { if (widget.onPressSelectCountry != null) {原创 2022-01-11 14:59:44 · 1484 阅读 · 0 评论 -
搭建Flutter Engine源码编译环境
资料搭建Flutter Engine源码编译环境原创 2022-01-11 10:11:54 · 2855 阅读 · 1 评论 -
Flutter之Dart中的Future
资料Flutter异步编程-Future事件循环EventLoopEvent Queue 主要包含IO、手势、绘制、定时器(Timer)、Stream流以及本文所讲Future等MicroTask Queue 主要包含Dart内部的微任务(内部非常短暂操作),一般是通过 scheduleMicroTask 方法实现调度,它的优先级比Event Queue要高事件循环执行的流程Future的几种情况1. factory Future(FutureOr computation())//F原创 2022-01-04 14:21:43 · 1340 阅读 · 0 评论 -
Flutter之provider
逐步完善…资料Flutter学习笔记之Provider 5.0.0入门级使用原创 2021-12-28 17:09:52 · 1167 阅读 · 0 评论 -
Flutter desktop ProcessException: Operation not permitted
资料[macos] Flutter desktop app becomes unresponsive while trying to read a user directory #73551问题flutter: TAG scrcpy-x21[ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: ProcessException: Operation not permitted Command: scrcpy --wind原创 2021-09-08 14:09:16 · 801 阅读 · 0 评论 -
Flutter之provider
资料Flutter状态管理Provider,简单上手步骤第一步:添加provider依赖provider: ^2.0.1+1pub地址:https://pub.dev/packages/provider第二步:创建Modelimport 'package:provider/provider.dart';class Counter with ChangeNotifier {//1 int _count; Counter(this._count); void add() {原创 2020-09-21 21:04:45 · 366 阅读 · 0 评论 -
Flutter之Wrap
import 'package:flutter/cupertino.dart';import 'package:flutter/material.dart';class WrapWidget extends StatefulWidget { final String title; const WrapWidget({Key key, this.title}) : super(ke...原创 2020-02-15 23:50:26 · 225 阅读 · 0 评论 -
Flutter之Flex
import 'package:flutter/cupertino.dart';import 'package:flutter/material.dart';class FlexWidget extends StatefulWidget { @override State<StatefulWidget> createState() { // TODO: imple...原创 2020-02-15 22:21:31 · 250 阅读 · 0 评论 -
Flutter之Dart基本语法学习
1.3 Future.whenComplete 无论成功失败都要做一些事情。3.2 使用async/await 消除callback hell。3.1 可选的位置参数。3.2 可选的命名参数。原创 2020-02-15 20:19:17 · 377 阅读 · 1 评论 -
Flutter之ListView
资料三、Flutter基础—ListView入门基础用法import 'package:flutter/cupertino.dart';import 'package:flutter/material.dart';class ListViewPage extends StatefulWidget { @override State<StatefulWidget> c...原创 2020-02-15 20:19:05 · 440 阅读 · 0 评论 -
Flutter之GridView
#资料基本import 'package:flutter/cupertino.dart';import 'package:flutter/material.dart';class GridViewWidget extends StatelessWidget { @override Widget build(BuildContext context) { return S...原创 2020-02-15 20:18:55 · 165 阅读 · 0 评论 -
Flutter之CustomScrollView
class CustomScrollViewWidget extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( body: CustomScrollView( slivers: <Widget>[ ...原创 2020-02-15 20:18:36 · 574 阅读 · 0 评论 -
CSDN博客-A tour of the Dart language
A basic Dart program// Define a function.printInteger(int aNumber) { print('The number is $aNumber.'); // Print to console.}// This is where the app starts executing.main() { var number = 42...原创 2019-06-27 10:29:41 · 478 阅读 · 0 评论 -
Flutter基础-RaisedButton
SampleWidget build(BuildContext context) { return Center( child: Column( mainAxisSize: MainAxisSize.min, children: <Widget>[ const RaisedButton( onPressed: n...原创 2019-06-24 15:20:22 · 575 阅读 · 0 评论 -
Flutter基础-IconButton
0Sampledouble _volume = 0.0;// ...Widget build(BuildContext context) { return Scaffold( body: Center( child: Column( mainAxisSize: MainAxisSize.min, children: <Wid...原创 2019-06-24 15:10:29 · 3272 阅读 · 0 评论 -
Flutter基础-FloatingActionButton
SampleWidget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text('Floating Action Button Sample'), ), body: Center( child: Text('Press the button belo...原创 2019-06-24 15:07:00 · 723 阅读 · 0 评论 -
Flutter基础-Parse JSON in the background
Add the http packageMake a network request using the http package.Convert the response into a list photosMove this work to a separate isolate.1. Add the http packagedependencies: http: <la...原创 2019-06-24 17:41:21 · 312 阅读 · 0 评论 -
Flutter基础-FlatButton
#SampleFlatButton( color: Colors.blue, textColor: Colors.white, disabledColor: Colors.grey, disabledTextColor: Colors.black, padding: EdgeInsets.all(8.0), splashColor: Colors.blueAccent,...原创 2019-06-24 14:59:28 · 1515 阅读 · 0 评论 -
Flutter基础-Adding assets and images
Specifying assetspubspec.yamlflutter: assets: - assets/my_icon.png - assets/background.pngflutter: assets: - assets/Asset bundlingAsset variants .../pubspec.yaml .../graphics...原创 2019-06-24 16:21:05 · 356 阅读 · 0 评论 -
Flutter基础-Fetch data from the internet
This recipe uses the following steps.Add the http package.Make a network request using the http package.Convert the response into a custom Dart object.Fetch and display the data with Flutter.1....原创 2019-06-24 17:03:39 · 365 阅读 · 0 评论 -
Flutter基础-Make authenticated requests
Add authorization headersFuture<http.Response> fetchPost() { return http.get( 'https://jsonplaceholder.typicode.com/posts/1', // Send authorization headers to the backend. headers...原创 2019-06-24 17:26:42 · 144 阅读 · 0 评论 -
Flutter Go 代码开发规范0.1.0版本
Flutter Go 代码开发规范 0.1.0 版代码风格标识符三种类型大驼峰类、枚举、typedef和类型参数 class SliderMenu { ... } class HttpRequest { ... } typedef Predicate = bool Function<T>(T value);包括用于元数据注释的类 class Fo...原创 2019-06-28 10:11:49 · 225 阅读 · 0 评论 -
VSCode运行flutter出现白屏 --enable-software-rendering
VSCode先运行flutter的时候出现白屏命令行出现如下错误:E/flutter ( 2918): [ERROR:flutter/shell/gpu/gpu_surface_gl.cc(58)] Failed to setup Skia Gr context.这是在x86情况下遇到的问题。配置下命令行就可以了找到Add Configuration配置选项添加Dart/Flutte...原创 2019-07-20 13:23:51 · 2875 阅读 · 0 评论 -
flutter-基础控件
资料Flutter 控件之 ScaffoldWidgetScaffoldScaffold 有下面几个主要属性:appBar:显示在界面顶部的一个 AppBar,也就是 Android 中的 ActionBar 、Toolbarbody:当前界面所显示的主要内容 WidgetfloatingActionButton:纸墨设计中所定义的 FAB,界面的主要功能按钮persistent...原创 2019-06-23 09:08:30 · 161 阅读 · 0 评论 -
Flutter基础-DropdownButton
SampleString dropdownValue = 'One';// ...Widget build(BuildContext context) { return Scaffold( body: Center( child: DropdownButton<String>( value: dropdownValue, ...原创 2019-06-24 14:44:43 · 2443 阅读 · 0 评论 -
Flutter基础-Form
#Samplefinal _formKey = GlobalKey<FormState>();@overrideWidget build(BuildContext context) { return Form( key: _formKey, child: Column( crossAxisAlignment: CrossAxisAlignment...原创 2019-06-24 13:58:14 · 162 阅读 · 0 评论 -
Flutter基础-Adding interactivity to your Flutter
Creating a stateful widgetStep 0: Get readyStep1: Decide which object manages the widget’s stateStep2: Subclass StatefulWidgetclass FavoriteWidget extends StatefulWidget { @override _FavoriteW...原创 2019-06-24 13:37:44 · 197 阅读 · 0 评论 -
Flutter官网-Return data from a screen
import 'package:flutter/material.dart';void main() { runApp(MaterialApp( title: 'Returning Data', home: HomeScreen(), ));}class HomeScreen extends StatelessWidget { @override Widg...原创 2019-06-23 09:09:58 · 178 阅读 · 0 评论 -
Flutter官网-Place a floating app bar above a list
import 'package:flutter/foundation.dart';import 'package:flutter/material.dart';void main() => runApp(MyApp());class MyApp extends StatelessWidget { MyApp({Key key}) : super(key: key); @o...原创 2019-06-23 09:09:34 · 199 阅读 · 0 评论