我有一个GestureDetector自定义的无状态视图。当onTap触发时,我会显示一个显示一些信息的小吃店。当用户快速进行多次点击时,它会永远显示小吃店。
GestureDetector(
onTap: () {
Clipboard.setData(new ClipboardData(text: idText));
Scaffold.of(context).showSnackBar(SnackBar
(content: Text('ID copied')));
},
child: Icon(Icons.content_copy,),
}
Run Code Online (Sandbox Code Playgroud)
我想onTap在可以再次单击之前禁用几秒钟。
所以我试图重新创建一个 UI 模板。这是代码。我试图通过调用最近查看()添加另一个水平 GridView,但在重新加载时无法呈现。我不知道渲染这个的方法。我曾尝试使用扩展的小部件和灵活的但都不起作用
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
backgroundColor: Colors.blueGrey[50],
centerTitle: true,
title: Text(
'Engagement Rings',
style: TextStyle(
fontWeight: FontWeight.bold,
),
),
),
resizeToAvoidBottomPadding: false,
body: SingleChildScrollView(
child: Column(
children: <Widget>[
//Padding
new Padding(padding: const EdgeInsets.all(8.0),),
//Horizontal List
picSlides(),
//Padding
SizedBox(height: 10.0),
//Grid View
Container(
height: 100.0,
child: Column(
children: <Widget>[
Align(
alignment: Alignment.topLeft,
child: Text(
'Engagement Rings',
textAlign: TextAlign.left,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20.0,
),
),
),
Align(
alignment: Alignment.centerLeft,
child: Text(
'bhjbsdbskjksbdknbsdnbbskdbbsdk',
textAlign: TextAlign.left,
), …Run Code Online (Sandbox Code Playgroud) 我正在制作一个颤振应用程序,其中我需要两个放置一个小部件,这对于多个屏幕来说很常见。这是屏幕一的构建方法的代码
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: app_color,
body: _isLoading == false ? Stack(
new Container(//used for whole screen ),
Positioned(
left: 0,
right: 0,
bottom: 0,
//a bottom tab like which is common across screens
),
],
)
:
//code to show progress indicator while loading data in background
Stack(
children: <Widget>[
Center(
child:Container(
height: 50,
width: 50,
child: CircularProgressIndicator(),
)
),
Positioned(
left: 0,
right: 0,
bottom: 0,
//keep this to show bottom tab while loading
), …Run Code Online (Sandbox Code Playgroud) 我想要一个像图片中那样的滚动条视图。
那么我怎样才能使用颤振呢?
我试过了
SingleChildScrollView(
....
),
Run Code Online (Sandbox Code Playgroud)
但是没有出现滚动条,我不知道如何制作它们
我想print在我的班级中有一个方法,我也希望能够print在其中使用
例子:
class A {
String val;
void print() {
print(val);
}
}
Run Code Online (Sandbox Code Playgroud)
usingprint会引用 class 的方法A,如何指定要调用的方法的完整路径?