Created
January 15, 2020 16:03
-
-
Save ryanlid/b53284b339b0512a3236b38ec3be7e3d to your computer and use it in GitHub Desktop.
Scaffold 脚手架示例
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
import 'package:flutter/material.dart'; | |
void main() => runApp((MyApp())); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
home: ScaffoldExample(), | |
title: "MaterialApp示例", | |
); | |
} | |
} | |
class ScaffoldExample extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
// 头部元素 | |
appBar: AppBar( | |
title: Text('Scaffold 脚手架示例'), | |
), | |
// 视图内容部分 | |
body: Center( | |
child: Text('Scaffold'), | |
), | |
// 底部导航栏 | |
bottomNavigationBar: BottomAppBar( | |
child: Container( | |
height: 50.0, | |
), | |
), | |
// FAB 按钮 | |
floatingActionButton: FloatingActionButton( | |
onPressed: () {}, | |
tooltip: "添加", | |
child: Icon(Icons.add), | |
), | |
// FAB 按钮居中显示 | |
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment