tabbar
This commit is contained in:
47
lib/home/reserve_right_content_view.dart
Normal file
47
lib/home/reserve_right_content_view.dart
Normal file
@@ -0,0 +1,47 @@
|
||||
import 'package:cashier_reserve/common/base/ui.dart';
|
||||
import 'package:cashier_reserve/common/print/print.dart';
|
||||
import 'package:cashier_reserve/home/reserve_view_model.dart';
|
||||
|
||||
class ReserveRightContentView extends StatelessWidget {
|
||||
final ReserveViewModel provider;
|
||||
final TabController? tabController;
|
||||
|
||||
const ReserveRightContentView(
|
||||
{super.key, required this.provider, this.tabController});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
width: double.infinity,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_buildTabBar(context),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildTabBar(BuildContext context) {
|
||||
if ((provider.tableAreaList?.length ?? 0) == 0) {
|
||||
return Container();
|
||||
}
|
||||
|
||||
return TabBar(
|
||||
tabs:
|
||||
provider.tableAreaList!.map((e) => Tab(text: e?.name ?? '')).toList(),
|
||||
controller: tabController,
|
||||
isScrollable: true,
|
||||
labelColor: Colors.blue,
|
||||
unselectedLabelColor: Colors.grey,
|
||||
indicatorColor: Colors.blue,
|
||||
indicatorSize: TabBarIndicatorSize.label,
|
||||
indicatorWeight: 2,
|
||||
labelPadding: const EdgeInsets.only(left: 10, right: 10),
|
||||
onTap: (index) {
|
||||
yjPrint("tab index: $index");
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user