Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #417 #418

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
129 changes: 79 additions & 50 deletions lib/views/screens/profile_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ProfileScreen extends StatelessWidget {
}) : super(key: key);

final emailVerifyController =
Get.put<EmailVerifyController>(EmailVerifyController());
Get.put<EmailVerifyController>(EmailVerifyController());
final authController = Get.find<AuthStateController>();
final exploreStoryController = Get.find<ExploreStoryController>();

Expand Down Expand Up @@ -146,41 +146,71 @@ class ProfileScreen extends StatelessWidget {
return Row(
children: [
Expanded(
child: ElevatedButton(
onPressed: () {
if (isCreatorProfile != null) {
// Implement follow functionality
} else {
Get.toNamed(AppRoutes.editProfile);
child: Builder(
builder: (context) {
final buttonStyle = Theme.of(context).elevatedButtonTheme.style;
final foregroundColor = buttonStyle?.foregroundColor?.resolve({WidgetState.selected});

return ElevatedButton(
onPressed: () {
if (isCreatorProfile != null) {
// Implement follow functionality
} else {
Get.toNamed(AppRoutes.editProfile);
}
},
style: ElevatedButton.styleFrom(
padding: EdgeInsets.symmetric(vertical: 10),
),
child: FittedBox(
fit: BoxFit.scaleDown,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
isCreatorProfile != null ? Icons.add : Icons.edit,
color: foregroundColor,
),
const SizedBox(width: 10),
Text(isCreatorProfile != null ? "Follow" : "Edit Profile"),
],
),
),
);
}
},
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
isCreatorProfile != null
? const Icon(Icons.add)
: const Icon(Icons.edit),
const SizedBox(width: 10),
Text(isCreatorProfile != null ? "Follow" : "Edit Profile"),
],
),
),
),
const SizedBox(width: 10),
if (isCreatorProfile == null)
Expanded(
child: ElevatedButton(
onPressed: () {
Get.toNamed(AppRoutes.settings);
},
child: const Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(Icons.settings),
SizedBox(width: 10),
Text("Settings"),
],
),
child: Builder(
builder: (context) {
final buttonStyle = Theme.of(context).elevatedButtonTheme.style;
final foregroundColor = buttonStyle?.foregroundColor?.resolve({WidgetState.selected});

return ElevatedButton(
onPressed: () {
Get.toNamed(AppRoutes.settings);
},
style: ElevatedButton.styleFrom(
padding: EdgeInsets.symmetric(vertical: 10),
),
child: FittedBox(
fit: BoxFit.scaleDown,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
Icons.settings,
color: foregroundColor,
),
const SizedBox(width: 10),
const Text("Settings"),
],
),
),
);
}
),
),
],
Expand All @@ -205,7 +235,7 @@ class ProfileScreen extends StatelessWidget {
),
SizedBox(height: UiSizes.height_5),
Obx(
()=> _buildStoriesList(
() => _buildStoriesList(
exploreStoryController.userCreatedStories,
isCreatorProfile != null
? "User has not created any story"
Expand All @@ -224,7 +254,7 @@ class ProfileScreen extends StatelessWidget {
),
SizedBox(height: UiSizes.height_5),
Obx(
()=> _buildStoriesList(
() => _buildStoriesList(
exploreStoryController.userLikedStories,
isCreatorProfile != null
? "User has not liked any story"
Expand All @@ -240,25 +270,24 @@ class ProfileScreen extends StatelessWidget {
height: UiSizes.height_200,
child: stories.isNotEmpty
? ListView.builder(
itemCount: stories.length,
scrollDirection: Axis.horizontal,
itemBuilder: (context, index) {
return StoryItem(
story: stories[index],
);
},
)
itemCount: stories.length,
scrollDirection: Axis.horizontal,
itemBuilder: (context, index) {
return StoryItem(
story: stories[index],
);
},
)
: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
height: 150, width: 150, AppImages.emptyBoxImage),
const SizedBox(
height: 5,
),
Text(noStoryTextToShow)
],
),
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(height: 150, width: 150, AppImages.emptyBoxImage),
const SizedBox(
height: 5,
),
Text(noStoryTextToShow)
],
),
);
}
}
Expand Down