-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c499d6f
commit df97851
Showing
7 changed files
with
246 additions
and
8 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
71 changes: 71 additions & 0 deletions
71
flutter_demo_counter/flutter_demo_counter/lib/WidgetButtonRoute.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import 'package:flutter/cupertino.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
class WidgetButtonRoute extends StatefulWidget { | ||
@override | ||
State<StatefulWidget> createState() { | ||
return new ButtonState(); | ||
} | ||
} | ||
|
||
class ButtonState extends State<WidgetButtonRoute> { | ||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
appBar: AppBar( | ||
title: Text('Button Test'), | ||
), | ||
body: Padding( | ||
padding: EdgeInsets.all(20), | ||
child: Column( | ||
children: <Widget>[ | ||
RaisedButton.icon( | ||
icon: Icon(Icons.send), | ||
label: Text("发送"), | ||
onPressed: () => print("RaisedButton click"), | ||
), | ||
RaisedButton( | ||
child: Text('RaisedButton-normal'), | ||
onPressed: () => print("RaisedButton click"), | ||
), | ||
FlatButton( | ||
child: Text('FlatButton-normal'), | ||
onPressed: () => print("FlatButton click"), | ||
), | ||
OutlineButton( | ||
child: Text("OutlineButton-normal"), | ||
onPressed: () => print("OutlineButton click"), | ||
), | ||
IconButton( | ||
icon: Icon(Icons.thumb_up), | ||
onPressed: () => print("IconButton click"), | ||
), | ||
RaisedButton.icon( | ||
icon: Icon(Icons.send), | ||
label: Text("发送"), | ||
onPressed: () => print("IconButton click"), | ||
), | ||
OutlineButton.icon( | ||
icon: Icon(Icons.add), | ||
label: Text("添加"), | ||
onPressed: () => print("IconButton click"), | ||
), | ||
FlatButton.icon( | ||
icon: Icon(Icons.info), | ||
label: Text("详情"), | ||
onPressed: () => print("IconButton click"), | ||
), | ||
FlatButton( | ||
color: Colors.blue, | ||
highlightColor: Colors.blue[700], | ||
colorBrightness: Brightness.dark, | ||
splashColor: Colors.grey, | ||
child: Text("Submit"), | ||
shape:RoundedRectangleBorder(borderRadius: BorderRadius.circular(20.0)), | ||
onPressed: () {}, | ||
) | ||
], | ||
), | ||
)); | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
flutter_demo_counter/flutter_demo_counter/lib/WidgetCheckboxRoute.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import 'package:flutter/cupertino.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
class WidgetCheckboxRoute extends StatefulWidget { | ||
@override | ||
State<StatefulWidget> createState() { | ||
// TODO: implement createState | ||
return new CheckboxState(); | ||
} | ||
} | ||
|
||
class CheckboxState extends State<WidgetCheckboxRoute> { | ||
bool _switchSelected = false; //维护单选开关状态 | ||
bool _checkboxSelected = false; //维护复选框状态 | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
appBar: AppBar( | ||
title: Text('Checkbox test'), | ||
), | ||
body: Column( | ||
children: <Widget>[ | ||
Switch( | ||
value: _switchSelected, | ||
onChanged: (value) { | ||
//重新构建页面 | ||
setState(() { | ||
_switchSelected = value; | ||
}); | ||
}, | ||
), | ||
Checkbox( | ||
activeColor: Colors.red, //选中时的颜色 | ||
value: _checkboxSelected, | ||
onChanged: (value) { | ||
setState(() { | ||
_checkboxSelected = value; | ||
}); | ||
}, | ||
) | ||
], | ||
), | ||
); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
flutter_demo_counter/flutter_demo_counter/lib/WidgetImageRoute.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import 'package:flutter/cupertino.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
class WidgetImageRoute extends StatelessWidget { | ||
@override | ||
Widget build(BuildContext context) { | ||
return Center( | ||
child: Row( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: <Widget>[ | ||
Icon( | ||
Icons.accessible, | ||
color: Colors.green, | ||
), | ||
Icon( | ||
Icons.error, | ||
color: Colors.green, | ||
), | ||
Icon( | ||
Icons.fingerprint, | ||
color: Colors.green, | ||
), | ||
], | ||
)); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
flutter_demo_counter/flutter_demo_counter/lib/WidgetInputRoute.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import 'package:flutter/cupertino.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
class WidgetInputRoute extends StatelessWidget { | ||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
appBar: AppBar( | ||
title: Text('input'), | ||
), | ||
body: Padding( | ||
padding: EdgeInsets.all(10), | ||
child: Column( | ||
mainAxisAlignment: MainAxisAlignment.start, | ||
children: <Widget>[ | ||
TextField( | ||
autofocus: true, | ||
decoration: InputDecoration( | ||
labelText: "用户名", | ||
hintText: "用户名或邮箱", | ||
prefixIcon: Icon(Icons.person)), | ||
), | ||
TextField( | ||
decoration: InputDecoration( | ||
labelText: "密码", | ||
hintText: "您的登录密码", | ||
prefixIcon: Icon(Icons.lock)), | ||
obscureText: true, | ||
), | ||
], | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters