forked from lxm_flutter/FlutterUnit
61 lines
1.7 KiB
Dart
61 lines
1.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
/// create by 张风捷特烈 on 2020/4/27
|
|
/// contact me by email 1981462002@qq.com
|
|
/// 说明:
|
|
|
|
// {
|
|
// "widgetId": 58,
|
|
// "name": '通过设置Theme可实现无水波纹',
|
|
// "priority": 1,
|
|
// "subtitle":
|
|
// "将Theme关于水波纹的颜色设置为透明即可。",
|
|
// }
|
|
class NoShadowTabBarDemo extends StatefulWidget {
|
|
const NoShadowTabBarDemo({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
_NSTabBarState createState() => _NSTabBarState();
|
|
}
|
|
|
|
class _NSTabBarState extends State<NoShadowTabBarDemo>
|
|
with SingleTickerProviderStateMixin {
|
|
final List<String> tabs = ['风画庭', '雨韵舍', '雷鸣殿', '电疾堂', '霜寒阁', '雪月楼'];
|
|
late TabController _tabController;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
_tabController = TabController(vsync: this, length: tabs.length);
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
_tabController.dispose();
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Theme(
|
|
data: Theme.of(context).copyWith(
|
|
splashColor: Colors.transparent,
|
|
highlightColor: Colors.transparent,
|
|
),
|
|
child: TabBar(
|
|
onTap: (tab) => print(tab),
|
|
labelStyle: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
|
|
unselectedLabelStyle: const TextStyle(fontSize: 16),
|
|
isScrollable: true,
|
|
controller: _tabController,
|
|
labelColor: Colors.blue,
|
|
indicatorWeight: 3,
|
|
indicatorPadding: const EdgeInsets.symmetric(horizontal: 10),
|
|
unselectedLabelColor: Colors.grey,
|
|
indicatorColor: Colors.orangeAccent,
|
|
tabs: tabs.map((e) => Tab(text: e)).toList(),
|
|
),
|
|
);
|
|
}
|
|
}
|