Aidra Connect 10.0.2+16
Aidra Connect Mobile Application
Loading...
Searching...
No Matches
custom_tabs.dart
Go to the documentation of this file.
1import 'package:flutter/material.dart';
2import 'package:flutter_screenutil/flutter_screenutil.dart';
3
6 super.key,
7 required this.selctedIndex,
8 required this.tabs,
9 required this.onTapSelected,
10 });
11
12 final int selctedIndex;
13 final List<String> tabs;
14 final Function(int index) onTapSelected;
15
16 @override
17 Widget build(BuildContext context) {
18 return Row(
19 mainAxisAlignment: MainAxisAlignment.spaceAround,
20 children: tabs.asMap().entries.map((entry) {
21 return Expanded(
22 child: ElevatedButton(
23 onPressed: () => onTapSelected(entry.key),
24 style: OutlinedButton.styleFrom(
25 padding: EdgeInsets.only(top: 12.sp),
26 backgroundColor: Theme.of(context).scaffoldBackgroundColor,
27 shape: const RoundedRectangleBorder(
28 borderRadius: BorderRadius.zero,
29 ),
30 ),
31 child: Column(
32 mainAxisSize: MainAxisSize.min,
33 children: [
34 Column(
35 children: [
36 Text(
37 entry.value,
38 style: Theme.of(context).textTheme.bodySmall,
39 ),
40 SizedBox(height: 10.sp),
41 Divider(
42 height: 0.0,
43 thickness: 1,
44 color: selctedIndex == entry.key
45 ? Theme.of(context).colorScheme.primary
46 : Colors.transparent,
47 )
48 ],
49 ),
50 ],
51 ),
52 ),
53 );
54 }).toList(),
55 );
56 }
57
58 @override
59 Size get preferredSize => Size.fromHeight(50.sp);
60}
final Function(int index) onTapSelected
override Size get preferredSize
final List< String > tabs
override Widget build(BuildContext context)
const CustomTabsBuilder({ super.key, required this.selctedIndex, required this.tabs, required this.onTapSelected, })