[英]Flutter Tab Bar Indicator: How to change the vertical position of the indicator?
我在这个标签栏上工作了一段时间,它现在看起来像这样:
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(
highlightColor: Colors.transparent,
splashColor: Colors.transparent,
hoverColor: Colors.transparent,
),
title: 'Flutter Demo',
home: DefaultTabController(
length: 2,
child: Scaffold(
appBar: AppBar(
leading: Icon(
Icons.menu,
color: Colors.black,
),
actions: [
Icon(
Icons.settings,
color: Colors.black,
),
],
automaticallyImplyLeading: false,
backgroundColor: Colors.white,
title: Padding(
padding: EdgeInsets.only(left: 50, right: 50),
child:TabBar(
indicatorColor: Colors.pink[100],
indicatorSize: TabBarIndicatorSize.label,
tabs: [
Tab(text: 'Dogs'),
Tab(text: 'Cats'),
],
labelColor: Colors.black,
),),
), //appbar
body: TabBarView(
children: [
Center(child: Text('DOGS')),
Center(child: Text('CATS')),
],
),
),
),
);
}
}
可以清楚的看到指标的position不太对。 理想情况下,我希望指示器垂直向上移动,靠近(和下方)文本(“Dogs”&&“Cats”),或者垂直向下移动,保持在应用栏的底部。 我怎么能做到这一点? 任何帮助表示赞赏。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.