From 44ae37d1178394a41b9efc7991466f366856638d Mon Sep 17 00:00:00 2001 From: rishabh7923 Date: Wed, 30 Oct 2024 10:17:49 +0530 Subject: [PATCH] Fixed ListView Height Issue --- lib/programs screen/redox.dart | 59 ++++++++++++++-------------- lib/widgets/rsoc_project_widget.dart | 6 --- 2 files changed, 29 insertions(+), 36 deletions(-) diff --git a/lib/programs screen/redox.dart b/lib/programs screen/redox.dart index f2e2e3d..a4fa771 100644 --- a/lib/programs screen/redox.dart +++ b/lib/programs screen/redox.dart @@ -16,7 +16,7 @@ class RsocPage extends StatefulWidget { class _RsocPageState extends State { List projects = []; - List allProjects =[]; + List allProjects = []; String currectPage = "/rsoc"; String currentProject = "RSoC"; @@ -76,12 +76,11 @@ class _RsocPageState extends State { onRefresh: _refresh, child: Scaffold( appBar: AppBar( - leading: IconButton( - icon: const Icon(Icons.arrow_back_ios), - - onPressed: () => Navigator.of(context).pop(), - ), - centerTitle: true, + leading: IconButton( + icon: const Icon(Icons.arrow_back_ios), + onPressed: () => Navigator.of(context).pop(), + ), + centerTitle: true, title: const Text('Redox Summer of Code'), actions: [ IconButton( @@ -130,8 +129,7 @@ class _RsocPageState extends State { } else if (snapshot.connectionState == ConnectionState.done) { return Padding( padding: EdgeInsets.symmetric( - horizontal: ScreenUtil().setWidth(42), - vertical: ScreenUtil().setHeight(10), + horizontal: ScreenUtil().setWidth(42), ), child: SingleChildScrollView( child: Column( @@ -144,19 +142,23 @@ class _RsocPageState extends State { suffixIcon: const Icon(Icons.search), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(10), - borderSide: const BorderSide(color: Color(0xFFEEEEEE)), + borderSide: + const BorderSide(color: Color(0xFFEEEEEE)), ), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(10), - borderSide: const BorderSide(color: Color(0xFFEEEEEE)), + borderSide: + const BorderSide(color: Color(0xFFEEEEEE)), ), disabledBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(10), - borderSide: const BorderSide(color: Color(0xFFEEEEEE)), + borderSide: + const BorderSide(color: Color(0xFFEEEEEE)), ), border: OutlineInputBorder( borderRadius: BorderRadius.circular(10), - borderSide: const BorderSide(color: Color(0xFFEEEEEE)), + borderSide: + const BorderSide(color: Color(0xFFEEEEEE)), ), contentPadding: EdgeInsets.symmetric( vertical: ScreenUtil().setHeight(12), @@ -168,22 +170,19 @@ class _RsocPageState extends State { }, ), SizedBox(height: ScreenUtil().setHeight(20)), - SizedBox( - height: MediaQuery.of(context).size.height * 0.9, - child: ListView.builder( - itemCount: projects.length, - itemBuilder: (BuildContext context, int index) { - return Padding( - padding: const EdgeInsets.symmetric(vertical: 8), - child: RsocProjectWidget( - modal: projects[index], - height: ScreenUtil().screenHeight * 0.10, - width: ScreenUtil().screenWidth, - index: index+1, - ), - ); - }, - ), + ListView.builder( + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + itemCount: projects.length, + itemBuilder: (BuildContext context, int index) { + return Padding( + padding: const EdgeInsets.symmetric(vertical: 8), + child: RsocProjectWidget( + modal: projects[index], + index: index + 1, + ), + ); + }, ), ], ), @@ -197,4 +196,4 @@ class _RsocPageState extends State { ), ); } -} \ No newline at end of file +} diff --git a/lib/widgets/rsoc_project_widget.dart b/lib/widgets/rsoc_project_widget.dart index cd73be0..3d09ed7 100644 --- a/lib/widgets/rsoc_project_widget.dart +++ b/lib/widgets/rsoc_project_widget.dart @@ -4,16 +4,12 @@ import 'package:url_launcher/url_launcher.dart'; class RsocProjectWidget extends StatelessWidget { final RsocProjectModal modal; - final double height; - final double width; final int index; const RsocProjectWidget({ super.key, required this.modal, required this.index, - this.height = 100, - this.width = 100, }); @override @@ -29,8 +25,6 @@ class RsocProjectWidget extends StatelessWidget { } }, child: Container( - width: width, - constraints: BoxConstraints(minHeight: height), decoration: BoxDecoration( border: Border.all( color: isDarkMode ? Colors.orange.shade100 : Colors.orange.shade300,