Skip to content

Instantly share code, notes, and snippets.

@ryanlid
Created January 15, 2020 16:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanlid/b53284b339b0512a3236b38ec3be7e3d to your computer and use it in GitHub Desktop.
Save ryanlid/b53284b339b0512a3236b38ec3be7e3d to your computer and use it in GitHub Desktop.
Scaffold 脚手架示例
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