首页 > 其他 > 详细

flutter util---->常用的一些工具方法

时间:2020-07-03 11:00:14      阅读:84      评论:0      收藏:0      [点我收藏+]

copy text to clipboard

Clipboard.setData(ClipboardData(text: string));

since Flutter1.9, you can use SelectableText, it enable the copy feature.

get text from clipboard

final clipboardData = await Clipboard.getData(Clipboard.kTextPlain);
String content = clipboardData.text;

close the keyboard

// Flutter v1.7.8+hotfix.2
FocusScope.of(context).unfocus();

// Before
FocusScope.of(context).requestFocus(FocusNode());

fix issue ListView inside ListView

add code as follow in the nested ListView

shrinkWrap: true,
physics: ClampingScrollPhysics(),

transparent appbar

Scaffold(
  extendBodyBehindAppBar: true,
  appBar: AppBar(
    backgroundColor: Colors.transparent,
    elevation: 0,
    ....
  )
)

hide the back button in the appbar

AppBar(
  automaticallyImplyLeading: false,
)

To be continue

Everything will be alright because of you.

flutter util---->常用的一些工具方法

原文:https://www.cnblogs.com/huhx/p/13228565.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!