1
-
2
1
import 'package:flutter/material.dart' ;
3
2
import 'package:flutter_screenutil/flutter_screenutil.dart' ;
4
3
import 'package:video_player/video_player.dart' ;
@@ -7,8 +6,6 @@ import '../../coreRes/color_handler.dart';
7
6
import '../../coreRes/font-handler.dart' ;
8
7
import '../../widges/VideoPlayerScreen.dart' ;
9
8
10
-
11
-
12
9
class SocialPage extends StatefulWidget {
13
10
const SocialPage ({super .key});
14
11
@@ -17,13 +14,18 @@ class SocialPage extends StatefulWidget {
17
14
}
18
15
19
16
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 (
27
29
padding: const EdgeInsets .symmetric (horizontal: 10 ),
28
30
child: ElevatedButton (
29
31
statesController: _materialStatesController,
@@ -36,138 +38,138 @@ class _LearningPageState extends State<SocialPage> {
36
38
}
37
39
return ColorHandler .normalFont.withOpacity (0.2 );
38
40
}),
39
-
40
41
),
41
42
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
45
49
),
46
- );
50
+ ),
51
+ );
47
52
}
48
-
49
-
50
- Widget Thumbnails (){
51
- return Container (
53
+
54
+ Widget Thumbnails ( Size size) {
55
+ return Padding (
56
+ padding : EdgeInsets . all ( 10. sp),
52
57
child: Column (
53
58
children: [
54
59
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,
73
84
),
74
85
),
75
86
),
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),
95
102
),
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
+ ),
113
126
],
114
127
),
115
128
);
116
- }
117
-
118
-
129
+ }
119
130
120
131
@override
121
132
Widget build (BuildContext context) {
122
-
123
-
133
+ var size = MediaQuery .sizeOf (context);
124
134
return Column (
125
135
children: [
126
136
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 (
134
146
mainAxisAlignment: MainAxisAlignment .spaceBetween,
147
+ crossAxisAlignment: CrossAxisAlignment .center,
135
148
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, () {}),
143
153
],
144
154
),
145
-
146
-
147
-
148
- ],
149
- ),
150
-
151
-
152
- )
155
+ ),
156
+ ],
157
+ ),
158
+ ),
153
159
),
154
-
155
-
156
-
157
- SizedBox (
158
- height: 0.66 .sh,
160
+ Expanded (
161
+ // height: 0.66.sh,
159
162
child: SingleChildScrollView (
160
163
scrollDirection: Axis .vertical,
161
164
padding: EdgeInsets .only (top: 20. sp),
162
165
child: Column (
163
166
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),
171
173
],
172
174
),
173
175
),
@@ -176,7 +178,3 @@ class _LearningPageState extends State<SocialPage> {
176
178
);
177
179
}
178
180
}
179
-
180
-
181
-
182
-
0 commit comments