Skip to content
This repository was archived by the owner on Feb 20, 2023. It is now read-only.

feat: become a volunteer, implement to use local #199

Open
wants to merge 1 commit into
base: develop
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
37 changes: 20 additions & 17 deletions assets/translations/ar-SY.json
Original file line number Diff line number Diff line change
@@ -107,20 +107,23 @@
"approve_single": "Onayla",
"whatsapp": "Whatsapp",
"apple_tutorial_settings": "1- Ayarlar",
"apple_tutorial_privacy":"2- Gizlilik ve Güvenlik",
"apple_tutorial_location":"3- Konum Servisleri",
"apple_tutorial_closed":"4- Kapalı Butonu",
"apple_tutorial_opened":"5- Açık Hale Getir",
"android_tutorial_settings":"1- Ayarlar",
"android_tutorial_location":"2- Konum Servisleri",
"android_tutorial_closed":"3- Kapalı Butonu",
"android_tutorial_opened":"4- Açık Hale Getir",
"chrome_tutorial_settings":"1- Ayarlar",
"chrome_tutorial_location":"2- Konum Servisleri",
"chrome_tutorial_closed":"3- Kapalı Butonu",
"chrome_tutorial_opened":"4- Açık Hale Getir",
"safari_tutorial_settings":"1- AA İkonuna bas",
"safari_tutorial_location":"2- Konum Servisleri",
"safari_tutorial_closed":"3- Kapalı Butonu",
"safari_tutorial_opened":"4- Açık Hale Getir"
}
"apple_tutorial_privacy": "2- Gizlilik ve Güvenlik",
"apple_tutorial_location": "3- Konum Servisleri",
"apple_tutorial_closed": "4- Kapalı Butonu",
"apple_tutorial_opened": "5- Açık Hale Getir",
"android_tutorial_settings": "1- Ayarlar",
"android_tutorial_location": "2- Konum Servisleri",
"android_tutorial_closed": "3- Kapalı Butonu",
"android_tutorial_opened": "4- Açık Hale Getir",
"chrome_tutorial_settings": "1- Ayarlar",
"chrome_tutorial_location": "2- Konum Servisleri",
"chrome_tutorial_closed": "3- Kapalı Butonu",
"chrome_tutorial_opened": "4- Açık Hale Getir",
"safari_tutorial_settings": "1- AA İkonuna bas",
"safari_tutorial_location": "2- Konum Servisleri",
"safari_tutorial_closed": "3- Kapalı Butonu",
"safari_tutorial_opened": "4- Açık Hale Getir",
"become_volunteer_nav_btn": "تطوع",
"become_volunteer_page_title": "تطوع",
"become_volunteer_submit_btn": "تطوع"
}
37 changes: 20 additions & 17 deletions assets/translations/en-US.json
Original file line number Diff line number Diff line change
@@ -107,20 +107,23 @@
"approve_single": "Onayla",
"whatsapp": "Whatsapp",
"apple_tutorial_settings": "1- Ayarlar",
"apple_tutorial_privacy":"2- Gizlilik ve Güvenlik",
"apple_tutorial_location":"3- Konum Servisleri",
"apple_tutorial_closed":"4- Kapalı Butonu",
"apple_tutorial_opened":"5- Açık Hale Getir",
"android_tutorial_settings":"1- Ayarlar",
"android_tutorial_location":"2- Konum Servisleri",
"android_tutorial_closed":"3- Kapalı Butonu",
"android_tutorial_opened":"4- Açık Hale Getir",
"chrome_tutorial_settings":"1- Ayarlar",
"chrome_tutorial_location":"2- Konum Servisleri",
"chrome_tutorial_closed":"3- Kapalı Butonu",
"chrome_tutorial_opened":"4- Açık Hale Getir",
"safari_tutorial_settings":"1- AA İkonuna bas",
"safari_tutorial_location":"2- Konum Servisleri",
"safari_tutorial_closed":"3- Kapalı Butonu",
"safari_tutorial_opened":"4- Açık Hale Getir"
}
"apple_tutorial_privacy": "2- Gizlilik ve Güvenlik",
"apple_tutorial_location": "3- Konum Servisleri",
"apple_tutorial_closed": "4- Kapalı Butonu",
"apple_tutorial_opened": "5- Açık Hale Getir",
"android_tutorial_settings": "1- Ayarlar",
"android_tutorial_location": "2- Konum Servisleri",
"android_tutorial_closed": "3- Kapalı Butonu",
"android_tutorial_opened": "4- Açık Hale Getir",
"chrome_tutorial_settings": "1- Ayarlar",
"chrome_tutorial_location": "2- Konum Servisleri",
"chrome_tutorial_closed": "3- Kapalı Butonu",
"chrome_tutorial_opened": "4- Açık Hale Getir",
"safari_tutorial_settings": "1- AA İkonuna bas",
"safari_tutorial_location": "2- Konum Servisleri",
"safari_tutorial_closed": "3- Kapalı Butonu",
"safari_tutorial_opened": "4- Açık Hale Getir",
"become_volunteer_nav_btn": "Become a Volunteer",
"become_volunteer_page_title": "Become a Volunteer",
"become_volunteer_submit_btn": "Submit"
}
37 changes: 20 additions & 17 deletions assets/translations/tr-TR.json
Original file line number Diff line number Diff line change
@@ -107,20 +107,23 @@
"approve_single": "Onayla",
"whatsapp": "Whatsapp",
"apple_tutorial_settings": "1- Ayarlar",
"apple_tutorial_privacy":"2- Gizlilik ve Güvenlik",
"apple_tutorial_location":"3- Konum Servisleri",
"apple_tutorial_closed":"4- Kapalı Butonu",
"apple_tutorial_opened":"5- Açık Hale Getir",
"android_tutorial_settings":"1- Ayarlar",
"android_tutorial_location":"2- Konum Servisleri",
"android_tutorial_closed":"3- Kapalı Butonu",
"android_tutorial_opened":"4- Açık Hale Getir",
"chrome_tutorial_settings":"1- Ayarlar",
"chrome_tutorial_location":"2- Konum Servisleri",
"chrome_tutorial_closed":"3- Kapalı Butonu",
"chrome_tutorial_opened":"4- Açık Hale Getir",
"safari_tutorial_settings":"1- AA İkonuna bas",
"safari_tutorial_location":"2- Konum Servisleri",
"safari_tutorial_closed":"3- Kapalı Butonu",
"safari_tutorial_opened":"4- Açık Hale Getir"
}
"apple_tutorial_privacy": "2- Gizlilik ve Güvenlik",
"apple_tutorial_location": "3- Konum Servisleri",
"apple_tutorial_closed": "4- Kapalı Butonu",
"apple_tutorial_opened": "5- Açık Hale Getir",
"android_tutorial_settings": "1- Ayarlar",
"android_tutorial_location": "2- Konum Servisleri",
"android_tutorial_closed": "3- Kapalı Butonu",
"android_tutorial_opened": "4- Açık Hale Getir",
"chrome_tutorial_settings": "1- Ayarlar",
"chrome_tutorial_location": "2- Konum Servisleri",
"chrome_tutorial_closed": "3- Kapalı Butonu",
"chrome_tutorial_opened": "4- Açık Hale Getir",
"safari_tutorial_settings": "1- AA İkonuna bas",
"safari_tutorial_location": "2- Konum Servisleri",
"safari_tutorial_closed": "3- Kapalı Butonu",
"safari_tutorial_opened": "4- Açık Hale Getir",
"become_volunteer_nav_btn": "Gönüllü Ol",
"become_volunteer_page_title": "Gönüllü Ol",
"become_volunteer_submit_btn": "Gönüllü Ol"
}
2 changes: 1 addition & 1 deletion lib/app.dart
Original file line number Diff line number Diff line change
@@ -59,7 +59,7 @@ class _DepremDestekAppState extends State<DepremDestekApp> {
home: state.when(
initializing: () => const Scaffold(body: Loader()),
introduction: () => const IntroductionPage(),
loaded: (_, __) => const DemandsPage(),
loaded: (_, __, ___) => const DemandsPage(),
failed: () => const AppLoadFailurePage(),
loading: () => const Scaffold(body: Loader()),
),
8 changes: 7 additions & 1 deletion lib/data/repository/location_repository.dart
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ class LocationRepository {
'AIzaSyBhcGwfVK2wWFRwo7fpKQ64BLdH0qS6Nb0',
);

Future<GoogleGeocodingResult> getLocation() async {
Future<Position> getPosition() async {
bool serviceEnabled;
LocationPermission permission;

@@ -30,6 +30,12 @@ class LocationRepository {

final position = await Geolocator.getCurrentPosition();

return position;
}

Future<GoogleGeocodingResult> getGeoLocation() async {
final position = await getPosition();

final res = await _googleGeocodingApi.reverse(
'${position.latitude},${position.longitude}',
language: 'tr',
3 changes: 2 additions & 1 deletion lib/pages/demand_details_page/demand_details_page.dart
Original file line number Diff line number Diff line change
@@ -30,7 +30,8 @@ class DemandDetailsPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
final currentLocation = context.read<AppCubit>().state.whenOrNull(
loaded: (currentLocation, demandCategories) => currentLocation,
loaded: (currentLocation, position, demandCategories) =>
currentLocation,
);

if (currentLocation == null) {
3 changes: 2 additions & 1 deletion lib/pages/demands_page/demands_page.dart
Original file line number Diff line number Diff line change
@@ -20,7 +20,8 @@ class DemandsPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
final currentLocation = context.read<AppCubit>().state.whenOrNull(
loaded: (currentLocation, demandCategories) => currentLocation,
loaded: (currentLocation, position, demandCategories) =>
currentLocation,
);

if (currentLocation == null) {
2 changes: 1 addition & 1 deletion lib/pages/demands_page/widgets/demand_card.dart
Original file line number Diff line number Diff line change
@@ -31,7 +31,7 @@ class DemandCard extends StatelessWidget {
@override
Widget build(BuildContext context) {
final demandCategories = context.read<AppCubit>().state.whenOrNull(
loaded: (_, demandCategories) => demandCategories,
loaded: (_, __, demandCategories) => demandCategories,
)!;
return GestureDetector(
onTap: !isDetailed
2 changes: 1 addition & 1 deletion lib/pages/demands_page/widgets/demand_filter_popup.dart
Original file line number Diff line number Diff line change
@@ -63,7 +63,7 @@ class _DemandFilterDrawerState extends State<DemandFilterDrawer> {
final appState = context.read<AppCubit>().state;
final demandCategories = appState
.whenOrNull(
loaded: (_, demandCategories) => demandCategories,
loaded: (_, __, demandCategories) => demandCategories,
)!
.toList();

12 changes: 12 additions & 0 deletions lib/pages/demands_page/widgets/demands_page_appbar.dart
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@ import 'package:afet_destek/gen/translations/locale_keys.g.dart';
import 'package:afet_destek/pages/auth_page/auth_page.dart';
import 'package:afet_destek/pages/demands_page/state/demands_cubit.dart';
import 'package:afet_destek/pages/my_demand_page/my_demand_page.dart';
import 'package:afet_destek/pages/volutneer_request/volunteer_request_page.dart';
import 'package:afet_destek/shared/extensions/translation_extension.dart';
import 'package:afet_destek/shared/theme/color_extensions.dart';
import 'package:afet_destek/shared/widgets/responsive_app_bar.dart';
@@ -23,6 +24,17 @@ class DemandPageAppBar extends StatelessWidget implements PreferredSizeWidget {
hasMobileLeading: true,
mobileTile: Row(
children: [
OutlinedButton(
onPressed: () {
VolunteerRequestPage.show(
context,
onClose: () {},
);
},
child: Text(
LocaleKeys.become_volunteer_nav_btn.getStr(),
),
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 10),
child: GestureDetector(
6 changes: 4 additions & 2 deletions lib/pages/my_demand_page/my_demand_page.dart
Original file line number Diff line number Diff line change
@@ -11,6 +11,7 @@ import 'package:afet_destek/shared/extensions/reactive_forms_extensions.dart';
import 'package:afet_destek/shared/extensions/translation_extension.dart';
import 'package:afet_destek/shared/state/app_cubit.dart';
import 'package:afet_destek/shared/theme/color_extensions.dart';
import 'package:afet_destek/shared/widgets/app_form_field_title.dart';
import 'package:afet_destek/shared/widgets/core_confirmation_dialog.dart';
import 'package:afet_destek/shared/widgets/loader.dart';
import 'package:afet_destek/shared/widgets/reactive_intl_phone_field.dart';
@@ -195,7 +196,7 @@ class _MyDemandPageState extends State<MyDemandPage> {
.value = FirebaseAuth.instance.currentUser?.phoneNumber;

final currentLocation = context.read<AppCubit>().state.whenOrNull(
loaded: (currentLocation, demandCategories) => currentLocation,
loaded: (currentLocation, __, demandCategories) => currentLocation,
);

_myDemandPageFormGroup
@@ -251,7 +252,8 @@ class _MyDemandPageState extends State<MyDemandPage> {
@override
Widget build(BuildContext context) {
final currentLocation = context.read<AppCubit>().state.whenOrNull(
loaded: (currentLocation, demandCategories) => currentLocation,
loaded: (currentLocation, position, demandCategories) =>
currentLocation,
);
final appState = context.read<AppCubit>().state.mapOrNull(
loaded: (loadedAppState) => loadedAppState,
39 changes: 9 additions & 30 deletions lib/pages/my_demand_page/widgets/demand_category_selector.dart
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@ import 'package:afet_destek/gen/translations/locale_keys.g.dart';
import 'package:afet_destek/shared/extensions/translation_extension.dart';
import 'package:afet_destek/shared/state/app_cubit.dart';
import 'package:afet_destek/shared/theme/color_extensions.dart';
import 'package:afet_destek/shared/widgets/app_form_field_title.dart';
import 'package:afet_destek/shared/widgets/loader.dart';
import 'package:collection/collection.dart';
import 'package:flutter/material.dart';
@@ -25,11 +26,12 @@ class _DemandCategorySelectorState extends State<DemandCategorySelector> {
controller.text = _selectedCategoryIds
.map(
(id) => context.read<AppCubit>().state.whenOrNull(
loaded: (currentLocation, demandCategories) => demandCategories
.firstWhereOrNull(
(category) => category.id == id,
)
?.name,
loaded: (currentLocation, position, demandCategories) =>
demandCategories
.firstWhereOrNull(
(category) => category.id == id,
)
?.name,
),
)
.whereNotNull()
@@ -51,7 +53,8 @@ class _DemandCategorySelectorState extends State<DemandCategorySelector> {
_selectedCategoryIds = List.from(widget.formControl.value as List<String>);

final demandCategories = context.read<AppCubit>().state.whenOrNull(
loaded: (currentLocation, demandCategories) => demandCategories,
loaded: (currentLocation, position, demandCategories) =>
demandCategories,
);

if (demandCategories == null) {
@@ -202,27 +205,3 @@ class _DemandCategorySelectorState extends State<DemandCategorySelector> {
);
}
}

class AppFormFieldTitle extends StatelessWidget {
const AppFormFieldTitle({
super.key,
required this.title,
});

final String title;

@override
Widget build(BuildContext context) {
return Column(
children: [
Text(
title,
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
color: context.appColors.subtitles,
),
),
const SizedBox(height: 8),
],
);
}
}
26 changes: 0 additions & 26 deletions lib/pages/my_demand_page/widgets/my_demand_button.dart

This file was deleted.

Loading