How to Hide a Button with a Visibility widget - flutter

Few Informations about me: Im 17y/o and from Germany.
I have made a ListView to show Multiple Headers. Each Header should be a able to store multiple Subheaders which can be opened or closed. It should look like the toggle Function in the App Notion
That is my first project.
I came up with two problems im not able to solve:
When I close the Header 1, the Subheader1 is not visible, but the button can clicked and the spacce between Header 1 and 2 is two big. If Subheader 1 is not a TextButton it closes as expected.
When I close Header 1 all Subheaders under that should close aswell. If someone can show me how it is done on the first Header and its Subheaders I can do the rest on my own
My code is:
import 'package:flutter/material.dart';
class JWMGvereinfacht extends StatefulWidget {
const JWMGvereinfacht({
Key? key,
}) : super(key: key);
#override
State<JWMGvereinfacht> createState() => _JWMGvereinfachtState();
}
class _JWMGvereinfachtState extends State<JWMGvereinfacht> {
bool _isAnwendungsbereichVisible = false;
bool _is1AnwendungsbereichVisible = false;
#override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.grey[900],
body: Scrollbar(
child: ListView(
children: [
Container(
color: Colors.grey[850],
width: double.infinity,
height: 76,
child: Padding(
padding: const EdgeInsets.fromLTRB(8, 0, 0, 0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
IconButton(
icon: const Icon(
Icons.arrow_back_ios_new,
color: Colors.white,
size: 25,
),
onPressed: () {
Navigator.pop(context);
},
),
const Expanded(
child: Padding(
padding: EdgeInsets.all(8.0),
child: Text(
"Titel",
style: TextStyle(
color: Colors.white,
fontSize: 25,
fontWeight: FontWeight.bold),
textAlign: TextAlign.end,
),
),
),
],
),
],
),
),
),
Container(
height: 5,
color: Colors.grey[900],
),
TextButton(
onPressed: () {
setState(() {
_isAnwendungsbereichVisible = !_isAnwendungsbereichVisible;
});
},
child: Container(
color: Colors.grey[850],
width: double.infinity,
height: 35,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Icon(
_isAnwendungsbereichVisible
? Icons.arrow_drop_down_outlined
: Icons.arrow_right,
color: Colors.white,
),
const Expanded(
child: Padding(
padding: EdgeInsets.all(8.0),
child: Text(
"Header 1",
style: TextStyle(
color: Colors.white,
fontSize: 17,
fontWeight: FontWeight.bold,
),
),
),
),
],
),
),
),
Padding(
padding: const EdgeInsets.fromLTRB(17.5, 0, 8, 0),
child: TextButton(
onPressed: () {
setState(() {
_is1AnwendungsbereichVisible =
!_is1AnwendungsbereichVisible;
});
},
child: Visibility(
visible: _isAnwendungsbereichVisible,
child: Column(
children: [
Container(
color: Colors.blue,
width: double.infinity,
height: 35,
child: const Padding(
padding: EdgeInsets.all(8.0),
child: Text(
"Subheader 1",
style: TextStyle(
color: Colors.white,
fontSize: 15.5,
fontWeight: FontWeight.bold,
),
),
),
),
],
),
),
),
),
Padding(
padding: const EdgeInsets.fromLTRB(35, 0, 0, 8),
child: Visibility(
visible: _is1AnwendungsbereichVisible,
child: Column(
children: [
TextButton(
onPressed: () {},
child: Container(
color: Colors.blue,
width: double.infinity,
height: 35,
child: const Padding(
padding: EdgeInsets.all(8.0),
child: Text(
"Inhalt",
style: TextStyle(
color: Colors.white,
fontSize: 15.5,
fontWeight: FontWeight.bold,
),
),
),
),
),
],
),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
color: Colors.grey[850],
width: double.infinity,
height: 35,
child: const Padding(
padding: EdgeInsets.all(8.0),
child: Text("Header 2",
style: TextStyle(
color: Colors.white,
fontSize: 17,
fontWeight: FontWeight.bold,
)),
),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
color: Colors.grey[850],
width: double.infinity,
height: 35,
child: const Padding(
padding: EdgeInsets.all(8.0),
child: Text("Beteiligung Dritter an der Jagd (§17-§25)",
style: TextStyle(
color: Colors.white,
fontSize: 17,
fontWeight: FontWeight.bold,
)),
),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
color: Colors.grey[850],
width: double.infinity,
height: 35,
child: const Padding(
padding: EdgeInsets.all(7.0),
child: Text("Jagdschein (§26-§28)",
style: TextStyle(
color: Colors.white,
fontSize: 17,
fontWeight: FontWeight.bold,
)),
),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
color: Colors.grey[850],
width: double.infinity,
height: 57,
child: const Padding(
padding: EdgeInsets.all(8.0),
child: Text(
"Besondere Rechte und Pflichten bei der Jagdausübung (§29-§40)",
style: TextStyle(
color: Colors.white,
fontSize: 17,
fontWeight: FontWeight.bold,
)),
),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
color: Colors.grey[850],
width: double.infinity,
height: 35,
child: const Padding(
padding: EdgeInsets.all(8.0),
child: Text(
"Sicherung der Nachhaltigkeit, Wildtierschutz (§41-§51)",
style: TextStyle(
color: Colors.white,
fontSize: 17,
fontWeight: FontWeight.bold,
)),
),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
color: Colors.grey[850],
width: double.infinity,
height: 35,
child: const Padding(
padding: EdgeInsets.all(8.0),
child: Text("Wild- und Jagdschaden (§51a-§57)",
style: TextStyle(
color: Colors.white,
fontSize: 17,
fontWeight: FontWeight.bold,
)),
),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
color: Colors.grey[850],
width: double.infinity,
height: 35,
child: const Padding(
padding: EdgeInsets.all(8.0),
child: Text("Verwaltungsbehörden, Beiräte (§58-§65)",
style: TextStyle(
color: Colors.white,
fontSize: 17,
fontWeight: FontWeight.bold,
)),
),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
color: Colors.grey[850],
width: double.infinity,
height: 35,
child: const Padding(
padding: EdgeInsets.all(8.0),
child: Text("Straf- und Bußgeldvorschriften (§66-§69)",
style: TextStyle(
color: Colors.white,
fontSize: 17,
fontWeight: FontWeight.bold,
)),
),
),
),
],
),
),
);
}
}
I tried wrapping the whole Subheader 1 within a own Container but nothing changed, I want that all Subheaders are closed, when the Header 1 is closed and the Space between the Headers should be 8.0

You can set the _is1AnwendungsbereichVisible = false; when _isAnwendungsbereichVisible is false.
TextButton(
onPressed: () {
_isAnwendungsbereichVisible = !_isAnwendungsbereichVisible;
if (_isAnwendungsbereichVisible == false) {
_is1AnwendungsbereichVisible = false;
}
setState(() {});
},
child: Container(
color: Colors.grey[850],
width: double.infinity,
height: 35,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Icon(
_isAnwendungsbereichVisible
? Icons.arrow_drop_down_outlined
: Icons.arrow_right,
color: Colors.white,
),
const Expanded(
child: Padding(
padding: EdgeInsets.all(8.0),
child: Text(
"Header 1",
style: TextStyle(
color: Colors.white,
fontSize: 17,
fontWeight: FontWeight.bold,
),
),
),
),
],
),
),
),
Full snippet
class JWMGvereinfacht extends StatefulWidget {
const JWMGvereinfacht({
Key? key,
}) : super(key: key);
#override
State<JWMGvereinfacht> createState() => _JWMGvereinfachtState();
}
class _JWMGvereinfachtState extends State<JWMGvereinfacht> {
bool _isAnwendungsbereichVisible = false;
bool _is1AnwendungsbereichVisible = false;
#override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.grey[900],
body: Scrollbar(
child: ListView(
children: [
Container(
color: Colors.grey[850],
width: double.infinity,
height: 76,
child: Padding(
padding: const EdgeInsets.fromLTRB(8, 0, 0, 0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
IconButton(
icon: const Icon(
Icons.arrow_back_ios_new,
color: Colors.white,
size: 25,
),
onPressed: () {
Navigator.pop(context);
},
),
const Expanded(
child: Padding(
padding: EdgeInsets.all(8.0),
child: Text(
"Titel",
style: TextStyle(
color: Colors.white,
fontSize: 25,
fontWeight: FontWeight.bold),
textAlign: TextAlign.end,
),
),
),
],
),
],
),
),
),
Container(
height: 5,
color: Colors.grey[900],
),
TextButton(
onPressed: () {
_isAnwendungsbereichVisible = !_isAnwendungsbereichVisible;
if (_isAnwendungsbereichVisible == false) {
_is1AnwendungsbereichVisible = false;
}
setState(() {});
},
child: Container(
color: Colors.grey[850],
width: double.infinity,
height: 35,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Icon(
_isAnwendungsbereichVisible
? Icons.arrow_drop_down_outlined
: Icons.arrow_right,
color: Colors.white,
),
const Expanded(
child: Padding(
padding: EdgeInsets.all(8.0),
child: Text(
"Header 1",
style: TextStyle(
color: Colors.white,
fontSize: 17,
fontWeight: FontWeight.bold,
),
),
),
),
],
),
),
),
Padding(
padding: const EdgeInsets.fromLTRB(17.5, 0, 8, 0),
child: TextButton(
onPressed: () {
setState(() {
_is1AnwendungsbereichVisible =
!_is1AnwendungsbereichVisible;
});
},
child: Visibility(
visible: _isAnwendungsbereichVisible,
child: Column(
children: [
Container(
color: Colors.blue,
width: double.infinity,
height: 35,
child: const Padding(
padding: EdgeInsets.all(8.0),
child: Text(
"Subheader 1",
style: TextStyle(
color: Colors.white,
fontSize: 15.5,
fontWeight: FontWeight.bold,
),
),
),
),
],
),
),
),
),
Padding(
padding: const EdgeInsets.fromLTRB(35, 0, 0, 8),
child: Visibility(
visible: _is1AnwendungsbereichVisible,
child: Column(
children: [
TextButton(
onPressed: () {},
child: Container(
color: Colors.blue,
width: double.infinity,
height: 35,
child: const Padding(
padding: EdgeInsets.all(8.0),
child: Text(
"Inhalt",
style: TextStyle(
color: Colors.white,
fontSize: 15.5,
fontWeight: FontWeight.bold,
),
),
),
),
),
],
),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
color: Colors.grey[850],
width: double.infinity,
height: 35,
child: const Padding(
padding: EdgeInsets.all(8.0),
child: Text("Header 2",
style: TextStyle(
color: Colors.white,
fontSize: 17,
fontWeight: FontWeight.bold,
)),
),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
color: Colors.grey[850],
width: double.infinity,
height: 35,
child: const Padding(
padding: EdgeInsets.all(8.0),
child: Text("Beteiligung Dritter an der Jagd (§17-§25)",
style: TextStyle(
color: Colors.white,
fontSize: 17,
fontWeight: FontWeight.bold,
)),
),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
color: Colors.grey[850],
width: double.infinity,
height: 35,
child: const Padding(
padding: EdgeInsets.all(7.0),
child: Text("Jagdschein (§26-§28)",
style: TextStyle(
color: Colors.white,
fontSize: 17,
fontWeight: FontWeight.bold,
)),
),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
color: Colors.grey[850],
width: double.infinity,
height: 57,
child: const Padding(
padding: EdgeInsets.all(8.0),
child: Text(
"Besondere Rechte und Pflichten bei der Jagdausübung (§29-§40)",
style: TextStyle(
color: Colors.white,
fontSize: 17,
fontWeight: FontWeight.bold,
)),
),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
color: Colors.grey[850],
width: double.infinity,
height: 35,
child: const Padding(
padding: EdgeInsets.all(8.0),
child: Text(
"Sicherung der Nachhaltigkeit, Wildtierschutz (§41-§51)",
style: TextStyle(
color: Colors.white,
fontSize: 17,
fontWeight: FontWeight.bold,
)),
),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
color: Colors.grey[850],
width: double.infinity,
height: 35,
child: const Padding(
padding: EdgeInsets.all(8.0),
child: Text("Wild- und Jagdschaden (§51a-§57)",
style: TextStyle(
color: Colors.white,
fontSize: 17,
fontWeight: FontWeight.bold,
)),
),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
color: Colors.grey[850],
width: double.infinity,
height: 35,
child: const Padding(
padding: EdgeInsets.all(8.0),
child: Text("Verwaltungsbehörden, Beiräte (§58-§65)",
style: TextStyle(
color: Colors.white,
fontSize: 17,
fontWeight: FontWeight.bold,
)),
),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
color: Colors.grey[850],
width: double.infinity,
height: 35,
child: const Padding(
padding: EdgeInsets.all(8.0),
child: Text("Straf- und Bußgeldvorschriften (§66-§69)",
style: TextStyle(
color: Colors.white,
fontSize: 17,
fontWeight: FontWeight.bold,
)),
),
),
),
],
),
),
);
}
}

Related

How to organize widgets on flutter?

This is my problem:
I want to achieve this design, like this:
This is my code:
#override
Widget build(BuildContext context) {
return BackdropFilter(
filter: ImageFilter.blur(sigmaX: 2, sigmaY: 2),
child: Scaffold(
backgroundColor: Colors.transparent,
body: Center(
child: Padding(
padding: const EdgeInsets.all(32.0),
child: ClipRRect(
//<---here
borderRadius: BorderRadius.circular(10),
child: Container(
height: MediaQuery.of(context).size.height,
width: 600,
decoration: const BoxDecoration(
color: Color(0xffF6F6F6),
),
child: LayoutBuilder(
builder: (context, constraints) => Stack(
children: [
Padding(
padding: const EdgeInsets.all(15.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: const [
Icon(FontAwesomeIcons.checkDouble,
size: 40, color: Color(0xffD6D6D6)),
Icon(FontAwesomeIcons.squareXmark,
size: 40, color: Color(0xff404040)),
],
),
),
Padding(
padding: const EdgeInsets.fromLTRB(15, 60, 15, 0),
child: Stack(
children: [
Center(
child: Text(
"We send you an Email",
style: TextStyle(
fontSize: 20,
fontStyle: FontStyle.normal,
fontWeight: FontWeight.normal,
color: Color(0xff3B3B3B),
),
),
),
Padding(
padding: EdgeInsets.symmetric(vertical: 8.0),
child: Divider(color: Color(0xff3B3B3B)),
),
Text(
"Please, check your Email inbox to log in and start using Pomoworko",
style: TextStyle(
fontSize: 20,
fontStyle: FontStyle.normal,
fontWeight: FontWeight.normal,
color: Color(0xff3B3B3B),
),
),
Padding(
padding: EdgeInsets.symmetric(vertical: 8.0),
child: Divider(color: Color(0xff3B3B3B)),
),
],
),
),
RiveAnimation.asset(
"img/letter_and_knife.riv",
),
],
),
),
),
),
),
),
),
);
}
I get stuck on this, I used a column, but don't work, and I don't know how to organize the widgets, what widget may be helpful to use in order to achieve the second design?
The pink color is: color: Color(0xffF4CFDD)
Thanks for considering my request.
You are using wrong widget, instead of stack, you need to use column like this:
BackdropFilter(
filter: ImageFilter.blur(sigmaX: 2, sigmaY: 2),
child: Scaffold(
backgroundColor: Colors.transparent,
body: Center(
child: Padding(
padding: const EdgeInsets.all(32.0),
child: ClipRRect(
borderRadius: BorderRadius.circular(10),
child: Container(
height: MediaQuery.of(context).size.height,
width: 600,
decoration: const BoxDecoration(
color: Color(0xffF6F6F6),
),
child: LayoutBuilder(
builder: (context, constraints) => Column(
children: [
Container(
color: Colors.white,
padding: const EdgeInsets.all(15.0),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: const [
Icon(Icons.check,
size: 40, color: Color(0xffD6D6D6)),
Icon(Icons.close,
size: 40, color: Color(0xff404040)),
],
),
),
Padding(
padding:
const EdgeInsets.fromLTRB(15, 60, 15, 0),
child: Column(
children: [
Center(
child: Text(
"We send you an Email",
style: TextStyle(
fontSize: 20,
fontStyle: FontStyle.normal,
fontWeight: FontWeight.normal,
color: Color(0xff3B3B3B),
),
),
),
Padding(
padding:
EdgeInsets.symmetric(vertical: 8.0),
child: Divider(color: Color(0xff3B3B3B)),
),
Text(
"Please, check your Email inbox to log in and start using Pomoworko",
style: TextStyle(
fontSize: 20,
fontStyle: FontStyle.normal,
fontWeight: FontWeight.normal,
color: Color(0xff3B3B3B),
),
),
Padding(
padding:
EdgeInsets.symmetric(vertical: 8.0),
child: Divider(color: Color(0xff3B3B3B)),
),
],
),
),
Container(
color: Colors.red,
width: 100,
height: 100,
),
],
),
),
),
),
),
),
),
)

how to display bottom navbar without scrolling down

In my flutter code, I have created a separate navbar widget and called it on my page. I have used a single-child scroll view. now I have to scroll the page to see the navbar. I want it to be appeared bottom top of the page. how can I do this? the image shows when I scroll down how the nav bar appears. appreciate your help on this.
class ProfessionalProfile extends StatefulWidget {
const ProfessionalProfile({Key? key}) : super(key: key);
#override
State<ProfessionalProfile> createState() => _ProfessionalProfileState();
}
class _ProfessionalProfileState extends State<ProfessionalProfile> {
#override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.transparent,
elevation: 0.0,
iconTheme: IconThemeData(color: Colors.black),
),
drawer: HiddenDrawer(),
body: SingleChildScrollView(
child: Column(
// crossAxisAlignment: CrossAxisAlignment.center,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
height: 100,
width: 100,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(50),
color: Colors.lightBlue,
image: new DecorationImage(
image: new ExactAssetImage(
'assets/images/user.png'
),
fit: BoxFit.cover,
),
),
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
new Text(
'Nirosha Kumuduni',
style: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.bold),
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
new Text(
'neo#gmail.com',
style: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.bold),
),
],
),
SizedBox(
height: 20,
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
height: 20,
width: 20,
child: Image.asset(
'assets/icons/briefcase.png',
),
),
),
new Text(
'Profession',
style: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.bold),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
height: 40,
width:200,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(50),
color: MainGreen.withOpacity(.3),
),
child: new Text(
' Interior Designer',
style: TextStyle(
fontSize: 15.0,
),
),
),
)
],
),
SizedBox(
height: 10,
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
height: 20,
width: 20,
child: Image.asset(
'assets/icons/home.png',
),
),
),
new Text(
'Address',
style: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.bold),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
height: 40,
width:200,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(50),
color: MainGreen.withOpacity(.3),
),
child: new Text(
' 25/A, Horton Place, Colombo',
style: TextStyle(
fontSize: 15.0,
),
),
),
)
],
),
SizedBox(
height: 10,
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
height: 20,
width: 20,
child: Image.asset(
'assets/icons/phone-call.png',
),
),
),
new Text(
'Mobile Number',
style: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.bold),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
height: 40,
width:180,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(50),
color: MainGreen.withOpacity(.3),
),
child: new Text(
' +94 771122334',
style: TextStyle(
fontSize: 15.0,
),
),
),
)
],
),
SizedBox(
height: 10,
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
height: 20,
width: 20,
child: Image.asset(
'assets/icons/mail.png',
),
),
),
new Text(
'Email Address',
style: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.bold),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
height: 40,
width:180,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(50),
color: MainGreen.withOpacity(.3),
),
child: new Text(
' neo#gmail.com',
style: TextStyle(
fontSize: 15.0,
),
),
),
)
],
),
SizedBox(
height: 10,
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
height: 20,
width: 20,
child: Image.asset(
'assets/icons/hand-shake.png',
),
),
),
new Text(
'Business Name',
style: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.bold),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
height: 40,
width:170,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(50),
color: MainGreen.withOpacity(.3),
),
child: new Text(
' NEO GROUP',
style: TextStyle(
fontSize: 15.0,
),
),
),
)
],
),
SizedBox(
height: 10,
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
height: 20,
width: 20,
child: Image.asset(
'assets/icons/target.png',
),
),
),
new Text(
'Business Description',
style: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.bold),
),
],
),
SizedBox(
height: 10,
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
height: 40,
width:320,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(50),
color: MainGreen.withOpacity(.3),
),
child: new Text(
' 25/A, Horton Place, Colombo',
style: TextStyle(
fontSize: 15.0,
),
),
),
)
],
),
SizedBox(
height: 10,
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
height: 20,
width: 20,
),
),
new Text(
'Ratings & Reviews',
style: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.bold),
),
],
),
SizedBox(
height: 10,
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
new Text(
'4.1',
style: TextStyle(
fontSize: 40.0,
fontWeight: FontWeight.bold),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
height: 20,
width: 20,
child: Image.asset(
'assets/icons/rating.png',
),
),
),
],
),
SizedBox(
height: 10,
),
SizedBox(
height: 10,
),
Center(
child: GestureDetector(
child: MainButton("Edit Profile"),
// onTap: () async {
// FocusManager.instance.primaryFocus?.unfocus();
// if (_formKey.currentState!.validate()) {
// _formKey.currentState!.save();
// await LoginData();
// // Get.to(BottomNavigation());
// }
// },
onTap: (){
Get.to(DashboardScreen());
},
),
),
Container(
// width : MediaQuery.of(context).size.width,
height : 56,
child: BottomNavigation()
),
],
),
),
);
}
}
//bottom navigation
class BottomNavigation extends StatefulWidget {
const BottomNavigation({Key? key}) : super(key: key);
#override
State<BottomNavigation> createState() => _BottomNavigationState();
}
class _BottomNavigationState extends State<BottomNavigation> {
int _selectedIndex = 0;
void _onItemTapped(int index) {
setState(() {
_selectedIndex = index;
});
}
#override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
mainAxisAlignment: MainAxisAlignment.end,
children: [
BottomNavigationBar(
items: const <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Icon(Icons.home),
label: 'Home',
),
BottomNavigationBarItem(
icon: Icon(Icons.business),
label: 'Business',
),
BottomNavigationBarItem(
icon: Icon(Icons.star),
label: 'Reviews',
),
],
currentIndex: _selectedIndex,
selectedItemColor: Colors.blue,
onTap: _onItemTapped,
),
],
),
);
}
}
you can do it like that
class _ProfessionalProfileState extends State<ProfessionalProfile> {
#override
Widget build(BuildContext context) {
return Scaffold(
bottomNavigationBar: BottomNavigation() , // your BottomNavigation here
appBar: AppBar(
backgroundColor: Colors.transparent,
elevation: 0.0,
iconTheme: IconThemeData(color: Colors.black),
),
drawer: HiddenDrawer(),
body: SingleChildScrollView(
child: Column(
// crossAxisAlignment: CrossAxisAlignment.center,
children: [ ....

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.

Flutter Card Layout

So I'm new to flutter, and I'm trying to make a card. But I can't seem to get my desired output.
I tried to separate the different widgets, by using rows and columns, but I kept messing it up.
This is my target output
Target output
This is my current progressCurrent progress
#override
Widget build(BuildContext context) {
return Scaffold(
appBar: buildhomePageAppBar(),
body: buildExhibitorBody(),
);
}
Widget buildExhibitorBody() {
return Container(
child: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
buildExhibitorText(),
SizedBox(
height: 10,
),
buildExhibitorCards(),
SizedBox(height: 10),
],
),
),
);
}
Widget buildhomePageAppBar() {
double profileDimension = 35;
return AppBar(
backgroundColor: Colors.white,
titleSpacing: 0,
title: Padding(
padding: EdgeInsets.only(
left: 20,
),
child: Row(
children: [
Padding(
padding: EdgeInsets.only(
top: 5,
bottom: 5,
),
child: Image(
image: AssetImage('assets/images/plain_logo.png'),
height: 30,
),
),
SizedBox(width: 5),
Text(
'Virtex',
style: TextStyle(
color: Colors.black87,
fontFamily: 'Poppins',
fontSize: 16,
fontWeight: FontWeight.bold,
),
)
],
),
),
actions: [
Padding(
padding: EdgeInsets.only(
top: 10,
bottom: 10,
),
child: Container(
height: profileDimension,
width: profileDimension,
alignment: Alignment.center,
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(
color: Colors.black54,
width: 2,
),
borderRadius: BorderRadius.circular(50),
),
child: ClipRRect(
borderRadius: BorderRadius.circular(50),
child: Image(
width: profileDimension,
height: profileDimension,
image: AssetImage(
'assets/images/profile-image.jpeg',
),
fit: BoxFit.cover,
),
),
),
),
SizedBox(width: 20),
],
);
}
Widget buildExhibitorText() {
return Padding(
padding: EdgeInsets.only(
left: 20,
right: 20,
top: 20,
bottom: 10,
),
child: Container(
child: new Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Expanded(
child: Text(
"Exhibitors",
textAlign: TextAlign.justify,
style: TextStyle(
fontFamily: "DMSans",
letterSpacing: -0.2,
fontSize: 20.0,
color: Colors.black,
fontWeight: FontWeight.w400,
),
),
),
],
),
),
);
}
Widget buildExhibitorCards() { // I think my problem is I don't know how to do the layout here
return Container(
width: 400,
height: 150,
child: Column(children: <Widget>[
Card(
elevation: 1,
child: Padding(
padding: const EdgeInsets.only(),
child: Row(children: [
buildCardImage(),
buildCardExhibitor(),
buildCardIndustry(),
buildCardGo(),
])),
),
]),
);
}
Widget buildCardExhibitor() {
return Row(mainAxisAlignment: MainAxisAlignment.center, children: [
Container(
padding: EdgeInsets.all(10),
width: 40,
height: 40,
child: Center(
child: Row(
children: <Widget>[
Text(
"EN",
style: TextStyle(
fontSize: 15.0,
color: Colors.white,
fontWeight: FontWeight.bold,
),
textAlign: TextAlign.center,
),
Text('Exhibitor Name')
],
),
),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(200),
),
color: Colors.red,
),
),
]);
}
Widget buildCardImage() {
return Container(
height: 100,
width: 100,
child: Image(
image: AssetImage('assets/images/onboarding-2.jpg'),
height: 100,
),
);
}
Widget buildCardIndustry() {
return Padding(
padding: EdgeInsets.only(
left: 40,
right: 40,
),
child: Container(
child: new Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Text(
"Industry 1",
style: TextStyle(
fontFamily: "DMSans",
color: Colors.grey,
letterSpacing: 0.3,
fontSize: 12,
),
),
Text(
"Industry 2",
style: TextStyle(
fontFamily: "DMSans",
letterSpacing: -0.3,
fontSize: 12,
color: Colors.grey,
fontWeight: FontWeight.w500,
),
),
],
),
),
);
}
Widget buildCardGo() {
return Row(mainAxisAlignment: MainAxisAlignment.end, children: [
Text(
'Go to Booth',
style: TextStyle(
color: Colors.blue,
fontFamily: 'Poppins',
fontSize: 16,
fontWeight: FontWeight.bold,
),
),
SizedBox(width: 5),
IconButton(
icon: Icon(
MdiIcons.fromString('arrow-right'),
size: 30,
color: Colors.black,
),
onPressed: () {
Navigator.of(context).pop();
},
),
]);
}
}
I would greatly appreciate any kind of help.
Look:
My own Code
import 'package:flutter/material.dart';
class CardLayout extends StatelessWidget {
Widget buildCardImage = Container(
margin: EdgeInsets.only(right: 10.0),
width: 150,
height: 150,
decoration: BoxDecoration(
image: DecorationImage(
fit: BoxFit.fill,
image: NetworkImage("https://picsum.photos/250?image=9"),
),
),
);
Widget buildCardExhibitor =
Row(mainAxisAlignment: MainAxisAlignment.start, children: [
Container(
padding: EdgeInsets.all(10.0),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(200),
),
color: Colors.red,
),
child: Text(
"EN",
style: TextStyle(
fontSize: 15.0,
color: Colors.white,
fontWeight: FontWeight.bold,
),
textAlign: TextAlign.center,
),
),
SizedBox(
width: 10.0,
),
Text(
'Exhibitor Name',
style: TextStyle(
fontSize: 15.0,
color: Colors.black,
fontWeight: FontWeight.bold,
),
textAlign: TextAlign.center,
),
]);
Widget buildCardIndustry = Padding(
padding: EdgeInsets.all(8.0),
child: Container(
child: new Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Container(
padding:
EdgeInsets.only(left: 10.0, right: 10.0, top: 5, bottom: 5),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(100),
),
color: Colors.blueGrey.shade400,
),
child: Text(
'Industry 1',
style: TextStyle(
fontFamily: "DMSans",
color: Colors.white,
letterSpacing: 0.3,
fontSize: 12,
),
),
),
SizedBox(
width: 10.0,
),
Container(
padding:
EdgeInsets.only(left: 10.0, right: 10.0, top: 5, bottom: 5),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(100),
),
color: Colors.blueGrey.shade400,
),
child: Text(
'Industry 2',
style: TextStyle(
fontFamily: "DMSans",
color: Colors.white,
letterSpacing: 0.3,
fontSize: 12,
),
),
),
],
),
),
);
Widget buildCardGo = Row(mainAxisAlignment: MainAxisAlignment.end, children: [
Text(
'Go to Booth',
style: TextStyle(
color: Colors.blue,
fontFamily: 'Poppins',
fontSize: 16,
fontWeight: FontWeight.bold,
),
),
SizedBox(width: 3),
IconButton(
icon: Icon(
Icons.arrow_forward_rounded,
size: 30,
color: Colors.blue,
),
onPressed: () {
//Navigator.pop(context);
},
),
]);
#override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
appBar: AppBar(
title: Text('Exhibitor'),
actions: [
IconButton(
icon: Icon(Icons.filter_list_rounded),
onPressed: () {
Navigator.pop(context);
})
],
),
body: Container(
margin: EdgeInsets.only(top: 10.0),
width: MediaQuery.of(context).size.width,
//height: 150.0, // remove this line -------------- (1) [EDIT]
child: Column(
// wrap card with column and add listtile as children -------------- (2) [EDIT]
children: [
ListTile(
leading: Text('Exhibitor'),
trailing: IconButton(
icon: Icon(Icons.filter_list_rounded),
onPressed: () {
Navigator.pop(context);
}),
),
Card(
elevation: 5.0,
color: Colors.white,
child: Padding(
padding: EdgeInsets.all(5.0),
child: Row(
children: <Widget>[
buildCardImage,
Expanded(
child: Column(
children: <Widget>[
buildCardExhibitor,
buildCardIndustry,
buildCardGo
],
))
],
),
),
),
],
),
),
));
}
}

"'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'),
),