Skip to content

Commit

Permalink
Made community page responsive issue Pratikdate#19
Browse files Browse the repository at this point in the history
  • Loading branch information
ShashankDeepak committed May 13, 2024
1 parent 628754a commit e7cd3c4
Show file tree
Hide file tree
Showing 2 changed files with 123 additions and 120 deletions.
13 changes: 9 additions & 4 deletions lib/View/chat_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -21,13 +22,11 @@ class _ChatScreenState extends State<ChatScreen>
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
Expand All @@ -36,7 +35,8 @@ class _ChatScreenState extends State<ChatScreen>
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(),
),
Expand Down Expand Up @@ -71,8 +71,13 @@ class _ChatScreenState extends State<ChatScreen>
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"),
],
Expand Down
230 changes: 114 additions & 116 deletions lib/View/subscreen/Comunity/SocialPost.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:video_player/video_player.dart';
Expand All @@ -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});

Expand All @@ -17,13 +14,18 @@ class SocialPage extends StatefulWidget {
}

class _LearningPageState extends State<SocialPage> {


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,
Expand All @@ -36,138 +38,138 @@ class _LearningPageState extends State<SocialPage> {
}
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),
],
),
),
Expand All @@ -176,7 +178,3 @@ class _LearningPageState extends State<SocialPage> {
);
}
}




0 comments on commit e7cd3c4

Please sign in to comment.