| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- import 'package:track_common/widget/prelude.dart';
- import 'app_bar.dart';
- import 'home_controller.dart';
- class HomeView extends GetView<HomeController> {
- const HomeView({super.key});
- static const name = '/HomeView';
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- appBar: HomeAppBar(
- tab: TabBar(
- controller: controller.tabController,
- tabs: controller.tabs.map((e) => Tab(text: e.title)).toList(),
- labelColor: Colors.white,
- unselectedLabelColor: Colors.white,
- indicatorSize: TabBarIndicatorSize.tab,
- indicatorPadding: const EdgeInsets.only(bottom: 0),
- indicator: CustomTabIndicator(),
- dividerColor: Colors.transparent),
- ),
- body: Container(
- decoration: const BoxDecoration(
- image: DecorationImage(
- image:
- AssetImage(Assets.imagesBkCommonPage, package: package),
- fit: BoxFit.fill)),
- child: TabBarView(
- controller: controller.tabController,
- physics: const NeverScrollableScrollPhysics(),
- children: controller.tabs.map((e) => e.builder()).toList(),
- )),
- );
- }
- }
- // final _tabElems = [
- // _TabElem(title: '设置', child: const SizedBox()),
- // _TabElem(title: '地图', child: const MapPage()),
- // _TabElem(title: '场控', child: const FieldControlPage()),
- // _TabElem(title: '用户管理', child: const UserManagePage()),
- // _TabElem(title: '个人排名', child: PersonalRankPage()),
- // _TabElem(title: '分组排名', child: const SizedBox()),
- // _TabElem(title: '数据详情', child: const DataDetailPage()),
- // ];
- class CustomTabIndicator extends Decoration {
- @override
- BoxPainter createBoxPainter([VoidCallback? onChanged]) {
- return _CustomPainter(this, onChanged!);
- }
- }
- class _CustomPainter extends BoxPainter {
- final CustomTabIndicator decoration;
- _CustomPainter(this.decoration, VoidCallback onChanged) : super(onChanged);
- @override
- void paint(Canvas canvas, Offset offset, ImageConfiguration configuration) {
- final size = configuration.size;
- assert(size != null);
- final Paint paint = Paint();
- paint.color = const Color(0xff003656);
- paint.style = PaintingStyle.fill;
- final path = Path();
- final rect = offset & size!;
- path.moveTo(rect.center.dx - 12, rect.bottom);
- path.lineTo(rect.center.dx + 12, rect.bottom);
- path.lineTo(rect.center.dx, rect.height - 12);
- path.close();
- canvas.drawPath(path, paint);
- }
- }
|