1.让所有的输入框失去第一响应者(失去焦点)
FocusScope.of(context).requestFocus(FocusNode());
2.release包无法请求网络
android\app\src\profile\AndroidManifest.xml 文件中
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mahaomeng.duodian">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
</manifest>
android/src/main/AndroidManifest.xml 文件中
·
·
·
</application>
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
</manifest>
3.富文本
RichText(
textAlign: TextAlign.center,
text: TextSpan(
// text: '登陆即同意',
// style: TextStyle(fontSize: 14, color: Colors.black),
children: [
TextSpan(
text: '《协议1》',
style: TextStyle(fontSize: 20, color: Colors.black),
),
TextSpan(
text: ' 以及 ',
style: TextStyle(fontSize: 40, color: Colors.orangeAccent),
),
TextSpan(
text: '《协议2》',
style: TextStyle(fontSize: 20, color: Colors.black),
),
],
),
),
4.圆角
ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(75)),
child: MaterialButton(
minWidth: 150,
height: 150,
color: Colors.blue,
child: Text(
'开始抢',
style: TextStyle(
fontSize: 20,
color: Colors.white
)
),
onPressed: () {
print('点击了开始抢');
},
),
)
5.页面间传值
// A页面
Navigator.push(context, MaterialPageRoute(builder: (BuildContext context) {
return SelectListPage(dataList: _storeInfos);
})).then((value){ // 注:直接点击返回按钮也会触发then
if (value != null) {
_storeInfo = value;
setState(() {});
}
});
// B页面返回A页面
Navigator.pop(context, {value});