Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TDTabBar] labelStyle 不起作用 #108

Closed
Luozf12345 opened this issue Apr 17, 2024 · 7 comments
Closed

[TDTabBar] labelStyle 不起作用 #108

Luozf12345 opened this issue Apr 17, 2024 · 7 comments

Comments

@Luozf12345
Copy link
Collaborator

Luozf12345 commented Apr 17, 2024

tdesign-flutter 版本

0.1.4

重现链接

No response

重现步骤

No response

期望结果

No response

实际结果

labelStyle 不起作用,unselectedLabelStyle, 这个样式也不起作用

Flutter版本

No response

设备与机型信息

No response

系统版本

No response

补充说明

No response

Copy link
Contributor

👋 @Luozf12345,感谢给 TDesign 提出了 issue。
请根据 issue 模版确保背景信息的完善,我们将调查并尽快回复你。

Copy link
Contributor

这个 Issue 被标记为了过时 stale ,因为它已经持续 30 天没有任何活动了。删除 stale 标签或评论,否则将在 7 天内关闭。

@github-actions github-actions bot added the Stale label May 17, 2024
Copy link
Contributor

此 Issue 被自动关闭,因为它自被标记为过时 stale 以来已闲置 7 天。

@wiscgazf
Copy link

我的也不生效 哈哈
`import 'package:extended_nested_scroll_view/extended_nested_scroll_view.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:tdesign_flutter/tdesign_flutter.dart';
import 'package:xjy_study/utils/color_util.dart';

class StudyDetail extends StatefulWidget {
const StudyDetail({super.key});

@OverRide
State createState() => _StudyDetailState();
}

class _StudyDetailState extends State with SingleTickerProviderStateMixin {
final List _tabs = const ['待上课时', '已上课时'];

late TabController _tabController;

@OverRide
void initState() {
super.initState();
_tabController = TabController(length: _tabs.length, vsync: this);
}

@OverRide
void didChangeDependencies() {
super.didChangeDependencies();
_getQueryParams();
}

@OverRide
void dispose() {
super.dispose();
}

void _getQueryParams() {
final ModalRoute<Object?>? currentRoute = ModalRoute.of(context);
if (currentRoute != null) {
final Map<String, dynamic> params = currentRoute.settings.arguments as Map<String, dynamic>;
print('aa=${params}');
}
}

@OverRide
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('课程详情'),
leadingWidth: 40.w,
),
body: ExtendedNestedScrollView(
onlyOneScrollInBody: true,
physics: ClampingScrollPhysics(),
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
return [
SliverToBoxAdapter(
child: _CourseItemDetail(),
)
];
},
body: Column(
children: [
TDTabBar(
controller: _tabController,
height: 44.h,
backgroundColor: Colors.white,
indicatorColor: ColorUtil.primaryColor(),
labelColor: ColorUtil.primaryColor(),
unselectedLabelStyle: TextStyle(fontSize: 12.sp, color: Colors.red),
labelStyle: TextStyle(
fontSize: 18.sp,
color: ColorUtil.primaryFontColor(),
fontWeight: FontWeight.w500),
indicatorWidth: 16.w,
showIndicator: true,
tabs: _tabs
.map((e) => TDTab(
text: '$e',
))
.toList()),
Expanded(
child: TDTabBarView(
isSlideSwitch: true,
controller: _tabController,
children: _tabs
.map((e) => Center(
child: Text('data$e'),
))
.toList()))
],
),
),
);
}
}

/// 课程详情描述
class _CourseItemDetail extends StatelessWidget {
const _CourseItemDetail();

@OverRide
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.fromLTRB(15.w, 10.h, 15.w, 8.h),
color: Colors.white,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
margin: EdgeInsets.only(top: 3.h),
height: 16.h,
alignment: Alignment.center,
padding: EdgeInsets.symmetric(horizontal: 6.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(4)),
gradient: LinearGradient(colors: [
ColorUtil.hexColorString('#FFB442'),
ColorUtil.hexColorString('#FF9A00')
])),
child: Text(
'数学',
style: TextStyle(color: Colors.white, fontSize: 12.sp, height: 1.h),
),
),
SizedBox(
width: 8.w,
),
Expanded(
child: Text(
'集合图形离开撒娇的案例三等奖集合图形离开撒娇的案例',
style: TextStyle(
color: ColorUtil.primaryFontColor(),
fontSize: 14.sp,
overflow: TextOverflow.ellipsis,
height: 1.5.h),
maxLines: 2,
))
],
),
Padding(
padding: EdgeInsets.only(top: 5.h, bottom: 12.h),
child: Text(
'2020年8月15日开始,共20节课',
style: TextStyle(fontSize: 12.sp, color: ColorUtil.subFontColor()),
),
),
Row(
children: [
ClipRRect(
borderRadius: BorderRadius.circular(28.w),
child: Container(
width: 28.w,
height: 28.w,
color: Colors.grey,
),
),
SizedBox(
width: 10.w,
),
Text(
'某某老师',
maxLines: 1,
style: TextStyle(
fontSize: 12.sp,
color: ColorUtil.subFontColor(),
overflow: TextOverflow.ellipsis),
)
],
)
],
),
);
}
}
`

@Luozf12345 Luozf12345 reopened this Oct 10, 2024
@Luozf12345 Luozf12345 removed the Stale label Oct 10, 2024
Copy link
Contributor

这个 Issue 被标记为了过时 stale ,因为它已经持续 30 天没有任何活动了。删除 stale 标签或评论,否则将在 7 天内关闭。

@github-actions github-actions bot added the Stale label Nov 16, 2024
Copy link
Contributor

此 Issue 被自动关闭,因为它自被标记为过时 stale 以来已闲置 7 天。

@Luozf12345
Copy link
Collaborator Author

关联issue:#188

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants