Flutter 如何在颤振中获取渐变底部导航选项卡?
酒吧有一个套餐 但这在很长一段时间内都没有更新。 那么,有没有办法创建自己的带有渐变效果的自定义导航栏 像这样的。。。Flutter 如何在颤振中获取渐变底部导航选项卡?,flutter,flutter-layout,flutter-bottomnavigation,Flutter,Flutter Layout,Flutter Bottomnavigation,酒吧有一个套餐 但这在很长一段时间内都没有更新。 那么,有没有办法创建自己的带有渐变效果的自定义导航栏 像这样的。。。 使用颤振,一个选项是在底部导航栏中使用透明背景,并将其放在带有盒子装饰的容器中,然后尝试下一个选项: import 'package:flutter/material.dart'; void main() { runApp(MyApp()); } class MyApp extends StatelessWidget { @override Widget bu
使用颤振,一个选项是在底部导航栏中使用透明背景,并将其放在带有盒子装饰的容器中,然后尝试下一个选项:
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Center(
child: Text("Hello"),
),
bottomNavigationBar: _createBottomNavigationBar(),
),
);
}
Widget _createBottomNavigationBar() {
return Container(
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Color(0xFF00D0E1), Color(0xFF00B3FA)],
begin: Alignment.topLeft,
end: Alignment.topRight,
stops: [0.0, 0.8],
tileMode: TileMode.clamp,
),
),
child: BottomNavigationBar(
currentIndex: 0,
onTap: (index) {},
showUnselectedLabels: false,
backgroundColor: Colors.transparent,
type: BottomNavigationBarType.fixed,
elevation: 0,
unselectedItemColor: Colors.white,
selectedIconTheme: IconThemeData(color: Colors.white),
items: [
BottomNavigationBarItem(
icon: Icon(Icons.home),
title: Text(
"Home",
style: TextStyle(color: Colors.white),
),
),
BottomNavigationBarItem(
icon: Icon(Icons.business),
title: Text(
"Business",
style: TextStyle(color: Colors.white),
),
),
BottomNavigationBarItem(
icon: Icon(Icons.school),
title: Text(
"School",
style: TextStyle(color: Colors.white),
),
),
],
),
);
}
}