mirror of
https://github.com/alibaba/flutter-go.git
synced 2025-07-15 03:04:25 +08:00
refactor(conflict):
This commit is contained in:
@ -30,8 +30,8 @@ class _AppBarLessDefaultComplex extends State with SingleTickerProviderStateMixi
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_scrollViewController = new ScrollController();
|
||||
_tabController = new TabController(vsync: this, length: 6);// 和下面的 TabBar.tabs 数量对应
|
||||
_scrollViewController = ScrollController();
|
||||
_tabController = TabController(vsync: this, length: 6);// 和下面的 TabBar.tabs 数量对应
|
||||
}
|
||||
|
||||
@override
|
||||
@ -46,26 +46,26 @@ class _AppBarLessDefaultComplex extends State with SingleTickerProviderStateMixi
|
||||
// 如果省略了 leading ,但 AppBar 在带有 Drawer 的 Scaffold 中,则会插入一个 button 以打开 Drawer。
|
||||
// 否则,如果最近的 Navigator 具有任何先前的 router ,则会插入BackButton。
|
||||
// 这种行为可以通过设置来关闭automaticallyImplyLeading 为false。在这种情况下,空的 leading widget 将导致 middle/title widget 拉伸开始。
|
||||
return new SizedBox(
|
||||
return SizedBox(
|
||||
height: 500,
|
||||
child:new AppBar( // 大量配置属性参考 SliverAppBar 示例
|
||||
title: new Text('title'),
|
||||
leading: new Icon(Icons.home),
|
||||
child: AppBar( // 大量配置属性参考 SliverAppBar 示例
|
||||
title: Text('title'),
|
||||
leading: Icon(Icons.home),
|
||||
backgroundColor: Colors.amber[500],
|
||||
centerTitle: true,
|
||||
actions: <Widget>[
|
||||
new IconButton(
|
||||
icon: new Icon(Icons.add_alarm),
|
||||
IconButton(
|
||||
icon: Icon(Icons.add_alarm),
|
||||
tooltip: 'Add Alarm',
|
||||
onPressed: () {
|
||||
// do nothing
|
||||
}),
|
||||
new PopupMenuButton<String>(
|
||||
PopupMenuButton<String>(
|
||||
itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[
|
||||
new PopupMenuItem<String>(
|
||||
value: "price", child: new Text('Sort by price')),
|
||||
new PopupMenuItem<String>(
|
||||
value: "time", child: new Text('Sort by time')),
|
||||
PopupMenuItem<String>(
|
||||
value: "price", child: Text('Sort by price')),
|
||||
PopupMenuItem<String>(
|
||||
value: "time", child: Text('Sort by time')),
|
||||
],
|
||||
onSelected: (String action) {
|
||||
switch (action) {
|
||||
@ -78,16 +78,16 @@ class _AppBarLessDefaultComplex extends State with SingleTickerProviderStateMixi
|
||||
}
|
||||
})
|
||||
],
|
||||
bottom: new TabBar(
|
||||
bottom: TabBar(
|
||||
isScrollable: true,
|
||||
controller: _tabController,
|
||||
tabs: <Widget>[
|
||||
new Tab(text: "Tabs 1"),
|
||||
new Tab(text: "Tabs 2"),
|
||||
new Tab(text: "Tabs 3"),
|
||||
new Tab(text: "Tabs 4"),
|
||||
new Tab(text: "Tabs 5"),
|
||||
new Tab(text: "Tabs 6"),
|
||||
Tab(text: "Tabs 1"),
|
||||
Tab(text: "Tabs 2"),
|
||||
Tab(text: "Tabs 3"),
|
||||
Tab(text: "Tabs 4"),
|
||||
Tab(text: "Tabs 5"),
|
||||
Tab(text: "Tabs 6"),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -107,7 +107,7 @@ class AppBarLessDefaultSimple extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new SizedBox(
|
||||
return SizedBox(
|
||||
height: 200,
|
||||
child:AppBar(
|
||||
title: Text('My Fancy Dress'),
|
||||
|
@ -62,7 +62,7 @@ class _DemoState extends State<Demo> {
|
||||
*/
|
||||
Widget allDomes(BuildContext context, _DemoState that) {
|
||||
return Container(
|
||||
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
||||
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
||||
child: Column(
|
||||
//mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
@ -84,7 +84,7 @@ Widget allDomes(BuildContext context, _DemoState that) {
|
||||
* 带align的text
|
||||
* */
|
||||
Widget textAlignBar(String txt) {
|
||||
return new Align(
|
||||
return Align(
|
||||
alignment: FractionalOffset.centerLeft,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
|
@ -21,7 +21,7 @@ class AppBarLessDefaultSimple extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new SizedBox(
|
||||
return SizedBox(
|
||||
height: 100,
|
||||
child: Scaffold(
|
||||
//appBar: AppBar(title: const Text('Bottom App Bar')),
|
||||
|
@ -38,7 +38,7 @@ class _DemoState extends State<Demo> {
|
||||
Widget build(BuildContext context) {
|
||||
return WidgetDemo(
|
||||
title: 'BottomAppBar',
|
||||
codeUrl: 'componentss/Bar/BottomAppBar/demo.dart',
|
||||
codeUrl: 'components/Bar/BottomAppBar/demo.dart',
|
||||
contentList: [allDomes(context, this)],
|
||||
docUrl: 'https://docs.flutter.io/flutter/material/BottomAppBar-class.html',
|
||||
);
|
||||
@ -52,7 +52,7 @@ class _DemoState extends State<Demo> {
|
||||
*/
|
||||
Widget allDomes(BuildContext context, _DemoState that) {
|
||||
return Container(
|
||||
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
||||
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
||||
child: Column(
|
||||
//mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
|
@ -44,9 +44,9 @@ class ButtonBarLessDefault extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
margin: new EdgeInsets.symmetric(vertical: 0.0),
|
||||
margin: EdgeInsets.symmetric(vertical: 0.0),
|
||||
height: 100.0,
|
||||
child: new Scrollbar(child:ListView(
|
||||
child: Scrollbar(child:ListView(
|
||||
scrollDirection: Axis.horizontal, // 水平listView
|
||||
children: <Widget>[
|
||||
ButtonBar(
|
||||
|
@ -55,7 +55,7 @@ class _DemoState extends State<Demo> {
|
||||
*/
|
||||
Widget allDomes(BuildContext context, _DemoState that) {
|
||||
return Container(
|
||||
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
||||
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
||||
child: Column(
|
||||
//mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
|
@ -54,7 +54,7 @@ class _DemoState extends State<Demo> {
|
||||
*/
|
||||
Widget allDomes(BuildContext context, _DemoState that) {
|
||||
return Container(
|
||||
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
||||
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
||||
child: Column(
|
||||
//mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
|
@ -44,9 +44,9 @@ class SliverAppBarLessDefault extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
for (int i = 0; i < 20; i++) {
|
||||
listData.add(new ListItem("我是测试标题$i", Icons.cake));
|
||||
listData.add( ListItem("我是测试标题$i", Icons.cake));
|
||||
}
|
||||
return new SizedBox(
|
||||
return SizedBox(
|
||||
height: 500.0,
|
||||
child: NestedScrollView(
|
||||
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
|
||||
@ -89,7 +89,7 @@ class SliverAppBarLessDefault extends StatelessWidget {
|
||||
// SliverPersistentHeader(
|
||||
// delegate: _SliverAppBarDelegate(
|
||||
// TabBar(
|
||||
// controller: new TabController(length: 2, vsync: this),
|
||||
// controller: TabController(length: 2, vsync: this),
|
||||
// labelColor: Colors.black87,
|
||||
// unselectedLabelColor: Colors.grey,
|
||||
// tabs: [
|
||||
@ -101,10 +101,10 @@ class SliverAppBarLessDefault extends StatelessWidget {
|
||||
];
|
||||
},
|
||||
body: Center(
|
||||
child: new ListView.builder(
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return new ListItemWidget(listData[index]);
|
||||
return ListItemWidget(listData[index]);
|
||||
},
|
||||
itemCount: listData.length,
|
||||
),
|
||||
@ -127,10 +127,10 @@ class ListItemWidget extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new InkWell(
|
||||
child: new ListTile(
|
||||
leading: new Icon(listItem.iconData),
|
||||
title: new Text(listItem.title),
|
||||
return InkWell(
|
||||
child: ListTile(
|
||||
leading: Icon(listItem.iconData),
|
||||
title: Text(listItem.title),
|
||||
),
|
||||
onTap: () {},
|
||||
);
|
||||
|
@ -40,7 +40,7 @@ class _DemoState extends State<Demo> {
|
||||
Widget build(BuildContext context) {
|
||||
return WidgetDemo(
|
||||
title: 'SliverAppBar',
|
||||
codeUrl: 'componentss/Bar/SliverAppBar/demo.dart',
|
||||
codeUrl: 'components/Bar/SliverAppBar/demo.dart',
|
||||
contentList:[allDomes(context, this)],
|
||||
docUrl: 'https://docs.flutter.io/flutter/widgets/SliverAppBar-class.html',
|
||||
);
|
||||
@ -54,7 +54,7 @@ class _DemoState extends State<Demo> {
|
||||
*/
|
||||
Widget allDomes(BuildContext context, _DemoState that) {
|
||||
return Container(
|
||||
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
||||
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
||||
child: Column(
|
||||
//mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
@ -71,7 +71,7 @@ Widget allDomes(BuildContext context, _DemoState that) {
|
||||
* 带align的text
|
||||
* */
|
||||
Widget textAlignBar(String txt) {
|
||||
return new Align(
|
||||
return Align(
|
||||
alignment: FractionalOffset.centerLeft,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
|
@ -23,15 +23,15 @@ class SnackBarLessDefault extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// 当BuildContext在Scaffold之前时,调用Scaffold.of(context)会报错。这时可以通过Builder Widget来解决
|
||||
return new Center(
|
||||
child: new Column(
|
||||
return Center(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
new GestureDetector(
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
final snackBar = new SnackBar(
|
||||
content: new Text('这是一个SnackBar, 右侧有SnackBarAction'),
|
||||
final snackBar = SnackBar(
|
||||
content: Text('这是一个SnackBar, 右侧有SnackBarAction'),
|
||||
backgroundColor:Colors.red,
|
||||
action: new SnackBarAction( // 提示信息上添加一个撤消的按钮
|
||||
action: SnackBarAction( // 提示信息上添加一个撤消的按钮
|
||||
textColor:Colors.black,
|
||||
label: '撤消',
|
||||
onPressed: () {
|
||||
@ -43,19 +43,19 @@ class SnackBarLessDefault extends StatelessWidget {
|
||||
);
|
||||
Scaffold.of(context).showSnackBar(snackBar);
|
||||
},
|
||||
child: new Text('显示SnackBar'),
|
||||
child: Text('显示SnackBar'),
|
||||
),
|
||||
new GestureDetector(
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
final snackBar = new SnackBar(
|
||||
content: new Text('右侧无SnackBarAction'),
|
||||
final snackBar = SnackBar(
|
||||
content: Text('右侧无SnackBarAction'),
|
||||
backgroundColor:Colors.red,
|
||||
duration:Duration(minutes: 1),// 持续时间
|
||||
//animation,
|
||||
);
|
||||
Scaffold.of(context).showSnackBar(snackBar);
|
||||
},
|
||||
child: new Text('显示无SnackBarAction的SnackBar'),
|
||||
child: Text('显示无SnackBarAction的SnackBar'),
|
||||
),
|
||||
],
|
||||
)
|
||||
|
@ -40,7 +40,7 @@ class _DemoState extends State<Demo> {
|
||||
Widget build(BuildContext context) {
|
||||
return WidgetDemo(
|
||||
title: 'SnackBar',
|
||||
codeUrl: 'componentss/Bar/SnackBar/demo.dart',
|
||||
codeUrl: 'components/Bar/SnackBar/demo.dart',
|
||||
contentList: [allDomes(context, this)],
|
||||
docUrl: 'https://docs.flutter.io/flutter/material/SnackBar-class.html',
|
||||
);
|
||||
@ -54,7 +54,7 @@ class _DemoState extends State<Demo> {
|
||||
*/
|
||||
Widget allDomes(BuildContext context, _DemoState that) {
|
||||
return Container(
|
||||
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
||||
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
||||
child: Column(
|
||||
//mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
@ -72,7 +72,7 @@ Widget allDomes(BuildContext context, _DemoState that) {
|
||||
* 带align的text
|
||||
* */
|
||||
Widget textAlignBar(String txt) {
|
||||
return new Align(
|
||||
return Align(
|
||||
alignment: FractionalOffset.centerLeft,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
|
@ -16,15 +16,15 @@ class SnackBarActionDemo extends StatefulWidget {
|
||||
|
||||
class _Demo extends State<SnackBarActionDemo> {
|
||||
Widget build(BuildContext context) {
|
||||
return new Center(
|
||||
child: new Column(
|
||||
return Center(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
new RaisedButton(
|
||||
onPressed: () {
|
||||
final snackBar = new SnackBar(
|
||||
content: new Text('这是一个SnackBar, 右侧有SnackBarAction, 3秒后消失'),
|
||||
backgroundColor:Color(0xffc91b3a),
|
||||
action: new SnackBarAction( // 提示信息上添加一个撤消的按钮
|
||||
action: SnackBarAction( // 提示信息上添加一个撤消的按钮
|
||||
textColor:Colors.white,
|
||||
label: '撤消',
|
||||
onPressed: () {
|
||||
@ -37,7 +37,7 @@ class _Demo extends State<SnackBarActionDemo> {
|
||||
Scaffold.of(context).showSnackBar(snackBar);
|
||||
},
|
||||
|
||||
child: new Text('点我显示有action的SnackBar'),
|
||||
child: Text('点我显示有action的SnackBar'),
|
||||
),
|
||||
new RaisedButton(
|
||||
onPressed: () async {
|
||||
@ -49,7 +49,7 @@ class _Demo extends State<SnackBarActionDemo> {
|
||||
);
|
||||
Scaffold.of(context).showSnackBar(snackBar);
|
||||
},
|
||||
child: new Text('点我显示无SnackBarAction的SnackBar'),
|
||||
child: Text('点我显示无SnackBarAction的SnackBar'),
|
||||
),
|
||||
],
|
||||
)
|
||||
|
@ -26,8 +26,8 @@ class _TabBarDemo extends State with SingleTickerProviderStateMixin {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_scrollViewController = new ScrollController();
|
||||
_tabController = new TabController(vsync: this, length: 6);// 和下面的 TabBar.tabs 数量对应
|
||||
_scrollViewController = ScrollController();
|
||||
_tabController = TabController(vsync: this, length: 6);// 和下面的 TabBar.tabs 数量对应
|
||||
}
|
||||
|
||||
@override
|
||||
@ -42,27 +42,27 @@ class _TabBarDemo extends State with SingleTickerProviderStateMixin {
|
||||
// 如果省略了 leading ,但 AppBar 在带有 Drawer 的 Scaffold 中,则会插入一个 button 以打开 Drawer。
|
||||
// 否则,如果最近的 Navigator 具有任何先前的 router ,则会插入BackButton。
|
||||
// 这种行为可以通过设置来关闭automaticallyImplyLeading 为false。在这种情况下,空的 leading widget 将导致 middle/title widget 拉伸开始。
|
||||
return new SizedBox(
|
||||
return SizedBox(
|
||||
height: 500,
|
||||
child:new Scaffold(
|
||||
appBar: new AppBar( // 大量配置属性参考 SliverAppBar 示例
|
||||
title: new Text('TabBar'),
|
||||
leading: new Icon(Icons.home),
|
||||
child: Scaffold(
|
||||
appBar: AppBar( // 大量配置属性参考 SliverAppBar 示例
|
||||
title: Text('TabBar'),
|
||||
leading: Icon(Icons.home),
|
||||
backgroundColor: Colors.amber[1000],
|
||||
bottom: new TabBar(
|
||||
bottom: TabBar(
|
||||
isScrollable: true,
|
||||
controller: _tabController,
|
||||
tabs: <Widget>[
|
||||
new Tab(text: "Tabs 1"),
|
||||
new Tab(text: "Tabs 2"),
|
||||
new Tab(text: "Tabs 3"),
|
||||
new Tab(text: "Tabs 4"),
|
||||
new Tab(text: "Tabs 5"),
|
||||
new Tab(text: "Tabs 6"),
|
||||
Tab(text: "Tabs 1"),
|
||||
Tab(text: "Tabs 2"),
|
||||
Tab(text: "Tabs 3"),
|
||||
Tab(text: "Tabs 4"),
|
||||
Tab(text: "Tabs 5"),
|
||||
Tab(text: "Tabs 6"),
|
||||
],
|
||||
),
|
||||
),
|
||||
body: new TabBarView(controller: _tabController, children: <Widget>[
|
||||
body: TabBarView(controller: _tabController, children: <Widget>[
|
||||
Text('TabsView 1'),
|
||||
Text('TabsView 2'),
|
||||
Text('TabsView 3'),
|
||||
|
Reference in New Issue
Block a user