通过最近一段时间对flutter的学习,基本掌握了flutter组件的用法
基本的row,comlum,text,image布局 其实还看了一下stack布局的用法
感觉这个布局类似于framelayout布局,关键在于Position的设置
avatarContainer = Stack(
overflow: Overflow.visible,
children: [
avatar,
Positioned(
right: -6.0,
top: -6.0,
child: unreadMsgCountText,
)
],
);
关于手势监听GestureDetector的使用,触摸时间的处理
return GestureDetector(
onVerticalDragDown: (DragDownDetails details) {
setState(() {
widget._indexBarBg = Colors.black26;
widget._currentLetter = _getLetter(context, _tileHeight, details.globalPosition);
_jumpToIndex(widget._currentLetter);
});
},
onVerticalDragEnd: (DragEndDetails details) {
setState(() {
widget._indexBarBg = Colors.transparent;
widget._currentLetter = null;
});
},
onVerticalDragCancel: () {
setState(() {
widget._indexBarBg = Colors.transparent;
widget._currentLetter = null;
});
},
onVerticalDragUpdate: (DragUpdateDetails details) {
setState(() {
widget._indexBarBg = Colors.black26;
widget._currentLetter = _getLetter(context, _tileHeight, details.globalPosition);
_jumpToIndex(widget._currentLetter);
});
},
child: Column(
children: _letters,
),
);
,组件之间的路由跳转.有参和无参的传递
onTap: () {
Navigator.push(context, MaterialPageRoute(builder: (context) {
return CommomWebPage(item.title, item.url);
}));
},