From e7cd3c48fa9e3275a7f22db6f2b252f4bb48c8af Mon Sep 17 00:00:00 2001 From: ShashankDeepak Date: Mon, 13 May 2024 23:09:47 +0530 Subject: [PATCH] Made community page responsive issue #19 --- lib/View/chat_screen.dart | 13 +- lib/View/subscreen/Comunity/SocialPost.dart | 230 ++++++++++---------- 2 files changed, 123 insertions(+), 120 deletions(-) diff --git a/lib/View/chat_screen.dart b/lib/View/chat_screen.dart index 60b75bf..82c2236 100644 --- a/lib/View/chat_screen.dart +++ b/lib/View/chat_screen.dart @@ -5,6 +5,7 @@ import 'package:Monitor/View/widges/CustomSearchDelegate.dart'; import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:firebase_auth/firebase_auth.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'coreRes/color_handler.dart'; import 'coreRes/icon_handler.dart'; @@ -21,13 +22,11 @@ class _ChatScreenState extends State late TabController _tabController; final ScrollController _scrollController = ScrollController(); - @override void initState() { super.initState(); _tabController = TabController(length: _screens.length, vsync: this); _tabController.addListener(_handleTabChange); - } // Screens to be displayed in each tab @@ -36,7 +35,8 @@ class _ChatScreenState extends State CommunityChatPage( UserConnectionsSnapshot: FirebaseFirestore.instance .collection("User_Connections") - .doc(FirebaseAuth.instance.currentUser!.uid) // Access the uid property from FirebaseAuth + .doc(FirebaseAuth.instance.currentUser! + .uid) // Access the uid property from FirebaseAuth .collection("Connections") .snapshots(), ), @@ -71,8 +71,13 @@ class _ChatScreenState extends State appBar: AppBar( bottom: TabBar( controller: _tabController, + labelStyle: TextStyle( + fontSize: 12.sp, + ), tabs: const [ - Tab(text: "Community"), + Tab( + text: "Community", + ), Tab(text: "Chats"), Tab(text: "Chat Bot"), ], diff --git a/lib/View/subscreen/Comunity/SocialPost.dart b/lib/View/subscreen/Comunity/SocialPost.dart index 4846408..5b2fa8d 100644 --- a/lib/View/subscreen/Comunity/SocialPost.dart +++ b/lib/View/subscreen/Comunity/SocialPost.dart @@ -1,4 +1,3 @@ - import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:video_player/video_player.dart'; @@ -7,8 +6,6 @@ import '../../coreRes/color_handler.dart'; import '../../coreRes/font-handler.dart'; import '../../widges/VideoPlayerScreen.dart'; - - class SocialPage extends StatefulWidget { const SocialPage({super.key}); @@ -17,13 +14,18 @@ class SocialPage extends StatefulWidget { } class _LearningPageState extends State { - - - MaterialStatesController _materialStatesController=MaterialStatesController(); - - Widget buttonElevated(final text,dynamic onPress,) { - return - Padding( + MaterialStatesController _materialStatesController = + MaterialStatesController(); + + Widget buttonElevated( + final text, + Size size, + dynamic onPress, + ) { + return IntrinsicWidth( + stepHeight: size.height * 0.08, + stepWidth: size.height * 0.15, + child: Padding( padding: const EdgeInsets.symmetric(horizontal: 10), child: ElevatedButton( statesController: _materialStatesController, @@ -36,138 +38,138 @@ class _LearningPageState extends State { } return ColorHandler.normalFont.withOpacity(0.2); }), - ), onPressed: onPress, - child: FontHandler(text,color: ColorHandler.normalFont.withOpacity(0.6), textAlign:TextAlign.center,fontsize: 12,),//function - - + child: FontHandler( + text, + color: ColorHandler.normalFont.withOpacity(0.6), + textAlign: TextAlign.center, + fontsize: 12.sp, + ), //function ), - ); + ), + ); } - - - Widget Thumbnails(){ - return Container( + + Widget Thumbnails(Size size) { + return Padding( + padding: EdgeInsets.all(10.sp), child: Column( children: [ InkWell( - onTap: (){ - Navigator.push(context, MaterialPageRoute(builder: (context)=>VideoPlayerScreen())); - }, - child: Image.network("https://www.wowmakers.com/static/e743f3689ca0c0bac8faab39023da37f/4cb25/Video-thumbnail.jpg",width:600 ,height:200 ,)), - - Row( - children: [ - Padding( - padding: EdgeInsets.only(left:10.sp,right: 10.sp), - child: SizedBox( - width: 45.sp, - height: 45.sp, - child: ClipRRect( - borderRadius: BorderRadius.circular(100.sp), - child: Image( - image: AssetImage("assets/img1.jpg"), - fit: BoxFit.fill, - ), + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => VideoPlayerScreen())); + }, + child: Image.network( + "https://www.wowmakers.com/static/e743f3689ca0c0bac8faab39023da37f/4cb25/Video-thumbnail.jpg", + width: size.width, + height: size.height * 0.2, + fit: BoxFit.fitWidth, + )), + Row( + children: [ + Padding( + padding: EdgeInsets.only(top: 10.sp), + child: SizedBox( + width: 45.sp, + height: 45.sp, + child: ClipRRect( + borderRadius: BorderRadius.circular(100.sp), + child: Image( + image: AssetImage("assets/img1.jpg"), + fit: BoxFit.fill, ), ), ), - Container( - padding: EdgeInsets.only(top:10.sp,bottom: 10.sp), - - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - width:MediaQuery.of(context).size.width-90.w, - child: Text( - "Sizing elements to percentage of screen width/height", - textAlign: TextAlign.left, - maxLines: 3, - style: TextStyle( - color: ColorHandler.normalFont, - fontSize: 15 - - ), - - ), + ), + Container( + padding: + EdgeInsets.only(top: 10.sp, bottom: 10.sp, left: 10.sp), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + width: size.width - 90.w, + child: Text( + "Sizing elements to percentage of screen width/height", + textAlign: TextAlign.left, + maxLines: 3, + style: TextStyle( + color: ColorHandler.normalFont, fontSize: 15.sp), ), - Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - FontHandler("by Pratik Date", color: ColorHandler.normalFont.withOpacity(0.6), textAlign: TextAlign.start), - SizedBox(width: 10.sp,), - FontHandler("views 20", color: ColorHandler.normalFont.withOpacity(0.6), textAlign: TextAlign.start), - - ], - ) - - - ]), - ), - - ], - ), - + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + FontHandler( + "by Pratik Date", + color: ColorHandler.normalFont.withOpacity(0.6), + textAlign: TextAlign.start, + fontsize: 14.sp, + ), + SizedBox( + width: 10.sp, + ), + FontHandler("views 20", + fontsize: 14.sp, + color: ColorHandler.normalFont.withOpacity(0.6), + textAlign: TextAlign.start), + ], + ) + ]), + ), + ], + ), ], ), ); - } - - + } @override Widget build(BuildContext context) { - - + var size = MediaQuery.sizeOf(context); return Column( children: [ Container( - padding: EdgeInsets.symmetric(horizontal: 10) , - width: MediaQuery.of(context).size.width, - child: SingleChildScrollView( - scrollDirection: Axis.horizontal, - child: Column( - children: [ - Row( + padding: EdgeInsets.symmetric(horizontal: 10), + width: MediaQuery.of(context).size.width, + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Column( + children: [ + Padding( + padding: EdgeInsets.only(top: 20.h), + child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, children: [ - buttonElevated("All",(){}), - - buttonElevated("News",(){}), - buttonElevated("Podcast",(){}), - buttonElevated("Events",(){}), - - + buttonElevated("All", size, () {}), + buttonElevated("News", size, () {}), + buttonElevated("Podcast", size, () {}), + buttonElevated("Events", size, () {}), ], ), - - - - ], - ), - - - ) + ), + ], + ), + ), ), - - - - SizedBox( - height: 0.66.sh, + Expanded( + // height: 0.66.sh, child: SingleChildScrollView( scrollDirection: Axis.vertical, padding: EdgeInsets.only(top: 20.sp), child: Column( children: [ - Thumbnails(), - Thumbnails(), - Thumbnails(), - Thumbnails(), - Thumbnails(), - Thumbnails(), - + Thumbnails(size), + Thumbnails(size), + Thumbnails(size), + Thumbnails(size), + Thumbnails(size), + Thumbnails(size), ], ), ), @@ -176,7 +178,3 @@ class _LearningPageState extends State { ); } } - - - -