Listview inside the scroll view in flutter - flutter

I am trying to make this type of view
there 3 types of news latest,sport and old news which are having 3 listview the data is populating but i am unable to scroll it the list view or the complete scroll view is not scrolling i had trying it from the 1 week please find the below code
I am able to the layout but it's not scrolling at all
First tab view
class First_Tab_Layout extends StatefulWidget {
#override
State<StatefulWidget> createState() {
First_State fst_state() => new First_State();
return fst_state();
}
}
class First_State extends State<First_Tab_Layout> {
List latest_news_list;
List sports_news_list;
List cinema_news_list;
latestnews() async {
var latest_news_url = common_url + 'getlatestPosts';
print(latest_news_url);
http.Response latest_newsresponse = await http.get(latest_news_url);
var latest_news_response = json.decode(latest_newsresponse.body);
setState(() {
latest_news_list = latest_news_response['posts'];
});
}
sportsnews() async {
var sports_news_url = common_url + 'getsportsPosts';
print(sports_news_url);
http.Response sports_newsresponse = await http.get(sports_news_url);
var sports_news_response = json.decode(sports_newsresponse.body);
setState(() {
sports_news_list = sports_news_response['posts'];
});
}
cinemanews() async {
var cinema_news_url = common_url + 'getcinemaPosts';
print(cinema_news_url);
http.Response cinema_newsresponse = await http.get(cinema_news_url);
var cinema_news_response = json.decode(cinema_newsresponse.body);
setState(() {
cinema_news_list = cinema_news_response['posts'];
});
}
#override
void initState() {
super.initState();
latestnews();
sportsnews();
cinemanews();
}
#override
Widget build(BuildContext context) {
return new MaterialApp(
debugShowCheckedModeBanner: false,
home: new Scaffold(
body: new ListView(
primary: true,
children: <Widget>[
new Container(
child: new Text(
'Latest News',
style: new TextStyle(fontSize: 16.0),
),
margin: EdgeInsets.only(left: 10.0, right: 10.0, bottom: 5.0),
alignment: Alignment(-1.0, 0.0),
),
new Container(
child: new Divider(
color: secondarycolor,
),
margin: EdgeInsets.only(right: 10.0, left: 10.0),
),
new Container(
child: new ListView.builder(
shrinkWrap: true,
itemCount: latest_news_list == null ? 0 : latest_news_list.length,
itemBuilder: (BuildContext context, int indexpos) {
return new GestureDetector(
onTap: () {
Navigator.push(
context,
new MaterialPageRoute(
builder: (context) => new News_Details(
postid: latest_news_list[indexpos]['id'],
)));
},
child: new Card(
elevation: 4.0,
margin: EdgeInsets.only(left: 10.0, right: 10.0, top: 5.0),
child: new Row(
children: <Widget>[
new Container(
child: new Image.network(
latest_news_list[indexpos]['image'],
width: 150.0,
fit: BoxFit.fill,
),
),
new Flexible(
child: new Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
new Container(
child: new Text(
latest_news_list[indexpos]['title']),
margin: EdgeInsets.only(left: 10.0),
),
new Container(
child: new Text(
latest_news_list[indexpos]['content'],
softWrap: true,
maxLines: 4,
),
margin: EdgeInsets.only(left: 10.0, top: 5.0),
),
],
),
)
],
),
),
);
},
),
),
new Container(
child: new Text(
'Sports News',
style: new TextStyle(fontSize: 16.0),
),
margin: EdgeInsets.only(left: 10.0, right: 10.0, top: 5.0),
alignment: Alignment(-1.0, 0.0),
),
new Container(
child: new Divider(
color: secondarycolor,
),
margin: EdgeInsets.only(right: 10.0, left: 10.0),
),
new Container(
child: new ListView.builder(
shrinkWrap: true,
itemCount: sports_news_list == null ? 0 : sports_news_list.length,
itemBuilder: (BuildContext context, int indexpos) {
return new GestureDetector(
child: new Card(
elevation: 4.0,
margin: EdgeInsets.only(left: 10.0, right: 10.0, top: 5.0),
child: new Row(
children: <Widget>[
new Container(
child: new Image.network(
sports_news_list[indexpos]['image'],
width: 150.0,
height: 75.0,
fit: BoxFit.fill,
),
),
new Column(
children: <Widget>[
new Container(
child:
new Text(sports_news_list[indexpos]['title']),
margin: EdgeInsets.only(left: 10.0),
),
new Container(
child:
new Text(sports_news_list[indexpos]['title']),
margin: EdgeInsets.only(left: 10.0, top: 5.0),
),
],
)
],
),
),
);
},
),
),
new Container(
child: new Text(
'Cinema News',
style: new TextStyle(fontSize: 16.0),
),
margin: EdgeInsets.only(
left: 10.0, right: 10.0, top: 10.0, bottom: 5.0),
alignment: Alignment(-1.0, 0.0),
),
new Container(
child: new Divider(
color: secondarycolor,
),
margin: EdgeInsets.only(right: 10.0, left: 10.0),
),
new Container(
child: new ListView.builder(
shrinkWrap: true,
itemCount: cinema_news_list == null ? 0 : cinema_news_list.length,
itemBuilder: (BuildContext context, int indexpos) {
return new GestureDetector(
child: new Card(
elevation: 4.0,
margin: EdgeInsets.only(left: 10.0, right: 10.0, top: 5.0),
child: new Row(
children: <Widget>[
new Container(
child: new Image.network(
cinema_news_list[indexpos]['image'],
width: 150.0,
height: 75.0,
fit: BoxFit.fill,
),
),
new Column(
children: <Widget>[
new Container(
child: new Text(
cinema_news_list[indexpos]['categorytitle']),
margin: EdgeInsets.only(left: 10.0),
),
new Container(
child: new Text(
cinema_news_list[indexpos]['categorytitle']),
margin: EdgeInsets.only(left: 10.0, top: 5.0),
),
],
)
],
),
),
);
},
),
),
],
)),
);
}
}

This worked for me. Not sure whether this will work for you. Try once. I just added physics to inner ListView.
new Container(
child: new ListView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),

This worked for me :
Widget build(BuildContext context) {
return Container(
color: Colors.white,
child: Padding(
padding: const EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 20.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Expanded(
child: Container(
child: ListView(
children: <Widget>[
selectedAddressSection(),
Padding(
padding: EdgeInsets.fromLTRB(15, 10, 0, 10),
child: Text("YOUR FAVOURITE PAYMENT METHODS",
textAlign: TextAlign.left,
style: TextStyle(
fontSize: 14.0,
fontFamily: 'Novecento Book',
fontWeight: FontWeight.bold)),
),
selectedPaymentMethod(),
Padding(
padding: EdgeInsets.fromLTRB(15, 10, 0, 10),
child: Text("PAYMENT DETAILS",
textAlign: TextAlign.left,
style: TextStyle(
fontSize: 14.0,
fontFamily: 'Novecento Book',
fontWeight: FontWeight.bold)),
),
SizedBox(
height: 8.0,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Container(
margin: EdgeInsets.only(left: 15),
child: Text(
"Subtotal",
textAlign: TextAlign.start,
style: TextStyle(
color: const Color(0xFF000000),
fontSize: 12.0,
fontFamily: 'Novecento Book',
fontWeight: FontWeight.w300),
),
),
Container(
margin: EdgeInsets.only(right: 15),
child: Text(
'\u{20B9}${2500.00}',
textAlign: TextAlign.start,
style: TextStyle(
color: const Color(0xFF000000),
fontSize: 12.0,
fontFamily: 'Novecento Book',
fontWeight: FontWeight.w300),
),
),
],
),
SizedBox(
height: 8.0,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Container(
margin: EdgeInsets.only(left: 15),
child: Text(
"Shipping",
textAlign: TextAlign.start,
style: TextStyle(
color: const Color(0xFF000000),
fontSize: 12.0,
fontFamily: 'Novecento Book',
fontWeight: FontWeight.w300),
),
),
Container(
margin: EdgeInsets.only(right: 15),
child: Text(
'Free',
textAlign: TextAlign.start,
style: TextStyle(
color: const Color(0xFF000000),
fontSize: 12.0,
fontFamily: 'Novecento Book',
fontWeight: FontWeight.w300),
),
),
],
),
SizedBox(
height: 8.0,
),
Divider(
color: Colors.grey.shade400,
height: 10,
thickness: 0.5,
indent: 10,
endIndent: 10,
),
SizedBox(
height: 8.0,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Container(
margin: EdgeInsets.only(left: 15),
child: Text(
"Grand total",
textAlign: TextAlign.start,
style: TextStyle(
color: const Color(0xFF000000),
fontSize: 12.0,
fontFamily: 'Novecento Book',
fontWeight: FontWeight.bold),
),
),
Container(
margin: EdgeInsets.only(right: 15),
child: Text(
'\u{20B9}${2500.00}',
textAlign: TextAlign.start,
style: TextStyle(
color: const Color(0xFF000000),
fontSize: 12.0,
fontFamily: 'Novecento Book',
fontWeight: FontWeight.bold),
),
),
],
),
Divider(
color: Colors.grey.shade400,
height: 20,
thickness: 0.5,
indent: 10,
endIndent: 10,
),
// standardDelivery(),
//priceSection()
],
),
),
),
],
),
),
);
}

Related

how to add horizontal scroll bar flutter

I'm trying to make a grocery app UI using flutter. How do I add a horizontal scroll bar to this code? suggest a proper way to do this without affecting other codes? the right side of the image shows my implementation so far. can someone please suggest to me a way to do this? also how do I add that left green box in front of search box?
import 'package:flutter/material.dart';
class HomePage extends StatefulWidget {
#override
_HomePageState createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
#override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Color(0xffEDEFF4),
bottomNavigationBar: BottomNavigationBar(
items: [
BottomNavigationBarItem(
icon: Icon(Icons.home,color: Colors.green ),
label: 'Home',
backgroundColor: Colors.white,
),
BottomNavigationBarItem(
icon: Icon(Icons.person,color: Colors.grey),
label: 'Profile',
// backgroundColor:Colors.blue,
),
BottomNavigationBarItem(
icon: Icon(Icons.shopping_cart,color: Colors.grey),
label: 'cart',
// backgroundColor:Colors.blue,
),
BottomNavigationBarItem(
icon: Icon(Icons.notifications ,color: Colors.grey),
label: 'bell',
// backgroundColor:Colors.blue,
),
BottomNavigationBarItem(
icon: Icon( Icons.more_horiz, color: Colors.grey),
label: 'bell',
// backgroundColor:Colors.blue,
),
]),
body: Padding(
padding: const EdgeInsets.only(top: 40, left: 20, right: 20),
child: ListView(
children: [
buildSearchInput(),
Stack(
children: [
Padding(
padding: const EdgeInsets.fromLTRB(0, 45, 10, 0),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20.0),
color: Color(0xffFFFCEE),
),
height: 180,
width: 380,
child: Column(
children: const [
Padding(
padding: EdgeInsets.fromLTRB(0, 20, 180, 10),
child: Text(
"FRUIT AND BERRIES",
style: TextStyle(
fontFamily:'Roboto',
fontSize: 10,
color: Colors.lightGreen,
fontWeight: FontWeight.w700),
),
),
Padding(
padding: EdgeInsets.fromLTRB(0, 0, 180, 10),
child: Text(
"Tangerine",
style: TextStyle(
fontFamily:'Roboto',
fontSize: 22,
color: Colors.black,
fontWeight: FontWeight.w700),
),
),
Padding(
padding: EdgeInsets.fromLTRB(0, 0, 220, 10),
child: Text(
"Rs.0.90/kg",
style: TextStyle(
fontFamily:'Roboto',
fontSize: 12,
color: Colors.grey,
fontWeight: FontWeight.w700),
),
),
],
)
)
),
const Padding(
padding: EdgeInsets.fromLTRB(120, 0, 40, 0),
child: Image(
image: AssetImage("assets/images/banana.png"),
),
),
],
),
Stack(
children: [
Padding(
padding: const EdgeInsets.fromLTRB(0, 45, 10, 0),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20.0),
color: Color(0xffFFFCEE),
),
height: 180,
width: 380,
child: Column(
children: const [
Padding(
padding: EdgeInsets.fromLTRB(0, 20, 180, 10),
child: Text(
"FRUIT AND BERRIES",
style: TextStyle(
fontFamily:'Roboto',
fontSize: 10,
color: Colors.lightGreen,
fontWeight: FontWeight.w700),
),
),
Padding(
padding: EdgeInsets.fromLTRB(0, 0, 180, 10),
child: Text(
"Tangerine",
style: TextStyle(
fontFamily:'Roboto',
fontSize: 22,
color: Colors.black,
fontWeight: FontWeight.w700),
),
),
Padding(
padding: EdgeInsets.fromLTRB(0, 0, 220, 10),
child: Text(
"Rs.0.90/kg",
style: TextStyle(
fontFamily:'Roboto',
fontSize: 10,
color: Colors.grey,
fontWeight: FontWeight.w700),
),
),
],
)
)),
const Padding(
padding: EdgeInsets.fromLTRB(120, 0, 40, 0),
child: Image(
image: AssetImage("assets/images/orange.png"),
),
),
],
),
Stack(
children: [
Padding(
padding: const EdgeInsets.fromLTRB(0, 45, 10, 0),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20.0),
color: Color(0xffE2F3DF),
),
height: 180,
width: 380,
child: Column(
children: const [
Padding(
padding: EdgeInsets.fromLTRB(0, 20, 180, 10),
child: Text(
"FRUIT AND BERRIES",
style: TextStyle(
fontFamily:'Roboto',
fontSize: 10,
color: Colors.lightGreen,
fontWeight: FontWeight.w700),
),
),
Padding(
padding: EdgeInsets.fromLTRB(0, 0, 180, 10),
child: Text(
"Tangerine",
style: TextStyle(
fontFamily:'Roboto',
fontSize: 22,
color: Colors.black,
fontWeight: FontWeight.w700),
),
),
Padding(
padding: EdgeInsets.fromLTRB(0, 0, 220, 10),
child: Text(
"Rs.0.90/kg",
style: TextStyle(
fontFamily:'Roboto',
fontSize: 10,
color: Colors.grey,
fontWeight: FontWeight.w700),
),
),
],
)
)),
const Padding(
padding: EdgeInsets.fromLTRB(100, 0, 40, 0),
child: Image(
image: AssetImage("assets/images/kiwi.png"),
// height:200,
),
),
],
),
],
),
),
);
}
Widget buildSearchInput() => Container(
decoration: BoxDecoration(
color: Colors.white, borderRadius: BorderRadius.circular(14)),
child: Padding(
padding: const EdgeInsets.only(left: 20.0, right: 20),
child: Row(
children: [
Icon(
Icons.search,
size: 30,
color: Colors.grey.shade300,
),
Flexible(
child: TextField(
decoration: InputDecoration(border: InputBorder.none),
),
),
],
),
),
);
}
You can add ListView with scrollDirection: Axis.horizontal, in this case it will be needed to have fixed height, and it will be scrolled up based on parent ListView scroll event.
buildSearchInput(),
SizedBox(
height: kToolbarHeight,
child: ListView(
scrollDirection: Axis.horizontal,
children: List.generate(14, (index) => Text("item $index")),
),
),
If you wish to have it on top fixed position, wrap everything with Column and ListView with Expanded.
body: Padding(
padding: const EdgeInsets.only(top: 40, left: 20, right: 20),
child: Column(
children: [
buildSearchInput(),
SizedBox(
height: kToolbarHeight,
child: ListView(
scrollDirection: Axis.horizontal,
children: List.generate(14, (index) => Text("item $index")),
),
),
Expanded(
child: ListView(
children: [
Stack(....
Head to flutter.dev for info.

How to allow user to Tap header to open on ExpansionPanel

I have built a help / FAQ screen within my flutter app. Using expansion tile I have created the UI but I am having issues with tapping the header.
I'm wanting to allow the user to tap the header to open that tile. Currently, the user has to tap the arrow to open.
I have added "canTapOnHeader: true," but that does not seem to work. I've searched Stackoverflow but still had no luck
Any help would be great!
ExpansionPanel(
headerBuilder: (BuildContext context, bool isExpanded) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Container(
padding: EdgeInsets.all(10),
child: Padding(
padding: const EdgeInsets.only(left: 8.0),
child: Text(
itemData[index].headerItem,
style: TextStyle(
color: Theme.of(context).accentColor,
fontSize: 17,
),
),
),
),
],
);
},
body: Container(
padding: EdgeInsets.only(left: 10, right: 10, bottom: 30),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Image.asset(
itemData[index].img,
fit: BoxFit.cover,
),
SizedBox(height: 10),
Divider(
thickness: 3.0,
height: 3.0,
color: Theme.of(context).accentColor,
indent: 10,
endIndent: 300),
Padding(
padding: const EdgeInsets.only(left: 8.0, top: 10),
child: Text(
itemData[index].description,
style: TextStyle(
color: Theme.of(context).accentColor,
fontSize: 15,
height: 1.3,
),
),
),
],
),
),
canTapOnHeader: true,
isExpanded: itemData[index].expanded,
)
],
expansionCallback: (int item, bool status) {
setState(() {
itemData[index].expanded = !itemData[index].expanded;
});
},
),
);
},
),
),
);}
List<ItemModel> itemData = <ItemModel>[
ItemModel(
headerItem: 'This is a header question?',
description:
"This is the description for the question.",
img: 'assets/images/typingtextgiphy.gif',
),
];
}
class ItemModel {
bool expanded;
String headerItem;
String description;
String img;
ItemModel({
this.expanded: false,
this.headerItem,
this.description,
this.img,
});
}
Managed to find the solution for this. Here's the code, can copy and paste
class _HelpPanelState extends State<HelpPanel> {
#override
Widget build(BuildContext context) {
return MediaQuery(
data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0),
child: Scaffold(
appBar: AppBar(
centerTitle: true,
leading: BackButton(
color: Theme.of(context).accentColor,
),
title: Text(AppLocalizations.of(context)!.tutorial,
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 20.0,
color: Theme.of(context).colorScheme.primary)),
elevation: 0.0,
),
body: SingleChildScrollView(
child: Container(
padding: EdgeInsets.only(left: 10, right: 10),
child: Column(
children: <Widget>[
Padding(
padding: const EdgeInsets.only(bottom: 8.0),
child: Card(
elevation: 3,
shape: OutlineInputBorder(
borderRadius: BorderRadius.circular(20),
borderSide: BorderSide(color: Colors.white)),
child: Padding(
padding: EdgeInsets.only(
top: 0.0, left: 15.0, right: 15.0, bottom: 0.0),
child: ExpansionTile(
title: Text(
"QUESTION",
style: GoogleFonts.roboto(
textStyle: TextStyle(
fontWeight: FontWeight.w900,
fontSize: 20,
color: Theme.of(context).accentColor,
letterSpacing: 0.4,
),
),
textAlign: TextAlign.left,
),
children: <Widget>[
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20.0),
),
child: ClipRRect(
borderRadius: BorderRadius.circular(20.0),
child: Image(
image: AssetImage(
'assets/images/typingautoverse.gif',
),
),
),
),
SizedBox(height: 5),
Padding(
padding:
const EdgeInsets.only(left: 15.0, bottom: 10),
child: Text(
"ANSWER",
style: GoogleFonts.roboto(
textStyle: TextStyle(
fontWeight: FontWeight.w300,
fontSize: 20,
color: Theme.of(context).accentColor,
letterSpacing: 0.4,
height: 1.3,
),
),
),
),
],
),
),
),
),
Padding(
padding: const EdgeInsets.only(bottom: 8.0),
child: Card(
elevation: 3,
shape: OutlineInputBorder(
borderRadius: BorderRadius.circular(20),
borderSide: BorderSide(color: Colors.white)),
child: Padding(
padding: EdgeInsets.only(
top: 0.0, left: 15.0, right: 15.0, bottom: 0.0),
child: ExpansionTile(
title: Text(
"QUESTION",
style: GoogleFonts.roboto(
textStyle: TextStyle(
fontWeight: FontWeight.w900,
fontSize: 20,
color: Theme.of(context).accentColor,
letterSpacing: 0.4,
),
),
textAlign: TextAlign.left,
),
children: <Widget>[
Padding(
padding:
const EdgeInsets.only(left: 15.0, bottom: 10),
child: Text(
"ANSWER"
style: GoogleFonts.roboto(
textStyle: TextStyle(
fontWeight: FontWeight.w300,
fontSize: 20,
color: Theme.of(context).accentColor,
letterSpacing: 0.4,
height: 1.3,
),
),
),
),
],
),
),
),
),
],
),
),
),
),
);
}
}

Bottom Overflowed by 81 Pixels

I'm pretty much self-tutoring flutter and I'm working on a personal project. I wrapped it to singlechildscrollview but it still produces the problem. The code below:
class ScheduleDetail extends StatefulWidget {
var data;
ScheduleDetail(this.data);
#override
// ScheduleDetail({Key key, this.todos}) : super(key: key);
_ScheduleDetailState createState() => _ScheduleDetailState();
}
class _ScheduleDetailState extends State<ScheduleDetail>{
String foos = 'One';
#override
void initState() {
super.initState();
}
#override
Widget build(BuildContext context) {
ScreenUtil.instance =
ScreenUtil(width: 750, height: 1425, allowFontScaling: true)
..init(context);
return Scaffold(
extendBodyBehindAppBar: true,
appBar: AppBar(
// title: Text("String Master"),
title: SvgPicture.asset('assets/images/Logo_small.svg'),
centerTitle: true,
backgroundColor: Colors.transparent,
),
body: BackgroundImageWidget(
child: Center(
child: Container(
child: new Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Container(
height: ScreenUtil.getInstance().setHeight(150),
),
Container(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil.getInstance().setWidth(40),
),
child: Text(
AppStrings.scheduleTitle,
style: TextStyles.appName,
textAlign: TextAlign.center,
),
),
Container(
height: ScreenUtil.getInstance().setHeight(50),
),
SingleChildScrollView(
child: ConstrainedBox(
constraints: BoxConstraints(maxHeight: MediaQuery.of(context).size.height * 0.82),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Expanded(
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil.getInstance().setWidth(40),
),
child: new Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
_buildTopCard(),
SizedBox(height: 10),
_buildTimeCard(),
SizedBox(height: 10),
ListTile(
title: Text(
"Calendar",
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.green,
fontSize: 16
),
),
),
Container(color: Colors.grey, height: 1),
_buildNoticeExpansionTile(),
Container(color: Colors.grey, height: 1),
_buildMemoExpansionTile(),
],
)),
),
],
)
)
),
],
)),
)));
}
Widget _buildTopCard() {
return Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(7.0),
),
elevation: 15,
child: ClipPath(
clipper: ShapeBorderClipper(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(7.0))),
child: Stack(
children: <Widget>[
Container(
height: 150,
decoration: BoxDecoration(
border: Border(
top: BorderSide(color: Colors.green, width: 30)),
color: Colors.white,
),
alignment: Alignment.centerLeft,
child: Column(
children: <Widget>[
ListTile(
title: Text(widget.data['eventTitle'],
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.green,
),
),
subtitle: Text(
widget.data['location'],
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.grey.shade600
),
),
),
Container(
padding: EdgeInsets.only(left: 10, right: 10),
child:
Divider(color: Colors.grey),
),
Container(
padding: EdgeInsets.only(left: 10, right: 10),
child: Row (
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(
widget.data['startDate'] + " " + widget.data['timeStart'],
style: TextStyle(
color: Colors.grey.shade600,
fontStyle: FontStyle.italic,
fontSize: 14
),
),
Spacer(flex: 2),
Text(
widget.data['startDate'] + " " + widget.data['timeEnd'],
style: TextStyle(
color: Colors.grey.shade600,
fontSize: 14,
fontStyle: FontStyle.italic,
),
),
]
)
),
],
)
),
Positioned(
left: 10,
top: 7,
width: 325,
child: Container(
padding: EdgeInsets.only(bottom: 10, left: 5, right: 5),
color: Colors.transparent,
child: Row (
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(
widget.data['startDate'],
style: TextStyle(fontWeight: FontWeight.bold, color: Colors.white, fontSize: 14),
),
Spacer(flex: 2),
Text(
widget.data['timeStart'],
style: TextStyle(fontWeight: FontWeight.bold, color: Colors.white, fontSize: 14),
),
],
)
),
),
],
)
),
);
}
Widget _buildTimeCard() {
return Container(
height: 125,
width: 400,
margin: EdgeInsets.all(5.0),
decoration: BoxDecoration(
color: Colors.black,
border: Border.all(
color: Colors.green,
width: 0.5,
),
borderRadius: BorderRadius.circular(7.0),
),
child: Center(
child: Text(
'TIME OF EVENT',
style: TextStyle(fontWeight: FontWeight.bold, color: Colors.white, fontSize: 14),
),
),
);
}
Widget _buildNoticeExpansionTile() {
return Theme(
data: Theme.of(context).copyWith(unselectedWidgetColor: Colors.white, accentColor: Colors.white),
child: ExpansionTile(
title: new Text(
"Notice",
style: TextStyle(
color: Colors.green,
fontSize: 16
),
),
backgroundColor: Colors.transparent,
children: <Widget>[
Container(
child: ListView.builder(
padding: EdgeInsets.all(0.0),
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemCount: widget.data['notice'] != null ? widget.data['notice'].length : 0,
itemBuilder: (BuildContext context, int index){
return
Padding(
padding: EdgeInsets.only(left: 15, bottom: 10),
child: Text(
"\u2022 " + widget.data['notice'][index],
style: TextStyle(
color: Colors.white,
fontSize: 14
),
)
);
}
)
),
]
)
);
}
Widget _buildMemoExpansionTile() {
return
Theme(
data: Theme.of(context).copyWith(unselectedWidgetColor: Colors.white, accentColor: Colors.white),
child: ExpansionTile(
title: new Text(
"Memo",
style: TextStyle(
color: Colors.green,
fontSize: 16
),
),
backgroundColor: Colors.transparent,
children: <Widget>[
ListView.builder(
padding: EdgeInsets.all(0.0),
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemCount: widget.data['memo'] != null ? widget.data['memo'].length : 0,
itemBuilder: (BuildContext context, int index){
return
Padding(
padding: EdgeInsets.only(left: 15, bottom: 10),
child: Text(
(index + 1).toString() + ". " + widget.data['memo'][index],
style: TextStyle(
color: Colors.white,
fontSize: 14
),
)
);
}
)
]
)
);
}
}
Perhaps my mistake could be from one of those objects that I have used. However, I can't figure it out even though I searched around the internet. My intention is when the expandable tiles have 'overlapped' the screen size, you would be able to scroll it all the way down.
Wrap the SingleChildScrollView in Expanded Widget.
You can make use of the flutter dev tools for identifying overlapping issues.
I simplified the scaffold then wrapped SingleChildScrollView within Flexible.

flutter : Failed assertion: boolean expression must not be null

i am tried to run my project and this error still appearing
Failed assertion: boolean expression must not be null
i was run it more than 30 times and it was worked but now it doesn't and i don't know the reason for this problem i am not change any thing in my code before the error , and i tried some solutions and it doesn't work also , so what should i do now !
this is my screen which has the problem
class _TourguideDetailesState extends State<TourguideDetailes>
with TickerProviderStateMixin {
AppProvider appProvider;
ScrollController scrollController = ScrollController(initialScrollOffset: 0);
AnimationController animationController;
#override
void initState() {
animationController = AnimationController(
duration: Duration(milliseconds: 2000), vsync: this);
animationController.forward();
super.initState();
}
#override
void dispose() {
animationController.dispose();
super.dispose();
}
#override
Widget build(BuildContext context) {
appProvider = Provider.of<AppProvider>(context);
return Scaffold(
backgroundColor: AppTheme.getTheme().backgroundColor,
body: Stack(
children: <Widget>[
NestedScrollView(
controller: scrollController,
physics: NeverScrollableScrollPhysics(),
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
return <Widget>[
SliverPersistentHeader(
pinned: true,
floating: true,
delegate: ContestTabHeader(
(MediaQuery.of(context).size.height),
appProvider.selectedTourguide,
() {
scrollController.animateTo(MediaQuery.of(context).size.height - MediaQuery.of(context).size.height / 5,
duration: Duration(milliseconds: 500), curve: Curves.fastOutSlowIn);
},
getGuideDetails(),
),
),
];
},
body: ListView(
padding: EdgeInsets.only(top: 24),
children: <Widget>[
Padding(
padding: const EdgeInsets.only(left: 24, right: 24),
child: getGuideDetails(isInList: true),
),
Padding(
padding: const EdgeInsets.all(16.0),
child: Divider(
height: 1,
),
),
Padding(
padding: const EdgeInsets.only(left: 24, right: 24),
child: Row(
children: <Widget>[
Expanded(
child: Text(
"Biography",
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 18,
letterSpacing: 0.5,
),
),
),
],
),
),
Padding(
padding:
EdgeInsets.only(left: 24, right: 24, top: 4, bottom: 8),
child: Text(
appProvider.selectedTourguide.bio == null
? ""
: appProvider.selectedTourguide.bio,
style: TextStyle(
fontSize: 14,
color: AppTheme.getTheme().disabledColor,
),
)),
Padding(
padding: const EdgeInsets.only(left: 24, right: 24),
child: Row(
children: <Widget>[
Expanded(
child: Text(
"Native Language",
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 18,
letterSpacing: 0.5,
),
),
),
],
),
),
Padding(
padding:
EdgeInsets.only(left: 24, right: 24, top: 4, bottom: 8),
child: Text(
appProvider.selectedTourguide.nativeLanguage == null ? "" : appProvider.selectedTourguide.nativeLanguage,
style: TextStyle(
fontSize: 14,
color: AppTheme.getTheme().disabledColor,
),
)),
Padding(
padding:
EdgeInsets.only(left: 24, right: 24, top: 4, bottom: 8),
),
SizedBox(
height: 16,
),
Padding(
padding: const EdgeInsets.only(
left: 16, right: 16, bottom: 16, top: 16),
child: Container(
height: 48,
decoration: BoxDecoration(
color: AppTheme.getTheme().primaryColor,
borderRadius: BorderRadius.all(Radius.circular(24.0)),
boxShadow: <BoxShadow>[
BoxShadow(
color: AppTheme.getTheme().dividerColor,
blurRadius: 8,
offset: Offset(4, 4),
),
],
),
child: Material(
color: Colors.transparent,
child: InkWell(
borderRadius: BorderRadius.all(Radius.circular(24.0)),
highlightColor: Colors.transparent,
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => BookingScreen(
index: appProvider.selectedTourguide,
),
fullscreenDialog: true,
));
},
child: Center(
child: Text(
"Book now",
style: TextStyle(
fontWeight: FontWeight.w500,
fontSize: 16,
color: Colors.white),
),
),
),
),
),
),
SizedBox(
height: MediaQuery.of(context).padding.bottom,
),
],
),
),
Padding(
padding: EdgeInsets.only(top: MediaQuery.of(context).padding.top),
child: Container(
height: AppBar().preferredSize.height,
child: Row(
children: <Widget>[
SizedBox(
height: AppBar().preferredSize.height,
child: Padding(
padding: EdgeInsets.only(top: 8, left: 8),
child: Container(
width: AppBar().preferredSize.height - 8,
height: AppBar().preferredSize.height - 8,
decoration: BoxDecoration(color: AppTheme.getTheme().disabledColor.withOpacity(0.4), shape: BoxShape.circle),
child: Material(
color: Colors.transparent,
child: InkWell(
borderRadius: BorderRadius.all(
Radius.circular(32.0),
),
onTap: () {
if (scrollController.offset != 0.0) {
scrollController.animateTo(0.0, duration: Duration(milliseconds: 500), curve: Curves.easeInOutQuad);
} else {
Navigator.pop(context);
}
},
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Icon(Icons.arrow_back, color: AppTheme.getTheme().backgroundColor),
),
),
),
),
),
),
Expanded(
child: SizedBox(),
),
],
),
),
)
],
),
);
}
Widget getGuideDetails({bool isInList = false}) {
return Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
appProvider.selectedTourguide.name,
textAlign: TextAlign.left,
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 22,
color: isInList == null
? AppTheme.getTheme().textTheme.body1.color
: Colors.white,
),
),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Text(
appProvider.selectedTourguide.address,
style: TextStyle(
fontSize: 14,
color: isInList == null
? AppTheme.getTheme().disabledColor.withOpacity(0.5)
: Colors.white,
),
),
SizedBox(
width: 4,
),
Icon(
FontAwesomeIcons.mapMarkerAlt,
size: 12,
color: AppTheme.getTheme().primaryColor,
),
],
),
isInList == null
? SizedBox()
: Padding(
padding: const EdgeInsets.only(top: 4),
child: Row(
children: <Widget>[
Text(
" ${appProvider.selectedTourguide.review} Reviews",
style: TextStyle(
fontSize: 14,
color: isInList
? AppTheme.getTheme().disabledColor
: Colors.white,
),
),
],
),
),
],
),
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
Row(
children: <Widget>[
Text(
appProvider.selectedTourguide.tariffValue= null ? '' : appProvider.selectedTourguide.tariffValue,
textAlign: TextAlign.left,
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 22,
color: isInList == null
? AppTheme.getTheme().textTheme.body1.color
: Colors.white,
),
),
Text(
appProvider.selectedTourguide.currency= null ? '' : appProvider.selectedTourguide.currency,
textAlign: TextAlign.left,
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 22,
color: isInList == null
? AppTheme.getTheme().textTheme.body1.color
: Colors.white,
),
),
],
),
Text(
"/per hour",
style: TextStyle(
fontSize: 14,
color: isInList == null
? AppTheme.getTheme().disabledColor.withOpacity(0.5)
: Colors.white,
),
),
],
),
],
);
}
}
class ContestTabHeader extends SliverPersistentHeaderDelegate {
final Widget ui;
final VoidCallback callback;
final TourGuide tourguideData;
final double heightValue;
ContestTabHeader(
this.heightValue,
this.tourguideData,
this.callback,
this.ui,
);
#override
Widget build(BuildContext context, double shrinkOffset, bool overlapsContent) {
var minValue = (shrinkOffset < heightValue - heightValue / 5? shrinkOffset: heightValue / 5);
return Container(
height: heightValue - minValue,
decoration: BoxDecoration(
color: AppTheme.getTheme().primaryColor,
boxShadow: <BoxShadow>[
BoxShadow(
color: AppTheme.getTheme().dividerColor,
blurRadius: 8,
offset: Offset(4, 4),
),
],
),
child: Stack(
alignment: Alignment.bottomCenter,
children: <Widget>[
Positioned(
bottom: 0,
left: 0,
right: 0,
top: 0,
child: Container(
width: MediaQuery.of(context).size.width,
child: Image.network(
tourguideData.photo == null
? 'https://i.ytimg.com/vi/TWaReNkjTLk/maxresdefault.jpg'
: tourguideData.photo,
fit: BoxFit.cover,
),
),
),
Positioned(
bottom: MediaQuery.of(context).padding.bottom + 16,
left: 0,
right: 0,
child: Opacity(
opacity: getOpValue(minValue, heightValue / 5),
child: Column(
children: <Widget>[
Container(
padding: EdgeInsets.only(left: 24, right: 24),
child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(24)),
child: new BackdropFilter(
filter:
new ImageFilter.blur(sigmaX: 10.0, sigmaY: 10.0),
child: Container(
color: Colors.black12,
padding: const EdgeInsets.all(4.0),
child: Column(
children: <Widget>[
SizedBox(
height: 4,
),
Padding(
padding: const EdgeInsets.only(
left: 16, right: 16, top: 8),
child: ui,
),
Padding(
padding: const EdgeInsets.only(
left: 16, right: 16, bottom: 16, top: 16),
child: Container(
height: 48,
decoration: BoxDecoration(
color: AppTheme.getTheme().primaryColor,
borderRadius:
BorderRadius.all(Radius.circular(24.0)),
boxShadow: <BoxShadow>[
BoxShadow(
color: AppTheme.getTheme().dividerColor,
blurRadius: 8,
offset: Offset(4, 4),
),
],
),
child: Material(
color: Colors.transparent,
child: InkWell(
borderRadius: BorderRadius.all(
Radius.circular(24.0)),
highlightColor: Colors.transparent,
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
BookingScreen(),
fullscreenDialog: true,
),
);
},
child: Center(
child: Text(
"Book now",
style: TextStyle(
fontWeight: FontWeight.w500,
fontSize: 16,
color: Colors.white),
),
),
),
),
),
),
],
),
),
),
),
),
SizedBox(
height: 16,
),
Center(
child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(24)),
child: new BackdropFilter(
filter:
new ImageFilter.blur(sigmaX: 10.0, sigmaY: 10.0),
child: Container(
color: Colors.black12,
child: Material(
color: Colors.transparent,
child: InkWell(
highlightColor: Colors.transparent,
splashColor: AppTheme.getTheme()
.primaryColor
.withOpacity(0.2),
borderRadius:
BorderRadius.all(Radius.circular(38)),
onTap: () {
try {
callback();
} catch (e) {}
},
child: Padding(
padding: const EdgeInsets.only(
left: 16, right: 16, top: 4, bottom: 4),
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text(
'More Details',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.w600,
),
),
Padding(
padding: const EdgeInsets.only(top: 2),
child: Icon(
Icons.keyboard_arrow_down,
color: Colors.white,
size: 24,
),
)
],
),
),
),
),
),
),
),
),
],
),
),
)
],
),
);
}
double getOpValue(double minValue, double maxValue) {
var data = (1.0 - (minValue / maxValue));
if (data < 0.0) {
return 0.0;
} else if (data >= 0 && data <= 1) {
return data;
} else {
return 1.0;
}
}
#override
double get maxExtent => heightValue;
#override
double get minExtent => heightValue / 5;
#override
bool shouldRebuild(SliverPersistentHeaderDelegate oldDelegate) {
return true;
}
}
Look at the Text Widget, hope it helps. Too lazy to read the whole thing carefully. By the way, you can replace a == null ? 'whatever' : a with a ?? 'whatever'. ?? is equal with if null
Row(
children: <Widget>[
Text(
/// The problem is probably here, missing '='
appProvider.selectedTourguide.tariffValue= null ? '' : appProvider.selectedTourguide.tariffValue,
textAlign: TextAlign.left,
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 22,
color: isInList == null
? AppTheme.getTheme().textTheme.body1.color
: Colors.white,
),
),
Text(
/// The problem is probably here, missing '='
appProvider.selectedTourguide.currency= null ? '' : appProvider.selectedTourguide.currency,
textAlign: TextAlign.left,
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 22,
color: isInList == null
? AppTheme.getTheme().textTheme.body1.color
: Colors.white,
),
),
],
),

"'borderRadius != null I/flutter (28205): || clipper != null': is not true" why am i getting this error?

I am trying to fetch data from an api and just show it in my list of cards. But whenever i load the app i get this error
'borderRadius != null
I/flutter (28205): || clipper != null': is not true.
and i not sure how to solve this.
I have tried making changes in the line the error has occurred but the error remains the same.
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:news/model/businessModel.dart';
import 'package:http/http.dart' as http;
class Discover extends StatefulWidget {
final Source source;
Discover({Key key, this.source}) : super(key: key);
#override
_DiscoverState createState() => _DiscoverState();
}
class _DiscoverState extends State<Discover> {
String API_KEY = '0ca85f22bce44565ba4fee8d2224adb5';
Future<List<Articles>> fetchArticleBySource() async {
final response = await http.get(
'https://newsapi.org/v2/top-headlines?
category=business&language=en&apiKey=${API_KEY}');
if (response.statusCode == 200) {
List articles = json.decode(response.body)['articles'];
return articles.map((article) => new
Articles.fromJson(article)).toList();
} else {
throw Exception('Failed to load article list');
}
}
var list_articles;
var refreshKey = GlobalKey<RefreshIndicatorState>();
#override
void initState() {
// TODO: implement initState
super.initState();
refreshListArticle();
}
Future<Null> refreshListArticle() async {
refreshKey.currentState?.show(atTop: false);
setState(() {
list_articles = fetchArticleBySource();
});
}
#override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(
left: 15.0,
top: 15.0,
right: 15.0,
),
child: ListView(
children: <Widget>[
topArea(),
SizedBox(
height: 10.0,
),
slideCard(),
SizedBox(
height: 5.0,
),
Padding(
padding: const EdgeInsets.only(left: 4.0),
child: Divider(),
),
recentNews(),
],
),
);
}
Widget topArea() {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
"WEDNESDAY, NOVEMBER 29",
style: TextStyle(color: Colors.grey, fontWeight:
FontWeight.bold),
),
SizedBox(
height: 5.0,
),
Text(
"TOP NEWS",
style: TextStyle(fontSize: 25.0, fontWeight: FontWeight.bold),
),
],
),
Hero(
tag: 'img',
child: InkWell(
//onTap: () => Navigator.push(context, MaterialPageRoute(builder:
(context) => )),
child: CircleAvatar(
radius: 25.0,
//backgroundColor: Colors.transparent,
backgroundImage: NetworkImage(
"https://images.pexels.com/photos/1138409/pexels-photo-
1138409.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260",
),
),
),
),
],
);
}
Widget slideCard() {
return FutureBuilder<List<Articles>>(
future: list_articles,
builder: (context, snapshot) {
if (snapshot.hasError) {
return Text("${snapshot.error}");
} else if (snapshot.hasData) {
List<Articles> articles = snapshot.data;
return Container(
height: 310.0,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(0.0),
),
child: ListView(
scrollDirection: Axis.horizontal,
children: articles
.map((article) => GestureDetector(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Expanded(
child: Card(
elevation: 3.0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
child: ClipRRect(
clipper: ,
child: article.urlToImage != null
? Image.network(article.urlToImage)
: Image.asset('images/logo.jpg'),
),
),
),
SizedBox(
height: 10.0,
),
Padding(
padding: const EdgeInsets.only(left: 4.0),
child: Text("${article.title}",
style: TextStyle(
color: Colors.blueAccent,
fontSize: 12.0,
fontWeight: FontWeight.bold),
),
),
SizedBox(
height: 10.0,
),
Padding(
padding: const EdgeInsets.only(left: 4.0),
child: Text(
"${article.description}",
style: TextStyle(
color: Colors.black,
fontSize: 14.0,
fontWeight: FontWeight.bold),
),
),
],
),
))
.toList(),
),
);
}
return CircularProgressIndicator();
},
);
}
Widget recentNews() {
return Column(
children: <Widget>[
Padding(
padding: const EdgeInsets.only(left: 4.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(
"Recent News",
style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold),
),
Align(
alignment: Alignment.centerRight,
child: Text(
"See All",
style: TextStyle(color: Colors.lightBlueAccent),
),
)
],
),
),
SizedBox(
height: 7.0,
),
Container(
height: 200.0,
child: ListView(
scrollDirection: Axis.horizontal,
children: <Widget>[
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Expanded(
child: Card(
elevation: 3.0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
child: ClipRRect(
child: Image.network(
"https://images.pexels.com/photos/935789/pexels-photo-935789.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260"),
borderRadius: BorderRadius.circular(10.0),
),
),
),
SizedBox(
height: 10.0,
),
Padding(
padding: const EdgeInsets.only(left: 4.0),
child: Text(
"STARTUPS",
style: TextStyle(
color: Colors.blueAccent,
fontSize: 12.0,
fontWeight: FontWeight.bold),
),
),
SizedBox(
height: 10.0,
),
Padding(
padding: const EdgeInsets.only(left: 4.0),
child: Text(
"Top startups that are \nchanging the way we travel",
style: TextStyle(
color: Colors.black,
fontSize: 15.0,
fontWeight: FontWeight.bold),
),
),
],
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Expanded(
child: Card(
elevation: 3.0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
child: ClipRRect(
child: Image.network(
"https://images.pexels.com/photos/935789/pexels-photo-935789.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260"),
borderRadius: BorderRadius.circular(10.0),
),
),
),
SizedBox(
height: 10.0,
),
Padding(
padding: const EdgeInsets.only(left: 4.0),
child: Text(
"STARTUPS",
style: TextStyle(
color: Colors.blueAccent,
fontSize: 12.0,
fontWeight: FontWeight.bold),
),
),
SizedBox(
height: 10.0,
),
Padding(
padding: const EdgeInsets.only(left: 4.0),
child: Text(
"Top startups that are \nchanging the way we travel",
style: TextStyle(
color: Colors.black,
fontSize: 15.0,
fontWeight: FontWeight.bold),
),
),
],
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Expanded(
child: Card(
elevation: 3.0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
child: ClipRRect(
child: Image.network(
"https://images.pexels.com/photos/935789/pexels-photo-935789.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260"),
borderRadius: BorderRadius.circular(10.0),
),
),
),
SizedBox(
height: 10.0,
),
Padding(
padding: const EdgeInsets.only(left: 4.0),
child: Text(
"STARTUPS",
style: TextStyle(
color: Colors.blueAccent,
fontSize: 12.0,
fontWeight: FontWeight.bold),
),
),
SizedBox(
height: 10.0,
),
Padding(
padding: const EdgeInsets.only(left: 4.0),
child: Text(
"Top startups that are \nchanging the way we travel",
style: TextStyle(
color: Colors.black,
fontSize: 15.0,
fontWeight: FontWeight.bold),
),
),
],
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Expanded(
child: Card(
elevation: 3.0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
child: ClipRRect(
child: Image.network(
"https://images.pexels.com/photos/935789/pexels-photo-935789.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260"),
borderRadius: BorderRadius.circular(10.0),
),
),
),
SizedBox(
height: 10.0,
),
Padding(
padding: const EdgeInsets.only(left: 4.0),
child: Text(
"STARTUPS",
style: TextStyle(
color: Colors.blueAccent,
fontSize: 12.0,
fontWeight: FontWeight.bold),
),
),
SizedBox(
height: 10.0,
),
Padding(
padding: const EdgeInsets.only(left: 4.0),
child: Text(
"Top startups that are\n changing the way we travel",
style: TextStyle(
color: Colors.black,
fontSize: 15.0,
fontWeight: FontWeight.bold),
),
),
],
),
],
),
),
],
);
}
}
If you look closely, you will see one ClipRRect whose clipper is empty, thus null.
According to the error message, if the clipper is null, then you have to specify a borderRadius.
child: ClipRRect(
clipper: ,
child: article.urlToImage != null
? Image.network(article.urlToImage)
: Image.asset('images/logo.jpg'),
),