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' ;
5
4
import '../../../Resource/color_handler.dart' ;
6
5
import '../../../Resource/font-handler.dart' ;
7
6
import '../../widges/VideoPlayerScreen.dart' ;
8
7
9
-
10
-
11
8
class SocialPage extends StatefulWidget {
12
9
const SocialPage ({super .key});
13
10
@@ -16,166 +13,147 @@ class SocialPage extends StatefulWidget {
16
13
}
17
14
18
15
class _LearningPageState extends State <SocialPage > {
19
-
20
-
21
- MaterialStatesController _materialStatesController= MaterialStatesController ();
22
-
23
- Widget buttonElevated (final text,dynamic onPress,) {
24
- return
25
- Padding (
26
- padding: const EdgeInsets .symmetric (horizontal: 10 ),
27
- child: ElevatedButton (
28
- statesController: _materialStatesController,
29
- autofocus: true ,
30
- style: ButtonStyle (
31
- backgroundColor: MaterialStateProperty .resolveWith ((states) {
32
- // If the button is pressed, return green, otherwise blue
33
- if (states.contains (MaterialState .pressed)) {
34
- return ColorHandler .bgColor.withOpacity (0.8 );
35
- }
36
- return ColorHandler .normalFont.withOpacity (0.2 );
37
- }),
38
-
39
- ),
40
- onPressed: onPress,
41
- child: FontHandler (text,color: ColorHandler .normalFont.withOpacity (0.6 ), textAlign: TextAlign .center,fontsize: 12 ,),//function
42
-
43
-
16
+ MaterialStatesController _materialStatesController = MaterialStatesController ();
17
+
18
+ Widget buttonElevated (final text, dynamic onPress) {
19
+ return Padding (
20
+ padding: const EdgeInsets .symmetric (horizontal: 10 ),
21
+ child: ElevatedButton (
22
+ statesController: _materialStatesController,
23
+ autofocus: true ,
24
+ style: ButtonStyle (
25
+ backgroundColor: MaterialStateProperty .resolveWith ((states) {
26
+ if (states.contains (MaterialState .pressed)) {
27
+ return ColorHandler .bgColor.withOpacity (0.8 );
28
+ }
29
+ return ColorHandler .normalFont.withOpacity (0.2 );
30
+ }),
44
31
),
45
- );
32
+ onPressed: onPress,
33
+ child: FontHandler (
34
+ text,
35
+ color: ColorHandler .normalFont.withOpacity (0.6 ),
36
+ textAlign: TextAlign .center,
37
+ fontsize: 12 ,
38
+ ), //function
39
+ ),
40
+ );
46
41
}
47
-
48
-
49
- Widget Thumbnails (){
42
+
43
+ Widget Thumbnails (BuildContext context) {
50
44
return Container (
51
45
child: Column (
52
46
children: [
53
47
InkWell (
54
- onTap: (){
55
- Navigator .push (context, MaterialPageRoute (builder: (context)=> VideoPlayerScreen ()));
48
+ onTap: () {
49
+ Navigator .push (context,
50
+ MaterialPageRoute (builder: (context) => VideoPlayerScreen ()));
56
51
},
57
- child: Image .network ("https://www.wowmakers.com/static/e743f3689ca0c0bac8faab39023da37f/4cb25/Video-thumbnail.jpg" ,width: 600 ,height: 200 ,)),
58
-
59
- Row (
60
- children: [
61
- Padding (
62
- padding: EdgeInsets .only (left: 10. sp,right: 10. sp),
63
- child: SizedBox (
64
- width: 45. sp,
65
- height: 45. sp,
66
- child: ClipRRect (
67
- borderRadius: BorderRadius .circular (100. sp),
68
- child: Image (
69
- image: AssetImage ("assets/img1.jpg" ),
70
- fit: BoxFit .fill,
71
- ),
52
+ child: Image .network (
53
+ "https://www.wowmakers.com/static/e743f3689ca0c0bac8faab39023da37f/4cb25/Video-thumbnail.jpg" ,
54
+ width: MediaQuery .of (context).size.width * 0.9 ,
55
+ height: 200 ,
56
+ fit: BoxFit .cover,
57
+ ),
58
+ ),
59
+ Row (
60
+ children: [
61
+ Padding (
62
+ padding: EdgeInsets .only (left: 15. sp, right: 10. sp),
63
+ child: SizedBox (
64
+ width: 45. sp,
65
+ height: 45. sp,
66
+ child: ClipRRect (
67
+ borderRadius: BorderRadius .circular (100. sp),
68
+ child: Image (
69
+ image: AssetImage ("assets/img1.jpg" ),
70
+ fit: BoxFit .fill,
72
71
),
73
72
),
74
73
),
75
- Container (
76
- padding: EdgeInsets .only (top: 10. sp,bottom: 10. sp),
77
-
74
+ ),
75
+ Expanded (
76
+ child: Container (
77
+ padding: EdgeInsets .only (top: 10. sp, bottom: 10. sp),
78
78
child: Column (
79
- crossAxisAlignment: CrossAxisAlignment .start,
80
- children: [
81
- SizedBox (
82
- width: MediaQuery .of (context).size.width- 90. w,
83
- child: Text (
84
- "Sizing elements to percentage of screen width/height" ,
85
- textAlign: TextAlign .left,
86
- maxLines: 3 ,
87
- style: TextStyle (
88
- color: ColorHandler .normalFont,
89
- fontSize: 15
90
-
91
- ),
92
-
93
- ),
79
+ crossAxisAlignment: CrossAxisAlignment .start,
80
+ children: [
81
+ Text (
82
+ "Sizing elements to percentage of screen width/height" ,
83
+ textAlign: TextAlign .left,
84
+ maxLines: 3 ,
85
+ style: TextStyle (
86
+ color: ColorHandler .normalFont,
87
+ fontSize: 15 ,
94
88
),
95
- Row (
96
- crossAxisAlignment: CrossAxisAlignment .start,
97
- children: [
98
- FontHandler ("by Pratik Date" , color: ColorHandler .normalFont.withOpacity (0.6 ), textAlign: TextAlign .start),
99
- SizedBox (width: 10. sp,),
100
- FontHandler ("views 20" , color: ColorHandler .normalFont.withOpacity (0.6 ), textAlign: TextAlign .start),
101
-
102
- ],
103
- )
104
-
105
-
106
- ]),
89
+ ),
90
+ Row (
91
+ crossAxisAlignment: CrossAxisAlignment .start,
92
+ children: [
93
+ FontHandler ("by Pratik Date" ,
94
+ color: ColorHandler .normalFont.withOpacity (0.6 ),
95
+ textAlign: TextAlign .start),
96
+ SizedBox (
97
+ width: 10. sp,
98
+ ),
99
+ FontHandler ("views 20" ,
100
+ color: ColorHandler .normalFont.withOpacity (0.6 ),
101
+ textAlign: TextAlign .start),
102
+ ],
103
+ )
104
+ ],
105
+ ),
107
106
),
108
-
109
- ],
110
- ),
111
-
107
+ ),
108
+ ],
109
+ ),
112
110
],
113
111
),
114
112
);
115
- }
116
-
117
-
113
+ }
118
114
119
115
@override
120
116
Widget build (BuildContext context) {
121
-
122
-
123
- return Column (
124
- children: [
125
- Container (
126
- padding: EdgeInsets .symmetric (horizontal: 10 ) ,
127
- width: MediaQuery .of (context).size.width,
128
- child: SingleChildScrollView (
129
- scrollDirection: Axis .horizontal,
130
- child: Column (
131
- children: [
132
- Row (
133
- mainAxisAlignment: MainAxisAlignment .spaceBetween,
134
- children: [
135
- buttonElevated ("All" ,(){}),
136
-
137
- buttonElevated ("News" ,(){}),
138
- buttonElevated ("Podcast" ,(){}),
139
- buttonElevated ("Events" ,(){}),
140
-
141
-
142
- ],
143
- ),
144
-
145
-
146
-
147
- ],
117
+ return LayoutBuilder (
118
+ builder: (context, constraints) {
119
+ return Column (
120
+ children: [
121
+ Container (
122
+ padding: EdgeInsets .symmetric (horizontal: 10 ),
123
+ width: constraints.maxWidth,
124
+ child: SingleChildScrollView (
125
+ scrollDirection: Axis .horizontal,
126
+ child: Row (
127
+ mainAxisAlignment: MainAxisAlignment .spaceBetween,
128
+ children: [
129
+ buttonElevated ("All" , () {}),
130
+ buttonElevated ("News" , () {}),
131
+ buttonElevated ("Podcast" , () {}),
132
+ buttonElevated ("Events" , () {}),
133
+ ],
134
+ ),
148
135
),
149
-
150
-
151
- )
152
- ),
153
-
154
-
155
-
156
- SizedBox (
157
- height: 0.64 .sh,
158
- child: SingleChildScrollView (
159
- scrollDirection: Axis .vertical,
160
- padding: EdgeInsets .only (top: 20. sp),
161
- child: Column (
162
- children: [
163
- Thumbnails (),
164
- Thumbnails (),
165
- Thumbnails (),
166
- Thumbnails (),
167
- Thumbnails (),
168
- Thumbnails (),
169
-
170
- ],
171
136
),
172
- ),
173
- ),
174
- ],
137
+ SizedBox (
138
+ height: 0.64 .sh,
139
+ child: SingleChildScrollView (
140
+ scrollDirection: Axis .vertical,
141
+ padding: EdgeInsets .only (top: 20. sp),
142
+ child: Column (
143
+ children: [
144
+ Thumbnails (context),
145
+ Thumbnails (context),
146
+ Thumbnails (context),
147
+ Thumbnails (context),
148
+ Thumbnails (context),
149
+ Thumbnails (context),
150
+ ],
151
+ ),
152
+ ),
153
+ ),
154
+ ],
155
+ );
156
+ },
175
157
);
176
158
}
177
159
}
178
-
179
-
180
-
181
-
0 commit comments