mirror of
https://github.com/alibaba/flutter-go.git
synced 2025-05-19 22:06:31 +08:00
72 lines
2.3 KiB
Dart
72 lines
2.3 KiB
Dart
/// Created with Android Studio.
|
||
/// User: 一晟
|
||
/// Date: 2018/12/27
|
||
/// Time: 下午6:28
|
||
/// email: zhu.yan@alibaba-inc.com
|
||
/// target: BottomNavigationBar 的示例
|
||
|
||
import 'package:flutter/material.dart';
|
||
|
||
import 'package:flutter_go/components/widget_demo.dart';
|
||
|
||
import './demo.dart' as BottomNavigationBarDemo;
|
||
|
||
const String _text0 =
|
||
"""### **简介**
|
||
> BottomNavigationBar “底部导航栏”
|
||
- 显示在应用程序底部的导航栏,由文本标签,图标或两者形式的多个项目组成;
|
||
- 它提供了应用程序顶级视图之间的快速导航;
|
||
""";
|
||
|
||
|
||
const String _text1 =
|
||
"""### **基本用法**
|
||
> BottomNavigationBar 底部导航栏通常与Scaffold结合使用
|
||
- 它作为 Scaffold.bottomNavigationBar 参数;
|
||
- BottomNavigationBar 3-5个之间个底部按钮数量是合理的,理论上 icon 大小合适,可以支持更多;
|
||
- 默认0-3个底部按钮数量时,BottomNavigationBar采用fixed的模式摆放底部按钮,当有4个时默认使用 BottomNavigationBarType.shifting 模式摆放底部按钮;
|
||
- 大多数人可能不需要选中文字被放大,可以通过 设置 selectedFontSize 与 unselectedFontSize 同等大小覆盖默认效果;
|
||
- 下面的底部导航即是效果;
|
||
""";
|
||
|
||
class Demo extends StatefulWidget {
|
||
static const String routeName = '/components/Navigation/BottomNavigationBar';
|
||
|
||
@override
|
||
_DemoState createState() => _DemoState();
|
||
}
|
||
|
||
class _DemoState extends State<Demo> {
|
||
@override
|
||
Widget build(BuildContext context) {
|
||
return WidgetDemo(
|
||
title: 'BottomNavigationBar',
|
||
codeUrl: 'components/Navigation/BottomNavigationBar/demo.dart',
|
||
contentList: allDemoBoxs(context, this),
|
||
docUrl: 'https://docs.flutter.io/flutter/material/BottomNavigationBar-class.html',
|
||
bottomNaviBar:BottomNavigationBarDemo.BottomNavigationBarFullDefault()
|
||
);
|
||
}
|
||
}
|
||
|
||
|
||
// 所有的 BottomNavigationBar widget
|
||
// context: 运行上下文
|
||
// that: 指向有状态的 StatefulWidget
|
||
List allDemoBoxs(BuildContext context, _DemoState that) {
|
||
return [
|
||
_text0,
|
||
_text1,
|
||
Row(
|
||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||
mainAxisSize: MainAxisSize.max,
|
||
children: [
|
||
//BottomNavigationBarDemo.BottomNavigationBarFullDefault();
|
||
],
|
||
),
|
||
SizedBox(width: 20.0), // 间距
|
||
];
|
||
}
|
||
|
||
|