Button tab width
ihebmeftah opened this issue · 6 comments
ihebmeftah commented
Button tab take full width and i can't change. please any solution @afonsocraposo @ryanaidilp
afonsocraposo commented
@ihebmeftah please share some code to reproduce this
ihebmeftah commented
import 'package:buttons_tabbar/buttons_tabbar.dart';
import 'package:edteacher/app/core/themes/themes.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:hexcolor/hexcolor.dart';
class AppTabBar extends StatelessWidget {
const AppTabBar({
super.key,
this.isgradient = true,
required this.tabs,
this.ontap,
});
final List<Widget> tabs;
final Function? ontap;
final bool isgradient;
@override
Widget build(BuildContext context) {
return ButtonsTabBar(
onTap: ontap == null ? null : (value) => ontap!(value),
radius: 20.r,
buttonMargin: !isgradient
? EdgeInsets.zero
: EdgeInsets.only(top: 5.h, bottom: 5.h, left: 10.w, right: 10.w),
contentPadding: EdgeInsets.symmetric(horizontal: 10.w),
height: !isgradient ? 40.h : 52.h,
width: Get.width / 3.5,
contentCenter: true,
decoration: BoxDecoration(
color: !isgradient ? HexColor("#D9E5FF") : Colors.red,
gradient: !isgradient ? null : ThemesApp.gradientConfig),
unselectedBackgroundColor: HexColor("#FFFFFF"),
unselectedLabelStyle: TextStyle(
fontSize: 12.sp, fontWeight: FontWeight.w600, color: Colors.black),
labelStyle: TextStyle(
fontSize: 12.sp,
fontWeight: FontWeight.w600,
color: !isgradient ? Colors.black : HexColor("#FFFFFF")),
tabs: tabs);
}
}
AppTabBar(tabs: [
Tab(text: 'Monday'.tr),
Tab(text: 'Tuesday'.tr),
Tab(text: 'Wednesday'.tr),
Tab(text: 'Thursday'.tr),
Tab(text: 'Friday'.tr),
Tab(text: 'Saturday'.tr),
]),
ihebmeftah commented
@afonsocraposo Check this PR : #55
afonsocraposo commented
Hi @ihebmeftah !
I approved your PR. Thank you a lot for making it! 🙇
ihebmeftah commented
thanks