Skip to content

Commit e7cd3c4

Browse files
Made community page responsive issue Pratikdate#19
1 parent 628754a commit e7cd3c4

File tree

2 files changed

+123
-120
lines changed

2 files changed

+123
-120
lines changed

Diff for: lib/View/chat_screen.dart

+9-4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import 'package:Monitor/View/widges/CustomSearchDelegate.dart';
55
import 'package:cloud_firestore/cloud_firestore.dart';
66
import 'package:firebase_auth/firebase_auth.dart';
77
import 'package:flutter/material.dart';
8+
import 'package:flutter_screenutil/flutter_screenutil.dart';
89

910
import 'coreRes/color_handler.dart';
1011
import 'coreRes/icon_handler.dart';
@@ -21,13 +22,11 @@ class _ChatScreenState extends State<ChatScreen>
2122
late TabController _tabController;
2223
final ScrollController _scrollController = ScrollController();
2324

24-
2525
@override
2626
void initState() {
2727
super.initState();
2828
_tabController = TabController(length: _screens.length, vsync: this);
2929
_tabController.addListener(_handleTabChange);
30-
3130
}
3231

3332
// Screens to be displayed in each tab
@@ -36,7 +35,8 @@ class _ChatScreenState extends State<ChatScreen>
3635
CommunityChatPage(
3736
UserConnectionsSnapshot: FirebaseFirestore.instance
3837
.collection("User_Connections")
39-
.doc(FirebaseAuth.instance.currentUser!.uid) // Access the uid property from FirebaseAuth
38+
.doc(FirebaseAuth.instance.currentUser!
39+
.uid) // Access the uid property from FirebaseAuth
4040
.collection("Connections")
4141
.snapshots(),
4242
),
@@ -71,8 +71,13 @@ class _ChatScreenState extends State<ChatScreen>
7171
appBar: AppBar(
7272
bottom: TabBar(
7373
controller: _tabController,
74+
labelStyle: TextStyle(
75+
fontSize: 12.sp,
76+
),
7477
tabs: const [
75-
Tab(text: "Community"),
78+
Tab(
79+
text: "Community",
80+
),
7681
Tab(text: "Chats"),
7782
Tab(text: "Chat Bot"),
7883
],

Diff for: lib/View/subscreen/Comunity/SocialPost.dart

+114-116
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
import 'package:flutter/material.dart';
32
import 'package:flutter_screenutil/flutter_screenutil.dart';
43
import 'package:video_player/video_player.dart';
@@ -7,8 +6,6 @@ import '../../coreRes/color_handler.dart';
76
import '../../coreRes/font-handler.dart';
87
import '../../widges/VideoPlayerScreen.dart';
98

10-
11-
129
class SocialPage extends StatefulWidget {
1310
const SocialPage({super.key});
1411

@@ -17,13 +14,18 @@ class SocialPage extends StatefulWidget {
1714
}
1815

1916
class _LearningPageState extends State<SocialPage> {
20-
21-
22-
MaterialStatesController _materialStatesController=MaterialStatesController();
23-
24-
Widget buttonElevated(final text,dynamic onPress,) {
25-
return
26-
Padding(
17+
MaterialStatesController _materialStatesController =
18+
MaterialStatesController();
19+
20+
Widget buttonElevated(
21+
final text,
22+
Size size,
23+
dynamic onPress,
24+
) {
25+
return IntrinsicWidth(
26+
stepHeight: size.height * 0.08,
27+
stepWidth: size.height * 0.15,
28+
child: Padding(
2729
padding: const EdgeInsets.symmetric(horizontal: 10),
2830
child: ElevatedButton(
2931
statesController: _materialStatesController,
@@ -36,138 +38,138 @@ class _LearningPageState extends State<SocialPage> {
3638
}
3739
return ColorHandler.normalFont.withOpacity(0.2);
3840
}),
39-
4041
),
4142
onPressed: onPress,
42-
child: FontHandler(text,color: ColorHandler.normalFont.withOpacity(0.6), textAlign:TextAlign.center,fontsize: 12,),//function
43-
44-
43+
child: FontHandler(
44+
text,
45+
color: ColorHandler.normalFont.withOpacity(0.6),
46+
textAlign: TextAlign.center,
47+
fontsize: 12.sp,
48+
), //function
4549
),
46-
);
50+
),
51+
);
4752
}
48-
49-
50-
Widget Thumbnails(){
51-
return Container(
53+
54+
Widget Thumbnails(Size size) {
55+
return Padding(
56+
padding: EdgeInsets.all(10.sp),
5257
child: Column(
5358
children: [
5459
InkWell(
55-
onTap: (){
56-
Navigator.push(context, MaterialPageRoute(builder: (context)=>VideoPlayerScreen()));
57-
},
58-
child: Image.network("https://www.wowmakers.com/static/e743f3689ca0c0bac8faab39023da37f/4cb25/Video-thumbnail.jpg",width:600 ,height:200 ,)),
59-
60-
Row(
61-
children: [
62-
Padding(
63-
padding: EdgeInsets.only(left:10.sp,right: 10.sp),
64-
child: SizedBox(
65-
width: 45.sp,
66-
height: 45.sp,
67-
child: ClipRRect(
68-
borderRadius: BorderRadius.circular(100.sp),
69-
child: Image(
70-
image: AssetImage("assets/img1.jpg"),
71-
fit: BoxFit.fill,
72-
),
60+
onTap: () {
61+
Navigator.push(
62+
context,
63+
MaterialPageRoute(
64+
builder: (context) => VideoPlayerScreen()));
65+
},
66+
child: Image.network(
67+
"https://www.wowmakers.com/static/e743f3689ca0c0bac8faab39023da37f/4cb25/Video-thumbnail.jpg",
68+
width: size.width,
69+
height: size.height * 0.2,
70+
fit: BoxFit.fitWidth,
71+
)),
72+
Row(
73+
children: [
74+
Padding(
75+
padding: EdgeInsets.only(top: 10.sp),
76+
child: SizedBox(
77+
width: 45.sp,
78+
height: 45.sp,
79+
child: ClipRRect(
80+
borderRadius: BorderRadius.circular(100.sp),
81+
child: Image(
82+
image: AssetImage("assets/img1.jpg"),
83+
fit: BoxFit.fill,
7384
),
7485
),
7586
),
76-
Container(
77-
padding: EdgeInsets.only(top:10.sp,bottom: 10.sp),
78-
79-
child: Column(
80-
crossAxisAlignment: CrossAxisAlignment.start,
81-
children: [
82-
SizedBox(
83-
width:MediaQuery.of(context).size.width-90.w,
84-
child: Text(
85-
"Sizing elements to percentage of screen width/height",
86-
textAlign: TextAlign.left,
87-
maxLines: 3,
88-
style: TextStyle(
89-
color: ColorHandler.normalFont,
90-
fontSize: 15
91-
92-
),
93-
94-
),
87+
),
88+
Container(
89+
padding:
90+
EdgeInsets.only(top: 10.sp, bottom: 10.sp, left: 10.sp),
91+
child: Column(
92+
crossAxisAlignment: CrossAxisAlignment.start,
93+
children: [
94+
SizedBox(
95+
width: size.width - 90.w,
96+
child: Text(
97+
"Sizing elements to percentage of screen width/height",
98+
textAlign: TextAlign.left,
99+
maxLines: 3,
100+
style: TextStyle(
101+
color: ColorHandler.normalFont, fontSize: 15.sp),
95102
),
96-
Row(
97-
crossAxisAlignment: CrossAxisAlignment.start,
98-
children: [
99-
FontHandler("by Pratik Date", color: ColorHandler.normalFont.withOpacity(0.6), textAlign: TextAlign.start),
100-
SizedBox(width: 10.sp,),
101-
FontHandler("views 20", color: ColorHandler.normalFont.withOpacity(0.6), textAlign: TextAlign.start),
102-
103-
],
104-
)
105-
106-
107-
]),
108-
),
109-
110-
],
111-
),
112-
103+
),
104+
Row(
105+
crossAxisAlignment: CrossAxisAlignment.start,
106+
children: [
107+
FontHandler(
108+
"by Pratik Date",
109+
color: ColorHandler.normalFont.withOpacity(0.6),
110+
textAlign: TextAlign.start,
111+
fontsize: 14.sp,
112+
),
113+
SizedBox(
114+
width: 10.sp,
115+
),
116+
FontHandler("views 20",
117+
fontsize: 14.sp,
118+
color: ColorHandler.normalFont.withOpacity(0.6),
119+
textAlign: TextAlign.start),
120+
],
121+
)
122+
]),
123+
),
124+
],
125+
),
113126
],
114127
),
115128
);
116-
}
117-
118-
129+
}
119130

120131
@override
121132
Widget build(BuildContext context) {
122-
123-
133+
var size = MediaQuery.sizeOf(context);
124134
return Column(
125135
children: [
126136
Container(
127-
padding: EdgeInsets.symmetric(horizontal: 10) ,
128-
width: MediaQuery.of(context).size.width,
129-
child: SingleChildScrollView(
130-
scrollDirection: Axis.horizontal,
131-
child: Column(
132-
children: [
133-
Row(
137+
padding: EdgeInsets.symmetric(horizontal: 10),
138+
width: MediaQuery.of(context).size.width,
139+
child: SingleChildScrollView(
140+
scrollDirection: Axis.horizontal,
141+
child: Column(
142+
children: [
143+
Padding(
144+
padding: EdgeInsets.only(top: 20.h),
145+
child: Row(
134146
mainAxisAlignment: MainAxisAlignment.spaceBetween,
147+
crossAxisAlignment: CrossAxisAlignment.center,
135148
children: [
136-
buttonElevated("All",(){}),
137-
138-
buttonElevated("News",(){}),
139-
buttonElevated("Podcast",(){}),
140-
buttonElevated("Events",(){}),
141-
142-
149+
buttonElevated("All", size, () {}),
150+
buttonElevated("News", size, () {}),
151+
buttonElevated("Podcast", size, () {}),
152+
buttonElevated("Events", size, () {}),
143153
],
144154
),
145-
146-
147-
148-
],
149-
),
150-
151-
152-
)
155+
),
156+
],
157+
),
158+
),
153159
),
154-
155-
156-
157-
SizedBox(
158-
height: 0.66.sh,
160+
Expanded(
161+
// height: 0.66.sh,
159162
child: SingleChildScrollView(
160163
scrollDirection: Axis.vertical,
161164
padding: EdgeInsets.only(top: 20.sp),
162165
child: Column(
163166
children: [
164-
Thumbnails(),
165-
Thumbnails(),
166-
Thumbnails(),
167-
Thumbnails(),
168-
Thumbnails(),
169-
Thumbnails(),
170-
167+
Thumbnails(size),
168+
Thumbnails(size),
169+
Thumbnails(size),
170+
Thumbnails(size),
171+
Thumbnails(size),
172+
Thumbnails(size),
171173
],
172174
),
173175
),
@@ -176,7 +178,3 @@ class _LearningPageState extends State<SocialPage> {
176178
);
177179
}
178180
}
179-
180-
181-
182-

0 commit comments

Comments
 (0)