升级FlutterSDK时报如下错误: 解决: 1、运行 flutterchannel 查看当前SDK分支 2、运行flutterchanneldev可以切换至开发版 3、再运行flutterupgrade或者flutterupgrade--force即可进行更新(加上--force强制更新)
Navigator.of(context)..pop()..pop()
问题: 解决:在项目目录下/android/app/src/main/AndroidManifest.xml中加上 android:usesCleartextTraffic="true" 最好也在 项目目录下/android/app/src/debug/AndroidManifest.xml中也把这句话加上 <applicationandroid:usesCleartextTraffic="true"/> &...
returnScaffold(appBar:AppBar(leading:newIconButton(icon:newIcon(Icons.arrow_back_ios),onPressed:()=>{Navigator.of(context).pop('刷新')},),title:Text('标题'),centerTitle:true,),body:Container(),);
解决方案: 1、将所有静态资源放在服务器,所有静态资源访问服务器。可以实现。 2、本地起个webserver,然后访问html,可以实现。 第一种方案很简单,这里不讲,着重讲第二种实现方案。 1、需要的插件 jaguar_flutter_asset:^2.2.0 //开启本地服务器的插件 webview_flutter:^0.3.9 //官方webview插件 2、工程目录 3、配置pubspec.yaml。这里有个重点:每个目录都要配置。不管层级多深 4、代码 import'package:flutte...
1、类属性意思 constTextField({Keykey,this.controller,//编辑框的控制器,跟文本框的交互一般都通过该属性完成,如果不创建的话默认会自动创建this.focusNode,//用于管理焦点this.decoration=constInputDecoration(),//输入框的装饰器,用来修改外观TextInputTypekeyboardType,//设置输入类型,不同的输入类型键盘不一样this.textInputAction,//用于控制键盘动作(一般位于右下角,默认是完成)this.textCapitalization=TextCapitali...
1、一个圆,裁剪出一段圆border ClipOval(child:Container(width:56,height:56,alignment:Alignment.center,decoration:BoxDecoration(border:Border.all(color:Colors.red,width:1),borderRadius:BorderRadius.all(Radius.circular(28)),),child:Container(),),clipper:MyClipper1(),);classMyClipper1extendsCustomClippe...
1、在使用Navigator.of(context).pop("xxxx");方法时,传值过去,xxxx随便传什么内容 2、在跳转到本页面之前的一个页面中 Navigator.push(context,MaterialPageRoute(builder:(context)=>xxpage(),)).then((data){//data就等于xxxxgetData()方法为重新获取数据方法getData()});
MediaQuery.of(context).size.width //宽度 MediaQuery.of(context).size.height //高度
1、主要是 gradient这个属性 Container(width:70,height:70,decoration:BoxDecoration(borderRadius:BorderRadius.all(Radius.circular(50)),gradient:LinearGradient(colors:[Color(0xff589429),Color(0xff6FB12F),Color(0xff8BD132),Color(0xffA8EF32),Color(0xffB7FF32),])),child:Container(),); 2、效果图 &nb...
1、在自组件中重要的是这句代码GlobalKey<_ChildState>globalKey=GlobalKey(); import'package:flutter/material.dart';GlobalKey<_ChildState>globalKey=GlobalKey();classChildextendsStatefulWidget{Child({Keykey,}):super(key:key);@override_ChildStatecreateState()=>_ChildState();}class_ChildStateextendsSt...
1、主要是 boxShadow这个属性 Container(width:50,height:50,decoration:BoxDecoration(borderRadius:BorderRadius.all(Radius.circular(28)),boxShadow:[BoxShadow(color:Colors.red,//底色,阴影颜色offset:Offset(0,0),//阴影位置,从什么位置开始blurRadius:1,//阴影模糊层度spreadRadius:0,//阴影模糊大小],),child:Container(),), 2、效果,边缘有阴影 &n...
1、代码 Container(width:50,height:50,child:CustomPaint(size:Size(50,50),painter:MyPainter(),isComplex:false,willChange:false,child:Container(),),);classMyPainterextendsCustomPainter{MyPainter();///[定义画笔]Paint_paint=Paint()..color=Colors.red//画笔颜色..strokeCap=StrokeCap.round//画笔笔触类型..isAntiAlias=true//...