I am getting this error when trying to add Widget in tab bar. Please check following code
return Scaffold(
appBar: new AppBar(
bottom: PreferredSize(
child: _tabBar,
preferredSize: Size.fromHeight(_tabBar.preferredSize.height - 50),
),
),
body: new TabBarView(
controller: _tabController,
children: <Widget>[
new PicMee(),
new PicMee()
],
),
);
For Picmee file:
class PicMee extends StatefulWidget{
@override
_PicMeeState createState() => new _PicMeeState();
}
class _PicMeeState extends State<PicMee>{
@override
Widget build(BuildContext context) {
// TODO: implement build
return new Scaffold(
body: new ListView.builder(
itemCount: 20,
itemBuilder: (BuildContext context, int index){
return new CustomWidget(date: null, content: null, trailingIconOne: null, trailingIconTwo: null)
}
// https://stackguides.com/questions/47233209/flutter-group-listviews-with-separator?rq=1
),
);
}
}
class CustomWidget extends StatelessWidget {
String date;
String content;
Icon trailingIconOne;
Icon trailingIconTwo;
CustomWidget(
{@required this.date, @required this.content, @required this.trailingIconOne, @required this.trailingIconTwo});
@override
Widget build(BuildContext context) {
return new Container(
decoration: new BoxDecoration(
border: new Border.all(color: Colors.grey[500])
),
child: new Column(
children: <Widget>[
new Container (child: new Text(date), color: Colors.yellow[200],),
new Container(height: 15.0,),
new Text(content),
new Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
new IconButton(icon: trailingIconOne, onPressed: () {}),
new Container(width: 10.0,),
new IconButton(icon: trailingIconTwo, onPressed: () {})
],
)
],
),
);
}
}
I am getting this error:
flutter: Another exception was thrown:
'package:flutter/src/widgets/text.dart': Failed assertion: line 235 pos 15: 'data != null': is not true.