I am working on a flutter app. The widgets are not rendering on the screen. Here's the problamatic code:
@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
appBar: AppBar(
title: const Text("Let's get productive!"),
),
body: Material(
child: Column(
children: [
Pomodoro(),
],
),
),
bottomNavigationBar: BottomNavigationBar(
items: const [
BottomNavigationBarItem(
icon: Icon(Icons.home),
label: 'Home',
//backgroundColor:
),
BottomNavigationBarItem(
icon: Icon(Icons.analytics),
label: 'Home',
//backgroundColor:
),
BottomNavigationBarItem(
icon: Icon(Icons.settings),
label: 'Home',
//backgroundColor:
),
],
),
),
);
}
}
The Pomodoro class
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
decoration: const BoxDecoration(
gradient: LinearGradient(
colors: [Color(0xff1542bf), Color(0xff51a8ff)],
begin: FractionalOffset(0.5, 1),
),
),
width: double.infinity,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const Padding(
padding: EdgeInsets.all(12.0),
child: Text(
"Pomodoro",
style: TextStyle(
color: Colors.white,
fontSize: 30.0,
),
),
),
const SizedBox(
height: 20.0,
),
Expanded(
child: CircularPercentIndicator(
radius: 250.0,
percent: percent,
animation: true,
animateFromLastPercent: true,
lineWidth: 20.0,
progressColor: Colors.white,
backgroundWidth: 50.0,
center: Text(
"$timeInMinute",
style: const TextStyle(
color: Colors.white,
fontSize: 80.0,
),
),
),
),
const SizedBox(
height: 20.0,
),
],
),
),
);
}
}
I have tried changing the height and width of the container, removing the scaffold and just returning the container, and removing the container just keeping the column in the scaffold body and removing the expanded widget. No matter what I do, I get the same error. Kindly help me.
Also, I do not want to make the home screen scrollable. I want everything to fit inside the screen and also be responsive to different screen sizes. I tried media queries to give size but that too didn't work.