RenderCustomMultiChildLayoutBox object was given an infinite size during layout - flutter

This is what show up on my terminal:
======== Exception caught by rendering library ===================================================== The following assertion was thrown during performLayout(): RenderPhysicalModel object was given an infinite size during layout.
This probably means that it is a render object that tries to be as big as possible, but it was put inside another render object that
allows its children to pick their own size. The nearest ancestor
providing an unbounded height constraint is:
_RenderSingleChildViewport#4c3d2 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE ... needs compositing ... parentData: (can use size) ... constraints: BoxConstraints(w=1366.0, h=657.0) ... size: MISSING ... offset: Offset(0.0, -0.0) The constraints that applied to the RenderPhysicalModel were: BoxConstraints(0.0<=w<=1366.0,
0.0<=h<=Infinity) The exact size it was given was: Size(1366.0, Infinity)
This is my code:
import 'dart:core';
import 'dart:ui';
import 'package:braintrinig/animation/LongBreak.dart';
import 'package:braintrinig/animation/ShortBreak.dart';
import 'package:braintrinig/animation/StartPomodoro.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:google_nav_bar/google_nav_bar.dart';
import 'dart:async';
import 'package:responsive_sizer/responsive_sizer.dart';
class HomePageTimerUI extends StatefulWidget {
const HomePageTimerUI( {Key? key}) : super(key: key);
#override
State<HomePageTimerUI> createState() => _HomePageTimerUIState();
}
class _HomePageTimerUIState extends State<HomePageTimerUI>
with SingleTickerProviderStateMixin {
final ScrollController _firstController = ScrollController();
late TabController _tabController;
late Timer timer;
late AnimationController controller;
String get countText {
Duration count = controller.duration! * controller.value;
return controller.isDismissed
? '${controller.duration!.inHours.toString().padLeft(2, '0')}:${(controller.duration!.inMinutes % 60).toString().padLeft(2, '0')}:${(controller.duration!.inSeconds % 60).toString().padLeft(2, '0')}'
: '${count.inHours.toString().padLeft(2, '0')}:${(count.inMinutes % 60).toString().padLeft(2, '0')}:${(count.inSeconds % 60).toString().padLeft(2, '0')}';
}
#override
void initState() {
super.initState();
_tabController = TabController(length: 3, vsync: this);
}
#override
void dispose() {
_tabController.dispose();
super.dispose();
}
void notify() {
if (countText == '00:00:00') {}
}
#override
Widget build(BuildContext context) {
return ResponsiveSizer(builder: (context, orientation, screenType) {
return Device.screenType == ScreenType.mobile
? Container(
width: double.infinity,
child: DefaultTabController(
length: 3,
child: Scaffold(
appBar: AppBar(
elevation: 0,
backgroundColor: Colors.transparent,
bottom: PreferredSize(
preferredSize: Size.fromHeight(55),
child: Container(
color: Colors.transparent,
child: SafeArea(
child: Column(
children: <Widget>[
TabBar(
controller: _tabController,
indicator: UnderlineTabIndicator(
borderSide: BorderSide(
color: Color(0xff3B3B3B),
width: 4.0),
insets: EdgeInsets.fromLTRB(
12.0, 12.0, 12.0, 11.0)),
indicatorWeight: 15,
indicatorSize: TabBarIndicatorSize.label,
labelColor: Color(0xff3B3B3B),
labelStyle: TextStyle(
fontSize: 12,
letterSpacing: 1.3,
fontWeight: FontWeight.w500),
unselectedLabelColor: Color(0xffD7D7D7),
tabs: [
Tab(
text: "POMODORO",
icon:
Icon(Icons.work_history, size: 40),
),
Tab(
text: "SHORT BREAK",
icon:
Icon(Icons.ramen_dining, size: 40),
),
Tab(
text: "LONG BREAK",
icon: Icon(
Icons.battery_charging_full_rounded,
size: 40),
),
])
],
),
),
),
),
),
body: TabBarView(
controller: _tabController,
children: <Widget>[
Center(
child: StartPomodoro(),
),
Center(
child: ShortBreak(),
),
Center(child: LongBreak()),
],
),
bottomNavigationBar: Container(
height: 110,
color: Color(0xffFAFAFA),
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 15.0, vertical: 20),
child: GNav(
iconSize: 40,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
backgroundColor: Color(0xffFAFAFA),
color: Color(0xffD7D7D7),
activeColor: Color(0xff3B3B3B),
tabBackgroundColor: Color(0xffF0F0F0),
gap: 8,
onTabChange: (index) {
print(index);
},
padding: EdgeInsets.all(15),
tabs: [
GButton(
icon: Icons.settings,
text: 'Settings',
),
GButton(
icon: Icons.person,
text: "Profile",
),
GButton(
icon: Icons.task,
text: "Tasks",
),
GButton(
icon: Icons.show_chart,
text: "Performance",
),
],
),
),
),
)))
: LayoutBuilder(
builder: (BuildContext context, BoxConstraints constraints) {
return SingleChildScrollView(
child: Column(
children: [
SizedBox(
width: constraints.maxWidth,
height: constraints.maxHeight,
child: Scrollbar(
thumbVisibility: true,
controller: _firstController,
child: ListView.builder(
controller: _firstController,
itemCount: 1,
itemBuilder: (BuildContext context, int index) {
return Container(
height: constraints.maxHeight,
width: double.infinity,
child: DefaultTabController(
length: 3,
child: Scaffold(
appBar: AppBar(
elevation: 0,
backgroundColor: Colors.transparent,
bottom: PreferredSize(
preferredSize: Size.fromHeight(55),
child: Container(
color: Colors.transparent,
child: SafeArea(
child: Column(
children: <Widget>[
TabBar(
controller:
_tabController,
indicator: UnderlineTabIndicator(
borderSide: BorderSide(
color: Color(
0xff3B3B3B),
width: 4.0),
insets: EdgeInsets
.fromLTRB(
12.0,
12.0,
12.0,
11.0)),
indicatorWeight: 15,
indicatorSize:
TabBarIndicatorSize
.label,
labelColor:
Color(0xff3B3B3B),
labelStyle: TextStyle(
fontSize: 12,
letterSpacing: 1.3,
fontWeight:
FontWeight.w500),
unselectedLabelColor:
Color(0xffD7D7D7),
tabs: [
Tab(
text: "POMODORO",
icon: Icon(
Icons
.work_history,
size: 40),
),
Tab(
text: "SHORT BREAK",
icon: Icon(
Icons
.ramen_dining,
size: 40),
),
Tab(
text: "LONG BREAK",
icon: Icon(
Icons
.battery_charging_full_rounded,
size: 40),
),
])
],
),
),
),
),
),
body: TabBarView(
controller: _tabController,
children: <Widget>[
Center(
child: StartPomodoro(),
),
Center(
child: ShortBreak(),
),
Center(child: LongBreak()),
],
),
bottomNavigationBar: Container(
height: 110,
color: Color(0xffFAFAFA),
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 15.0, vertical: 20),
child: GNav(
iconSize: 40,
mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
backgroundColor: Color(0xffFAFAFA),
color: Color(0xffD7D7D7),
activeColor: Color(0xff3B3B3B),
tabBackgroundColor:
Color(0xffF0F0F0),
gap: 8,
onTabChange: (index) {
print(index);
},
padding: EdgeInsets.all(15),
tabs: [
GButton(
icon: Icons.settings,
text: 'Settings',
),
GButton(
icon: Icons.person,
text: "Profile",
),
GButton(
icon: Icons.task,
text: "Tasks",
),
GButton(
icon: Icons.show_chart,
text: "Performance",
),
],
),
),
),
)));
}),
),
),
SizedBox(
child: Scaffold(
backgroundColor: const Color(0xffF6F6F6),
body: TextSelectionTheme(
data: TextSelectionTheme.of(context).copyWith(
selectionColor: Color(0xffD7D7D7),
cursorColor: Color(0xff3B3B3B),
selectionHandleColor: Color(0xffD7D7D7),
),
child: Center(
child: Container(
child: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
const Center(
child: Text(
"Your email",
style: TextStyle(
fontSize: 20,
fontStyle: FontStyle.normal,
fontWeight: FontWeight.normal,
color: Color(0xff3B3B3B),
),
),
),
const SizedBox(height: 20,),
const Center(
child: SizedBox(
width: 350,
child: TextField(
cursorColor: Color(0xff3B3B3B),
decoration: InputDecoration(
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Color(0xffD7D7D7)),
),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Color(0xffD7D7D7)),
),
),
style: TextStyle(
fontSize: 20,
decoration: TextDecoration.none,
decorationStyle: TextDecorationStyle.dotted,
decorationColor: Color(0xffF6F6F6),
fontStyle: FontStyle.normal,
fontWeight: FontWeight.normal,
color: Color(0xff3B3B3B),
),
),
),
),
const SizedBox(
height: 110,
),
const Center(
child: Text(
"Your password",
style: TextStyle(
fontSize: 20,
fontStyle: FontStyle.normal,
fontWeight: FontWeight.normal,
color: Color(0xff3B3B3B),
),
),
),
const SizedBox(
height: 20,
),
const SizedBox(
height: 110,
),
GestureDetector(
onTap: () {
print("arrow clicked");
Navigator.pushReplacement(
context, MaterialPageRoute(builder: (_) => HomePageTimerUI()));
},
child: Container(
child: Center(
child: Icon(
Icons.arrow_forward,
size: 40,
color: Color(0xff7E7E7E),
),
),
),
)
],
),
),
),
),
),
),
)
],
),
);
}) ;
});
}
}
How to solve this issue?
Thank you in advance for your help, I really appreciate it, and hope you have a great day

Remove width : double.infinity
It will try to create a container of infinite width which will work if the parent widget has bounds

Related

flutter issue: bottom overflowed by 57 pixels

Here my bottom preferredSize (preferredSize: Size.fromHeight(148.0)) in appBar.
This error raised onlu in IOS not in android. I dont know why?
On every tab this error raising, so I thought I got this error by preferredSize.
But how to solve this I am not understanding.
This error raised onlu in IOS not in android. I dont know why?
On every tab this error raising, so I thought I got this error by preferredSize.
But how to solve this I am not understanding.
this is my code
import 'package:flutter/material.dart';
import 'package:showcaseview/showcaseview.dart';
import 'package:url_launcher/url_launcher.dart' as UrlLauncher;
import 'package:dropdown_button2/dropdown_button2.dart';
import 'dart:developer';
import '../../../APIMnager/APIManager.dart';
import '../../../APIMnager/preferences.dart';
import '../../../Constants/constants.dart';
import 'action_page.dart';
import 'holding_page.dart';
import 'overview_page.dart';
import 'report_page.dart';
class PMSListDataPage extends StatelessWidget {
final panNum;
final singlePMSData;
final allPMSListData;
const PMSListDataPage(
{Key? key, this.panNum, this.singlePMSData, this.allPMSListData})
: super(key: key);
#override
Widget build(BuildContext context) {
return Scaffold(
body: ShowCaseWidget(
onStart: (index, key) {
log('onStart: $index, $key');
},
onComplete: (index, key) {
log('onComplete: $index, $key');
print("here me");
if (index == 0) {
Preferences.saveData("showCaseCount2", "2");
}
},
blurValue: 1,
builder: Builder(
builder: (context) => PMSListDataPage1(
panNum: panNum,
singlePMSData: singlePMSData,
allPMSListData: allPMSListData)),
autoPlayDelay: const Duration(seconds: 3),
),
);
}
}
class PMSListDataPage1 extends StatefulWidget {
final panNum;
final singlePMSData;
final allPMSListData;
const PMSListDataPage1(
{Key? key, this.panNum, this.singlePMSData, this.allPMSListData})
: super(key: key);
#override
_PMSListDataPage1State createState() => _PMSListDataPage1State();
}
class _PMSListDataPage1State extends State<PMSListDataPage1> {
var selectedValue;
ApiManager apiManager = ApiManager();
final GlobalKey _one = GlobalKey();
final GlobalKey _two = GlobalKey();
final GlobalKey _three = GlobalKey();
final scrollController = ScrollController();
#override
void initState() {
super.initState();
}
#override
Widget build(BuildContext context) {
return Scaffold(
body: DefaultTabController(
length: 4,
child: Scaffold(
resizeToAvoidBottomInset: false,
appBar: AppBar(
leading: Builder(
builder: (BuildContext context) {
return IconButton(
icon: Icon(Icons.arrow_back_ios_rounded),
onPressed: () {
Navigator.pop(context);
},
tooltip: '',
);
},
),
elevation: 0,
backgroundColor: skyBlue,
title: Text(
"PMS",
style: TextStyle(fontSize: tSize16),
),
actions: [
Row(
children: [
Padding(
padding: const EdgeInsets.only(right: 8.0),
child: IconButton(
icon: Image.asset(
"assets/phone_icon.png",
height: 25,
width: 25,
),
onPressed: () {
UrlLauncher.launch('tel:+91$UserRMNumber');
}))
],
)
],
bottom: PreferredSize(
preferredSize: Size.fromHeight(148.0),
child: Column(
children: [
Container(
color: skyBlue,
height: 90,
child:
nameView(widget.singlePMSData, widget.allPMSListData),
),
Padding(
padding: const EdgeInsets.only(bottom: 10.0),
child: TabBar(
overlayColor:
MaterialStateProperty.all(Colors.transparent),
indicatorColor: Colors.white,
unselectedLabelColor: lightBlue,
onTap: (v) {
searchHoldingsQuery.clear();
FocusScope.of(context).unfocus();
},
indicator: UnderlineTabIndicator(
borderSide: BorderSide(
color: Colors.white,
width: 3.2,
style: BorderStyle.solid),
insets: EdgeInsets.only(left: 30.0, right: 30)),
isScrollable: true,
labelColor: Colors.white,
tabs: [
Tab(
child: Text(
'OVERVIEW',
),
),
Tab(
child: Text(
'HOLDINGS',
),
),
Tab(
child: Text(
'REPORTS',
),
),
Tab(
child: Text(
'ACTIONS',
),
),
],
),
),
],
),
),
),
body:
TabBarView(physics: NeverScrollableScrollPhysics(), children: [
Padding(
padding: const EdgeInsets.only(top: 12.0),
child: OverviewPage(),
),
Padding(
padding: const EdgeInsets.only(top: 12.0),
child: HoldingPage(),
),
Padding(
padding: const EdgeInsets.only(top: 12.0),
child: ReportPage(),
),
Padding(
padding: const EdgeInsets.only(top: 12.0),
child: ActionPage(),
),
]),
)),
);
}
}
extension WidgetExtension on _PMSListDataPage1State {
nameView(singlePMSData, allPMSListData) {
return Padding(
padding: const EdgeInsets.only(left: 20, right: 20, top: 5, bottom: 0),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),
color: Colors.white,
),
child: DropdownButtonHideUnderline(
child: DropdownButton2(
onMenuClose: () {},
onTap: () {},
isExpanded: true,
hint: Row(
children: [
SizedBox(
width: 10,
),
Expanded(
child: Row(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
singlePMSData['name'].toString(),
style: TextStyle(
fontSize: tSize16,
fontWeight: FontWeight.w600,
color: blackColor,
),
overflow: TextOverflow.ellipsis,
),
SizedBox(
height: 6,
),
Row(
children: [
Text(
'₹ ${singlePMSData["current_value"]}',
style: TextStyle(
fontSize: tSize16,
fontWeight: FontWeight.w600,
color: green2Color,
),
overflow: TextOverflow.ellipsis,
),
SizedBox(
width: 10,
),
],
),
],
),
],
),
),
],
),
items: allPMSListData.map<DropdownMenuItem<Object>>((option) {
return DropdownMenuItem(
value: option,
child: Container(
width: double.infinity,
alignment: Alignment.centerLeft,
// padding: const EdgeInsets.fromLTRB(0,8.0,0,6.0),
child: Row(
children: [
SizedBox(
width: 10,
),
Text(
option["name"],
style: TextStyle(
fontSize: tSize16,
fontWeight: FontWeight.w600,
color: blackColor,
),
overflow: TextOverflow.ellipsis,
),
],
),
decoration: BoxDecoration(
border: Border(
top: BorderSide(color: lightGreyColor, width: 1)))),
);
}).toList(),
selectedItemBuilder: (con) {
return allPMSListData.map<Widget>((item) {
return Row(
children: [
SizedBox(
width: 10,
),
Expanded(
child: Row(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
item['name'].toString(),
style: TextStyle(
fontSize: tSize16,
fontWeight: FontWeight.w600,
color: blackColor,
),
overflow: TextOverflow.ellipsis,
),
SizedBox(
height: 6,
),
Row(
children: [
Text(
"₹ ${item["current_value"]}",
style: TextStyle(
fontSize: tSize16,
fontWeight: FontWeight.w600,
color: green2Color,
),
overflow: TextOverflow.ellipsis,
),
SizedBox(
width: 10,
),
],
),
],
),
],
),
),
],
);
}).toList();
},
value: selectedValue,
onChanged: (dynamic value) {
setState(() {
});
},
icon: Container(
width: 22,
height: 22,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(3),
color: skyBlue,
),
child: Icon(
Icons.keyboard_arrow_down,
color: Colors.white,
size: 17,
),
),
iconOnClick: Container(
width: 22,
height: 22,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(3),
color: skyBlue,
),
child: Icon(
Icons.keyboard_arrow_up,
color: Colors.white,
size: 17,
),
),
iconSize: 14,
buttonHeight: 70,
buttonPadding: const EdgeInsets.only(left: 14, right: 14),
buttonDecoration: BoxDecoration(
borderRadius: BorderRadius.circular(14),
border: Border.all(
color: lightBlue,
),
color: Colors.white,
),
buttonElevation: 1,
itemHeight: 44,
itemPadding: const EdgeInsets.only(left: 14, right: 14),
dropdownMaxHeight: 200,
dropdownPadding: null,
dropdownDecoration: BoxDecoration(
borderRadius: BorderRadius.circular(14),
color: Colors.white,
),
dropdownElevation: 1,
scrollbarRadius: const Radius.circular(40),
scrollbarThickness: 3,
scrollbarAlwaysShow: false,
// offset: const Offset(-10, 0),
),
),
),
);
}
}

Why doesn't the color change everywhere in the tabbar?

My task is to change the background to orange on click, the text under the icon to orange, and the icon to white. However, I only change the color of the text. Why?
my tabs -
return Tab(
height: 90,
child: Column(
children: [
Container(
width: 71,
height: 71,
decoration: BoxDecoration(
color: Colors.white,
shape: BoxShape.circle
),
child: IconButton(onPressed: () {}, icon: Icon(iconName, size: 26, color: configColors.homeIcon,)),
),
FittedBox(
child: Text(header, style: TextStyle(fontFamily: "Mark-Pro", fontWeight: FontWeight.w500, fontSize: 15),),
)
],
),);
my tabbar -
TabBar(
isScrollable: true,
labelColor: configColors.orange,
unselectedLabelColor: configColors.darkBlue,
indicatorColor: Colors.transparent,
tabs: const [
Tabs('Phones', Icons.phone_iphone),
Tabs('Computer', Icons.computer),
Tabs('Health', Icons.monitor_heart_outlined),
Tabs('Books', Icons.menu_book),
Tabs('Watch', Icons.watch_later_outlined),
],
),
full code -
return Scaffold(
backgroundColor: configColors.bgHome,
body: Container(
margin: EdgeInsets.fromLTRB(17, 50, 33, 0),
child: SingleChildScrollView(
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
SizedBox(
width: 50,
),
Row(
children: [
IconButton(onPressed: () {}, icon: Icon(Icons.place_outlined, color: configColors.orange, size: 17,)),
Text('Zihuatanejo, Gro', style: TextStyle(
color: configColors.darkBlue,
fontFamily: "Mark-Pro",
fontSize: 15,
fontWeight: FontWeight.w500
),),
IconButton(onPressed: () {}, icon: Icon(Icons.expand_more, color: configColors.grey, size: 20,))
],
),
IconButton(onPressed: () {}, icon: Image.asset('assets/image/vector.png'))
],
),
Container(
margin: EdgeInsets.only(top: 18),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('Select Category', style: TextStyle(
color: configColors.darkBlue,
fontFamily: "Mark-Pro",
fontSize: 25,
fontWeight: FontWeight.w700
),),
TextButton(onPressed: () {}, child: Text('view all', style: TextStyle(
color: configColors.orange,
fontFamily: "Mark-Pro",
fontSize: 15,
fontWeight: FontWeight.w400
),))
],
),
),
Container(
child: DefaultTabController(
length: 5, // length of tabs
initialIndex: 0,
child: Column(crossAxisAlignment: CrossAxisAlignment.stretch, children: <Widget>[
Container(
child: TabBar(
isScrollable: true,
labelColor: configColors.orange,
unselectedLabelColor: configColors.darkBlue,
indicatorColor: Colors.transparent,
tabs: const [
Tabs('Phones', Icons.phone_iphone),
Tabs('Computer', Icons.computer),
Tabs('Health', Icons.monitor_heart_outlined),
Tabs('Books', Icons.menu_book),
Tabs('Watch', Icons.watch_later_outlined),
],
),
),
// Container(
// margin: EdgeInsets.only(top: 35),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// TextField(
// decoration: InputDecoration(
// enabledBorder: OutlineInputBorder(
// borderSide:
// BorderSide(width: 3, color: Colors.greenAccent), //<-- SEE HERE
// borderRadius: BorderRadius.circular(50.0),
// ),
// ),
// ),
// ],
// ),
// ),
Container(
height: 400, //height of TabBarView
decoration: BoxDecoration(
border: Border(top: BorderSide(color: Colors.grey, width: 0.5))
),
child: TabBarView(children: <Widget>[
Container(
child: Center(
child: Text('Display Tab 1', style: TextStyle(fontSize: 22, fontWeight: FontWeight.bold)),
),
),
Container(
child: Center(
child: Text('Display Tab 2', style: TextStyle(fontSize: 22, fontWeight: FontWeight.bold)),
),
),
Container(
child: Center(
child: Text('Display Tab 3', style: TextStyle(fontSize: 22, fontWeight: FontWeight.bold)),
),
),
Container(
child: Center(
child: Text('Display Tab 4', style: TextStyle(fontSize: 22, fontWeight: FontWeight.bold)),
),
),
Container(
child: Center(
child: Text('Display Tab 5', style: TextStyle(
fontSize: 22, fontWeight: FontWeight.bold)),
),
)])
)
])
),
),
],
),
)
),
);
}
}
class Tabs extends StatelessWidget {
final String header;
final IconData iconName;
const Tabs(this.header, this.iconName);
#override
Widget build(BuildContext context) {
return Tab(
height: 90,
child: Column(
children: [
Container(
width: 71,
height: 71,
decoration: BoxDecoration(
color: Colors.white,
shape: BoxShape.circle
),
child: IconButton(onPressed: () {}, icon: Icon(iconName, size: 26, color: configColors.homeIcon,)),
),
FittedBox(
child: Text(header, style: TextStyle(fontFamily: "Mark-Pro", fontWeight: FontWeight.w500, fontSize: 15),),
)
],
),);
}
There is a way to determine if it was triggered by using the index value at the time of tapping.
class _HomeState extends State<Home> {
List<bool> _selected = [true, false, false, false];
#override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white70,
appBar: AppBar(),
body: DefaultTabController(
length: 4,
child: TabBar(
isScrollable: true,
labelColor: Colors.orange,
unselectedLabelColor: Colors.blueGrey,
indicatorColor: Colors.transparent,
onTap: (index) => _selectedState(index),
tabs: [
Tabs('Phones', Icons.phone_iphone, 0),
Tabs('Computer', Icons.computer, 1),
Tabs('Books', Icons.menu_book, 2),
Tabs('Watch', Icons.watch_later_outlined, 3),
],
),
),
);
}
Widget Tabs(String header, IconData iconName, int index) {
return Tab(
height: 90,
child: Column(
children: [
Container(
width: 71,
height: 71,
decoration:
BoxDecoration(color: _selected[index] == true ? Colors.orange : Colors.white, shape: BoxShape.circle),
child: IconButton(
onPressed: () {},
icon: Icon(
iconName,
size: 26,
color: Colors.grey,
)),
),
FittedBox(
child: Text(
header,
style: TextStyle(
fontFamily: "Mark-Pro",
fontWeight: FontWeight.w500,
fontSize: 15),
),
)
],
),
);
}
_selectedState(int index) {
setState(() {
switch (index) {
case 0:
_selected[0] = true;
_selected[1] = false;
_selected[2] = false;
_selected[3] = false;
break;
case 1:
_selected[0] = false;
_selected[1] = true;
_selected[2] = false;
_selected[3] = false;
break;
case 2:
_selected[0] = false;
_selected[1] = false;
_selected[2] = true;
_selected[3] = false;
break;
case 3:
_selected[0] = false;
_selected[1] = false;
_selected[2] = false;
_selected[3] = true;
break;
default:
_selected[0] = true;
_selected[1] = false;
_selected[2] = false;
_selected[3] = false;
}
});
}
}
You can try below named parameter by assigning color in Tabbar widget.
indicatorColor: Colors.orange,
Use TabController to track the selected tap, and play with the color decoration by passing active index.
class FAG extends StatefulWidget {
FAG({Key? key}) : super(key: key);
#override
State<FAG> createState() => _FAGState();
}
class _FAGState extends State<FAG> with SingleTickerProviderStateMixin {
late final TabController controller = TabController(length: 5, vsync: this)
..addListener(() {
setState(() {});
});
#override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.pink,
body: Container(
margin: EdgeInsets.fromLTRB(17, 50, 33, 0),
child: SingleChildScrollView(
child: Column(
children: [
Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Container(
child: TabBar(
controller: controller,
isScrollable: true,
labelColor: Colors.orange,
unselectedLabelColor: Colors.blueGrey,
indicatorColor: Colors.transparent,
tabs: [
Tabs(
'Phones',
Icons.phone_iphone,
isActive: controller.index == 0,
),
Tabs(
'Computer',
Icons.computer,
isActive: controller.index == 1,
),
Tabs(
'Health',
Icons.monitor_heart_outlined,
isActive: controller.index == 2,
),
Tabs(
'Books',
Icons.menu_book,
isActive: controller.index == 3,
),
Tabs(
'Watch',
Icons.watch_later_outlined,
isActive: controller.index == 4,
),
],
),
),
Container(
height: 400, //height of TabBarView
decoration: BoxDecoration(
border: Border(
top: BorderSide(
color: Colors.grey, width: 0.5))),
child: TabBarView(
controller: controller,
children: <Widget>[
Container(
child: Center(
child: Text('Display Tab 1',
style: TextStyle(
fontSize: 22,
fontWeight: FontWeight.bold)),
),
),
Container(
child: Center(
child: Text('Display Tab 2',
style: TextStyle(
fontSize: 22,
fontWeight: FontWeight.bold)),
),
),
Container(
child: Center(
child: Text('Display Tab 3',
style: TextStyle(
fontSize: 22,
fontWeight: FontWeight.bold)),
),
),
Container(
child: Center(
child: Text('Display Tab 4',
style: TextStyle(
fontSize: 22,
fontWeight: FontWeight.bold)),
),
),
Container(
child: Center(
child: Text('Display Tab 5',
style: TextStyle(
fontSize: 22,
fontWeight: FontWeight.bold)),
),
)
]))
]),
),
],
),
)),
);
}
}
class Tabs extends StatelessWidget {
final String header;
final IconData iconName;
final bool isActive;
const Tabs(this.header, this.iconName, {required this.isActive, super.key});
#override
Widget build(BuildContext context) {
return Tab(
icon: Container(
width: 71,
height: 71,
decoration: BoxDecoration(
color: isActive ? Colors.white : Colors.amber,
shape: BoxShape.circle),
child: IconButton(
onPressed:null,//dont need this
icon: Icon(
iconName,
size: 26,
color: isActive ? Colors.amber : Colors.white,
)),
),
height: 97,
text: header,
);
}
}

How to make this tab bar in flutter

How to make adjust the size of tabba rto 40 in flutter ,how to make 2 tabbar in one screen in flutter please any one colud help with this
Here is the code it might help you.
import 'package:flutter/material.dart';
class StackOverFlowUI extends StatefulWidget {
#override
State<StackOverFlowUI> createState() => _StackOverFlowUIState();
}
class _StackOverFlowUIState extends State<StackOverFlowUI>
with SingleTickerProviderStateMixin {
late TabController _tabController;
#override
void initState() {
_tabController = TabController(length: 3, vsync: this);
super.initState();
}
#override
void dispose() {
super.dispose();
_tabController.dispose();
}
#override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
toolbarHeight: 200,
backgroundColor: Colors.transparent,
elevation: 0,
centerTitle: true,
flexibleSpace: Container(
padding: const EdgeInsets.symmetric(horizontal: 30, vertical: 15),
height: 300,
decoration: const BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topRight,
end: Alignment.topLeft,
colors: [
Color(0xFFd1539d),
Color(0xFF36a4e2),
],
),
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(50),
bottomRight: Radius.circular(50),
),
),
child: Column(
children: [
Expanded(
child: Center(
child: RichText(
text: const TextSpan(
children: [
WidgetSpan(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 2.0),
child: Icon(
Icons.bookmark_border,
color: Colors.white,
size: 25,
),
),
),
TextSpan(
text: " Tik Save+",
style: TextStyle(
fontSize: 23,
),
),
],
),
),
)),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: const [
Icon(
Icons.settings,
color: Colors.white,
),
Icon(
Icons.tiktok,
color: Colors.white,
),
],
)
],
),
),
),
body: DefaultTabController(
length: 3,
child: Scaffold(
bottomNavigationBar: bottomMenu(),
body: TabBarView(
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
Container(
height: 45,
decoration: BoxDecoration(
color: Colors.grey[300],
borderRadius: BorderRadius.circular(
10.0,
),
),
child: TabBar(
controller: _tabController,
indicator: BoxDecoration(
borderRadius: BorderRadius.circular(
10.0,
),
color: Colors.grey[800],
),
labelColor: Colors.white,
unselectedLabelColor: Colors.black,
tabs: const [
Tab(
text: 'Videos',
),
Tab(
text: 'Collections',
),
Tab(
text: 'Users',
),
],
),
),
Expanded(
child: TabBarView(
controller: _tabController,
children: const [
Center(
child: Text(
'Videos',
style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.w600,
),
),
),
Center(
child: Text(
'Collections',
style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.w600,
),
),
),
Center(
child: Text(
'Users',
style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.w600,
),
),
),
],
),
),
],
),
),
const Icon(Icons.directions_transit),
const Icon(Icons.directions_bike),
],
),
),
),
);
}
Widget bottomMenu() {
return Container(
decoration: const BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topRight,
end: Alignment.topLeft,
colors: [
Color(0xFFd1539d),
Color(0xFF36a4e2),
],
),
),
child: const TabBar(
labelColor: Colors.white,
unselectedLabelColor: Colors.white70,
indicatorSize: TabBarIndicatorSize.tab,
indicatorPadding: EdgeInsets.all(5.0),
indicatorColor: Colors.black,
tabs: [
Tab(
text: "Home",
icon: Icon(Icons.home_outlined),
),
Tab(
text: "Pro",
icon: Icon(Icons.workspace_premium),
),
Tab(
text: "More",
icon: Icon(Icons.more_rounded),
),
],
),
);
}
}

TabBarView inside Sliver with StickyHeader

I have made this layout so far using CustomScrollView and Sticky Header
https://imgur.com/a/Xo4AfAM
What I want to achieve is that the content below the tabs should not scroll unless there is extra content available. Also, after scrolling, the content should not go behind the sticky header.
My Code so far.
Scaffold(
backgroundColor: Colors.white,
extendBodyBehindAppBar: true,
appBar: AppBar(
toolbarHeight: getHeight() * (1 / 11),
),
body: Padding(
padding: getPaddings(),
child: DefaultTabController(
length: 3,
child: CustomScrollView(
slivers: [
SliverToBoxAdapter(
child: Container(
height: getHeight() * (3 / 11),
color: Colors.blue,
),
),
SliverStickyHeader(
header: Column(
children: [
Container(
height: getHeight() * (1 / 11),
width: double.infinity,
color: kPrimaryColor,
child: Center(
child: Text(
"TEXT",
style: TextStyle(
fontSize: 32,
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
),
),
Container(
height: getHeight() * (1 / 11),
color: kPrimaryColor,
child: TabBar(
tabs: [
Tab(
child: Text(
'TITLE1',
style: TextStyle(color: Colors.black),
),
),
Tab(
child: Text(
'TITLE2',
style: TextStyle(color: Colors.black),
),
),
Tab(
child: Text(
'TITLE3',
style: TextStyle(color: Colors.black),
),
),
],
),
),
],
),
sliver: SliverFillRemaining(
child: TabBarView(
children: [
Padding(
padding: EdgeInsets.symmetric(
horizontal: getProportionateScreenWidth(50),
vertical: getProportionateScreenHeight(20)),
child: Column(
children: [
RoundedPicture(),
FittedBox(
child: Text("Hello World",
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 40)),
),
SizedBox(
height: getProportionateScreenHeight(20),
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
RichText(
text: TextSpan(
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 20),
text: 'Info1: ',
children: [
TextSpan(
text: "123",
style: TextStyle(
color: kSecondaryColor,
),
),
]),
),
SizedBox(
height: getProportionateScreenHeight(20),
),
RichText(
text: TextSpan(
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 20),
text: 'Info2: ',
children: [
TextSpan(
text: "abcd",
style: TextStyle(
color: kSecondaryColor,
),
),
]),
),
SizedBox(
height: getProportionateScreenHeight(20),
),
RichText(
text: TextSpan(
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 20),
text: 'Info3: ',
children: [
TextSpan(
text: "xyz",
style: TextStyle(
color: kSecondaryColor,
),
),
]),
),
],
),
],
),
),
Center(
child: Text("TITLE2"),
),
Center(
child: Text("TITLE3"),
),
],
),
),
),
],
),
),
),
To achieve the required layout, I tried using TabBarView inside different slivers i.e SliverList and SliverToBoxAdapter but they all resulted in an error because TabBarView doesn't have a predefined height.
Here is my implementation.
Because there are no method related to size, I just set a value myself.
Stack
DefaultTabController
NestedScrollView
SliverAppBar
SliverPersistentHeader
SliverPersistentHeader
TabBarView
Container // For back button
import 'package:flutter/material.dart';
import 'dart:math' as math;
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
#override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
#override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage>
with SingleTickerProviderStateMixin {
TabController _tabController;
#override
void initState() {
super.initState();
_tabController = TabController(initialIndex: 0, length: 3, vsync: this);
}
double getHeight() {
return 800;
}
#override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
extendBodyBehindAppBar: true,
body: SafeArea(
child: Stack(
children: [
DefaultTabController(
length: 3,
child: NestedScrollView(
headerSliverBuilder: (context, value) {
return [
SliverAppBar(
expandedHeight: 200.0,
flexibleSpace: FlexibleSpaceBar(),
),
SliverPersistentHeader(
pinned: true,
delegate: _SliverAppBarDelegate(
minHeight: 90,
maxHeight: 90,
child: Container(
height: getHeight() * (1 / 11),
width: double.infinity,
color: Colors.green[200],
child: Center(
child: Text(
"TEXT",
style: TextStyle(
fontSize: 32,
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
),
),
),
),
SliverPersistentHeader(
pinned: true,
delegate: _SliverAppBarDelegate(
minHeight: 90,
maxHeight: 90,
child: Container(
color: Colors.green[200],
child: TabBar(
controller: _tabController,
tabs: [
Tab(
child: Text(
'TITLE1',
style: TextStyle(
color: Colors.black,
),
),
),
Tab(
child: Text(
'TITLE2',
style: TextStyle(color: Colors.black),
),
),
Tab(
child: Text(
'TITLE3',
style: TextStyle(color: Colors.black),
),
),
],
),
),
),
),
];
},
body: TabBarView(
controller: _tabController,
children: [
SingleChildScrollView(
child: Container(
padding: EdgeInsets.only(bottom: 600),
child: Column(
children: [
// RoundedPicture(),
Icon(
Icons.favorite,
color: Colors.pink,
size: 150.0,
semanticLabel:
'Text to announce in accessibility modes',
),
FittedBox(
child: Text("Hello World",
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 40)),
),
SizedBox(
height: 20,
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
RichText(
text: TextSpan(
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 20),
text: 'Info1: ',
children: [
TextSpan(
text: "123",
style: TextStyle(),
),
]),
),
SizedBox(
height: 20,
),
RichText(
text: TextSpan(
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 20),
text: 'Info2: ',
children: [
TextSpan(
text: "abcd",
style: TextStyle(),
),
]),
),
SizedBox(
height: 20,
),
RichText(
text: TextSpan(
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 20),
text: 'Info3: ',
children: [
TextSpan(
text: "xyz",
style: TextStyle(),
),
]),
),
],
),
],
),
),
),
SingleChildScrollView(
child: Container(
padding: EdgeInsets.only(bottom: 600),
child: Column(
children: [
Container(
padding: EdgeInsets.only(bottom: 600),
child: Center(
child: Text("TITLE2"),
),
),
],
),
),
),
SingleChildScrollView(
child: Container(
padding: EdgeInsets.only(bottom: 600),
child: Column(
children: [
Container(
padding: EdgeInsets.only(bottom: 600),
child: Center(
child: Text("TITLE3"),
),
),
],
),
),
),
],
),
),
),
Container(
height: 90,
padding: EdgeInsets.symmetric(horizontal: 15),
child: InkWell(
onTap: () {},
child: Icon(Icons.arrow_back),
),
),
],
),
),
);
}
}
class _SliverAppBarDelegate extends SliverPersistentHeaderDelegate {
_SliverAppBarDelegate({
#required this.minHeight,
#required this.maxHeight,
#required this.child,
});
final double minHeight;
final double maxHeight;
final Widget child;
#override
double get minExtent => minHeight;
#override
double get maxExtent => math.max(maxHeight, minHeight);
#override
Widget build(
BuildContext context, double shrinkOffset, bool overlapsContent) {
return SizedBox.expand(child: child);
}
#override
bool shouldRebuild(_SliverAppBarDelegate oldDelegate) {
return maxHeight != oldDelegate.maxHeight ||
minHeight != oldDelegate.minHeight ||
child != oldDelegate.child;
}
}
After finding no possible solution, I decided to implement my own tab bar view instead of using the default one. The solution isn't as fancy since the transition of tabs is done by changing the current page number and rebuilding the widget but solves the issue. I used a gesture detector for allowing users to swipe the page.
GestureDetector(
onHorizontalDragEnd: (dragDetails) {
if (dragDetails.primaryVelocity != 0) {
final int val = dragDetails.primaryVelocity.sign.toInt();
if (currentPage - val >= 0 &&
currentPage - val < tabController.length)
tabController.animateTo(currentPage - val);
}
},
child: CustomScrollView(
shrinkWrap: true,
controller: scrollController,
slivers: [
SliverToBoxAdapter(
child: LogoContainer(),
),
SliverStickyHeader(
header: Column(
children: [
NameContainer(text: 'TEXT'),
Container(
height: 60,
color: kSecondaryColor,
child: TabBar(
controller: tabController,
tabs: [
Tab(
child: Text(
'TITLE1',
style: TextStyle(color: Colors.black),
),
),
Tab(
child: Text(
'TITLE2',
style: TextStyle(color: Colors.black),
),
),
Tab(
child: Text(
'TITLE3',
style: TextStyle(color: Colors.black),
),
),
],
),
),
],
),
sliver: SliverToBoxAdapter(
child: ConstrainedBox(
constraints:
BoxConstraints(minHeight: getHeight() * (6 / 11)),
child: [
Column(
children: [
RoundedPicture(),
FittedBox(
child: Text(
'HELLO WORLD',
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 40),
),
),
SizedBox(
height: getProportionateScreenHeight(20),
),
Column(
children: [
ProfileInfoText(
title: 'INFO1',
text: 'abcd',
),
SizedBox(
height: getProportionateScreenHeight(20),
),
ProfileInfoText(
title: 'INFO2',
text: '123',
),
SizedBox(
height: getProportionateScreenHeight(20),
),
ProfileInfoText(
title: 'INFO3',
text: 'xyz',
),
],
),
],
),
Center(
child: Text("TITLE2"),
),
Center(
child: Text("TITLE3"),
),
].elementAt(currentPage),
),
),
),
],
),
),
I also used scroll controller to animate the list back to top when changing the tabs to give it a smooth look.
#override
void initState() {
super.initState();
tabController = TabController(length: 3, vsync: this)
..addListener(() async {
await scrollController.animateTo(
0,
duration: Duration(seconds: 1),
curve: Curves.ease,
);
setState(() {
currentPage = tabController.index;
});
});
}

Does anyone know how to implement a search bar with tabs like that similar to instagram using flutter?

I want to know how to build a search bar where it filters the users search input into groups or tabs such as people, tags, places just like what instagram has but I don't know how to do this!
It could look like this:
import 'package:flutter/material.dart';
main() => runApp(
MaterialApp(
// home: Scaffold(
// body: Container(child: SearchButton()),
home: Body()),
);
class Body extends StatefulWidget {
#override
_BodyState createState() => _BodyState();
}
class _BodyState extends State<Body> {
TextEditingController controller;
#override
void initState() {
super.initState();
controller = TextEditingController();
}
#override
Widget build(BuildContext context) {
return DefaultTabController(
length: 2,
child: Scaffold(
appBar: AppBar(
leading: Icon(Icons.search),
title: TextField(
controller: controller,
cursorColor: Colors.white,
style: TextStyle(color: Colors.white),
),
bottom: TabBar(tabs: [
Tab(icon: Icon(Icons.people)),
Tab(icon: Icon(Icons.location_city)),
]),
),
body: TabBarView(children: [Container(), Container()]),
),
);
}
}
Wanted result:
Result from Code:
use UniqueKey() for that
example
Scaffold(
backgroundColor: ColorConstant.colorWhite,
body: Container(
height: size.height,
child: Column(
children: [
Container(
decoration: BoxDecoration(
color: ColorConstant.colorWhite,
//border: Border.all(),
),
child: Padding(
padding: const EdgeInsets.only(bottom: 15),
child: Column(
children: [
Padding(
padding: const EdgeInsets.only(
top: 50.0, left: 15, right: 15, bottom: 15),
child: Stack(
clipBehavior: Clip.none,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
width: 265,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5),
color: ColorConstant.colorIntroBG
.withOpacity(0.1),
),
child: TextFormField(
controller: _searchController,
onChanged: (text) {
if (text != null) {
setState(() {
// callFriendSuggestionListApi(0, text, true);
// print("inside");
// DiscoveryPostTabScreen(text);
searchText = text;
// _Controller.animateTo(2);
});
}
},
style: TextStyle(
fontSize: 16,
color: ColorConstant.textColor2,
fontFamily: 'HK Medium'),
decoration: new InputDecoration(
hintText: "Search Friend",
isDense: true,
// Added this
contentPadding: EdgeInsets.all(8),
hintStyle: TextStyle(
fontSize: 16,
color: ColorConstant.hintColor,
fontFamily: 'HK Medium'),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(5),
borderSide: BorderSide(
color: ColorConstant.colorIntroBG
.withOpacity(0.1),
width: 0.1),
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(5),
borderSide: BorderSide(
color: ColorConstant.colorIntroBG
.withOpacity(0.1),
width: 0.1),
),
prefixIcon: Icon(
Icons.search,
// color: ColorConstant.errorIconColor,
size: 27,
),
suffixIcon: GestureDetector(
onTap: () {
print("object");
},
child: Icon(
Icons.close,
color: ColorConstant.colorIntroBG,
size: 25,
),
),
),
),
),
Text("cancel",
style: TextStyle(
fontFamily: "HK Bold",
fontSize: 16,
color: ColorConstant.colorIntroBG)),
],
),
],
),
),
SizedBox(
height: 10,
),
Container(
height: 30,
// height: 50,
child: TabBar(
controller: _Controller,
// controller: _controller,
unselectedLabelColor: ColorConstant.colorIntroBG,
tabs: [
Container(
child: Tab(
child: Text("Posts",
style: TextStyle(
fontFamily: "HK Medium", fontSize: 16)),
),
),
Container(
child: Tab(
child: Text("Friends",
style: TextStyle(
fontFamily: "HK Medium", fontSize: 16)),
),
),
Container(
child: Tab(
child: Text("Places",
style: TextStyle(
fontFamily: "HK Medium", fontSize: 16)),
),
),
Container(
child: Tab(
child: Text("Tags",
style: TextStyle(
fontFamily: "HK Medium", fontSize: 16)),
),
),
],
labelPadding: EdgeInsets.symmetric(horizontal: 0.0),
labelColor: ColorConstant.colorIntroBG,
// indicatorWeight: 5,
indicatorColor: ColorConstant.colorBlack,
// indicatorSize: TabBarIndicatorSize.label,
indicator: UnderlineTabIndicator(
borderSide: BorderSide(
color: ColorConstant.colorIntroBG, width: 2),
// insets: EdgeInsets.fromLTRB(60.0, 0.0, 60.0, 40.0),
),
)),
Container(
height: 1,
color: ColorConstant.borderColorOTP,
),
],
),
),
),
Expanded(
child: TabBarView(
controller: _Controller,
key: UniqueKey(),
children: [
DiscoveryPostTabScreen(_searchController.text),
DiscoveryFriendsScreen(_searchController.text),
DiscoveryPlacesScreen(_searchController.text),
DiscoveryTagsScreen(_searchController.text),
],
)),
],
),
),
);