Skip to content

Commit

Permalink
fix: remove dublicate code from settings screen
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahmed-Aladdiin committed Nov 1, 2024
1 parent 8576040 commit d350ae0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 44 deletions.
2 changes: 1 addition & 1 deletion lib/features/auth/view_model/auth_view_model.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 10 additions & 43 deletions lib/features/user/view/screens/settings_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ class _SettingsScreen extends ConsumerState<SettingsScreen> {
IconButton(
onPressed: () {
ref.read(authViewModelProvider.notifier).logOut();
context.go(Routes.logIn);
},
icon: const Icon(Icons.more_vert)),
],
Expand All @@ -188,58 +189,24 @@ class _SettingsScreen extends ConsumerState<SettingsScreen> {
},
),
),
SliverToBoxAdapter(
const SliverToBoxAdapter(
child: Column(
children: [
SettingsSection(
settingsOptions: const [],
settingsOptions: [],
actions: [
GestureDetector(
onTap: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => const AddMyImageScreen(
destination: 'profile'),
),
);
},
child: const SettingsOptionWidget(
key: ValueKey("set-profile-photo-option"),
icon: Icons.camera_alt_outlined,
iconColor: Palette.primary,
text: "Set Profile Photo",
color: Palette.primary,
showDivider: false,
),
SettingsOptionWidget(
key: ValueKey("set-profile-photo-option"),
icon: Icons.camera_alt_outlined,
iconColor: Palette.primary,
text: "Set Profile Photo",
color: Palette.primary,
showDivider: false,
)
],
),
],
)),
SliverList(
delegate: SliverChildBuilderDelegate((context, index) {
final section = profileSections[index];
final title = section["title"] ?? "";
final options = section["options"];
final trailing = section["trailing"] ?? "";
return const Column(
children: [
SettingsSection(
settingsOptions: [],
actions: [
SettingsOptionWidget(
key: ValueKey("set-profile-photo-option"),
icon: Icons.camera_alt_outlined,
iconColor: Palette.primary,
text: "Set Profile Photo",
color: Palette.primary,
showDivider: false,
)
],
),
],
);
})),
SliverList(
delegate: SliverChildBuilderDelegate(
(context, index) {
Expand Down

0 comments on commit d350ae0

Please sign in to comment.