@@ -25,71 +25,44 @@ class UserWidget extends StatelessWidget {
2525 this .onActionTap,
2626 }) : super (key: key);
2727
28- final User user;
29- final int totalLength;
30- final int index;
31- final double ? bottomMargin;
32- final VoidCallback ? onTap;
33- final VoidCallback ? onActionTap;
3428 final double ? avatarSize;
35- final EdgeInsets ? padding;
3629 final Color ? bgColor;
3730 final BorderRadius ? borderRadius;
31+ final double ? bottomMargin;
3832 final Widget ? extraActions;
33+ final int index;
34+ final VoidCallback ? onActionTap;
35+ final VoidCallback ? onTap;
36+ final EdgeInsets ? padding;
37+ final int totalLength;
38+ final User user;
3939
40- @override
41- Widget build (BuildContext context) {
42- final profile = ProfileController .find;
43- return GestureDetector (
44- onTap: onTap,
45- child: Container (
46- margin: Dimens .edgeInsets8_0,
47- padding: padding ?? Dimens .edgeInsets8,
48- constraints: BoxConstraints (
49- maxWidth: Dimens .screenWidth,
50- ),
51- decoration: BoxDecoration (
52- color: Theme .of (context).cardColor,
53- borderRadius: BorderRadius .circular (Dimens .four),
54- boxShadow: AppStyles .defaultShadow,
55- ),
56- child: Row (
57- crossAxisAlignment: CrossAxisAlignment .center,
58- children: [
59- Expanded (
60- child: Row (
61- mainAxisAlignment: MainAxisAlignment .start,
62- crossAxisAlignment: CrossAxisAlignment .center,
63- mainAxisSize: MainAxisSize .min,
64- children: [
65- Hero (
66- tag: user.id,
67- child: AvatarWidget (
68- avatar: user.avatar,
69- size: avatarSize ?? Dimens .twentyFour,
70- ),
71- ),
72- Dimens .boxWidth8,
73- Expanded (
74- child: Column (
75- mainAxisAlignment: MainAxisAlignment .start,
76- crossAxisAlignment: CrossAxisAlignment .start,
77- mainAxisSize: MainAxisSize .min,
78- children: [
79- _buildUserUsername (context),
80- _buildUserFullName (context),
81- ],
82- ),
83- ),
84- ],
85- ),
86- ),
87- if (user.id != profile.profileDetails! .user! .id)
88- _buildFollowAction (context),
89- ],
90- ),
91- ),
92- );
40+ String getFollowStatus (String status, BuildContext context) {
41+ if (status == "following" ) {
42+ return StringValues .following;
43+ }
44+
45+ if (status == "requested" ) {
46+ return StringValues .requested;
47+ }
48+
49+ return StringValues .follow;
50+ }
51+
52+ Color getButtonColor (String status, BuildContext context) {
53+ if (status == "following" || status == "requested" ) {
54+ return Theme .of (context).dividerColor;
55+ }
56+
57+ return ColorValues .primaryColor;
58+ }
59+
60+ Color getLabelColor (String status, BuildContext context) {
61+ if (status == "following" || status == "requested" ) {
62+ return Theme .of (context).textTheme.bodyLarge! .color! ;
63+ }
64+
65+ return ColorValues .whiteColor;
9366 }
9467
9568 Widget _buildUserUsername (BuildContext context) => Row (
@@ -151,31 +124,58 @@ class UserWidget extends StatelessWidget {
151124 ),
152125 );
153126
154- String getFollowStatus (String status, BuildContext context) {
155- if (status == "following" ) {
156- return StringValues .following;
157- }
158-
159- if (status == "requested" ) {
160- return StringValues .requested;
161- }
162-
163- return StringValues .follow;
164- }
165-
166- Color getButtonColor (String status, BuildContext context) {
167- if (status == "following" || status == "requested" ) {
168- return Theme .of (context).dividerColor;
169- }
170-
171- return ColorValues .primaryColor;
172- }
173-
174- Color getLabelColor (String status, BuildContext context) {
175- if (status == "following" || status == "requested" ) {
176- return Theme .of (context).textTheme.bodyLarge! .color! ;
177- }
178-
179- return ColorValues .whiteColor;
127+ @override
128+ Widget build (BuildContext context) {
129+ final profile = ProfileController .find;
130+ return GestureDetector (
131+ onTap: onTap,
132+ child: Container (
133+ margin: Dimens .edgeInsets8_0,
134+ padding: padding ?? Dimens .edgeInsets8,
135+ constraints: BoxConstraints (
136+ maxWidth: Dimens .screenWidth,
137+ ),
138+ decoration: BoxDecoration (
139+ color: Theme .of (context).cardColor,
140+ borderRadius: BorderRadius .circular (Dimens .four),
141+ boxShadow: AppStyles .defaultShadow,
142+ ),
143+ child: Row (
144+ crossAxisAlignment: CrossAxisAlignment .center,
145+ children: [
146+ Expanded (
147+ child: Row (
148+ mainAxisAlignment: MainAxisAlignment .start,
149+ crossAxisAlignment: CrossAxisAlignment .center,
150+ mainAxisSize: MainAxisSize .min,
151+ children: [
152+ Hero (
153+ tag: user.id,
154+ child: AvatarWidget (
155+ avatar: user.avatar,
156+ size: avatarSize ?? Dimens .twentyFour,
157+ ),
158+ ),
159+ Dimens .boxWidth8,
160+ Expanded (
161+ child: Column (
162+ mainAxisAlignment: MainAxisAlignment .start,
163+ crossAxisAlignment: CrossAxisAlignment .start,
164+ mainAxisSize: MainAxisSize .min,
165+ children: [
166+ _buildUserUsername (context),
167+ _buildUserFullName (context),
168+ ],
169+ ),
170+ ),
171+ ],
172+ ),
173+ ),
174+ if (user.id != profile.profileDetails! .user! .id)
175+ _buildFollowAction (context),
176+ ],
177+ ),
178+ ),
179+ );
180180 }
181181}
0 commit comments