Flutter炒的很火,各种吹嘘多好多好。
抱着试试看的心态学了学,立马就被Flutter奇葩的语法和理念击垮了......
这是什么鬼语言?
我要列举一下Flutter最让我费解的一些语法特点:
1. 无穷的嵌套层级,让人反感的代码结构。
@override
Widget build(BuildContext context) {
return Container(
child: Scaffold(
appBar: AppBar(
title: Text("Welcome to Flutter!"),
),
body: this._pageList[_currentIndex],
bottomNavigationBar: BottomNavigationBar(
items: [
BottomNavigationBarItem(
icon: Icon(Icons.home),
title: Text("首页"),
),
BottomNavigationBarItem(
icon: Icon(Icons.category),
title: Text("分类"),
),
],
type: BottomNavigationBarType.fixed,
currentIndex: _currentIndex,
onTap: (index) {
setState(() {
this._currentIndex = index;
});
},
),
),
);
}
之前写i