【发布时间】:2021-12-01 21:37:28
【问题描述】:
【问题讨论】:
标签: flutter floating-action-button flutter-bottomnavigation
【问题讨论】:
标签: flutter floating-action-button flutter-bottomnavigation
你可以试试Convex_bottom_bar
这里所有bottom_nav_bar 包
import 'package:convex_bottom_bar/convex_bottom_bar.dart';
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
State createState() => _State();
}
class _State extends State<MyApp> {
@override
Widget build(BuildContext context) {
return MaterialApp(
initialRoute: "/",
routes: {
"/": (_) => HelloConvexAppBar(),
"/bar": (BuildContext context) => Container(),
"/custom": (BuildContext context) => Container(),
"/fab": (BuildContext context) => Container(),
},
);
}
}
class HelloConvexAppBar extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('Hello ConvexAppBar')),
body: Center(
child: TextButton(
child: Text('Click to show full example'),
onPressed: () => Navigator.of(context).pushNamed('/bar'),
)),
bottomNavigationBar: ConvexAppBar(
style: TabStyle.react,
items: [
TabItem(icon: Icons.list),
TabItem(icon: Icons.calendar_today),
TabItem(icon: Icons.assessment),
],
initialActiveIndex: 1,
onTap: (int i) => print('click index=$i'),
),
);
}
}
【讨论】: