Initial commit: Penyerahan final Source code Tugas Akhir
This commit is contained in:
59
lib/screens/detail_course/components/tab_bar_items.dart
Normal file
59
lib/screens/detail_course/components/tab_bar_items.dart
Normal file
@ -0,0 +1,59 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:initial_folder/providers/tab_provider.dart';
|
||||
import 'package:initial_folder/size_config.dart';
|
||||
import 'package:initial_folder/theme.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class TabBarItems extends StatelessWidget {
|
||||
final int index;
|
||||
final String title;
|
||||
|
||||
const TabBarItems({
|
||||
Key? key,
|
||||
required this.index,
|
||||
required this.title,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
TabProvider tab = Provider.of<TabProvider>(context, listen: false);
|
||||
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
tab.currentIndex = index;
|
||||
},
|
||||
child: Container(
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: thirdTextStyle.copyWith(
|
||||
color: tab.currentIndex == index
|
||||
? Theme.of(context).brightness == Brightness.light
|
||||
? primaryColorligtmode
|
||||
: primaryColor
|
||||
: fifteenColor,
|
||||
fontSize: getProportionateScreenWidth(12),
|
||||
fontWeight: semiBold,
|
||||
),
|
||||
),
|
||||
SizedBox(height: getProportionateScreenHeight(2)),
|
||||
Container(
|
||||
width: getProportionateScreenWidth(58),
|
||||
height: getProportionateScreenHeight(2),
|
||||
decoration: BoxDecoration(
|
||||
color: tab.currentIndex == index
|
||||
? Theme.of(context).brightness == Brightness.light
|
||||
? primaryColorligtmode
|
||||
: primaryColor
|
||||
: Colors.transparent,
|
||||
borderRadius:
|
||||
BorderRadius.circular(getProportionateScreenHeight(19)),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user