Skip to content

Commit

Permalink
Implement edit place screen
Browse files Browse the repository at this point in the history
  • Loading branch information
kaushik committed Jun 27, 2024
1 parent d4352ff commit f9a0aa0
Show file tree
Hide file tree
Showing 12 changed files with 1,383 additions and 52 deletions.
15 changes: 14 additions & 1 deletion app/assets/locales/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"common_get_started": "Get Started",
"common_next": "Next",
"common_yes": "Yes",
"common_save": "Save",
"common_cancel": "Cancel",
"common_delete": "Delete",
"common_okay": "Okay",
Expand Down Expand Up @@ -197,5 +198,17 @@
"choose_place_add_place_btn_text": "Add place",
"choose_place_prompt_added_title_text": "{placeName} Added",
"choose_place_prompt_sub_title_text": "You will be notified when members of your space arrive/leave this place",
"choose_place_prompt_got_it_btn_text": "Got it"
"choose_place_prompt_got_it_btn_text": "Got it",

"@_EditPlaces": {
},
"edit_place_title_text": "Edit place",
"edit_place_getting_address_text": "Getting Address…",
"edit_place_detail_title_text": "Place detail",
"edit_place_get_notified_title_text": "Get notified when...",
"edit_place_arrives_text": "Arrives",
"edit_place_leaves_text": "Leaves",
"edit_place_delete_place_btn_text": "Delete place",
"edit_place_only_admin_edit_text": "Only admin can edit or delete this place.",
"edit_place_delete_dialog_sub_title_text": "Are you sure you want to delete this place? This action cannot be undone."
}
14 changes: 14 additions & 0 deletions app/lib/ui/app_route.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import 'package:data/api/place/api_place.dart';
import 'package:flutter/cupertino.dart';
import 'package:go_router/go_router.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:yourspace_flutter/ui/flow/auth/sign_in/phone/verification/phone_verification_screen.dart';
import 'package:yourspace_flutter/ui/flow/geofence/add/locate/locate_on_map_view.dart';
import 'package:yourspace_flutter/ui/flow/geofence/add/placename/choose_place_name_view.dart';
import 'package:yourspace_flutter/ui/flow/geofence/edit/edit_place_view.dart';
import 'package:yourspace_flutter/ui/flow/geofence/places/places_list_view.dart';
import 'package:yourspace_flutter/ui/flow/onboard/pick_name_screen.dart';
import 'package:yourspace_flutter/ui/flow/permission/enable_permission_view.dart';
Expand Down Expand Up @@ -35,6 +37,7 @@ class AppRoute {
static const pathAddNewPlace = '/add-new-place';
static const pathLocateOnMap = "/locate_on_map";
static const pathChoosePlace = "/choose_place";
static const pathEditPlace = "/edit_place";

final String path;
final String? name;
Expand Down Expand Up @@ -193,6 +196,13 @@ class AppRoute {
);
}

static AppRoute editPlaceScreen(ApiPlace place) {
return AppRoute(
pathEditPlace,
builder: (_) => EditPlaceView(place: place),
);
}

static final routes = [
GoRoute(
path: intro.path,
Expand Down Expand Up @@ -278,6 +288,10 @@ class AppRoute {
GoRoute(
path: pathChoosePlace,
builder: (context, state) => state.widget(context),
),
GoRoute(
path: pathEditPlace,
builder: (context, state) => state.widget(context),
)
];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class ChoosePlaceNameViewNotifier extends StateNotifier<ChoosePlaceViewState> {
try {
state = state.copyWith(addingPlace: true);
final members = await spaceService.getMemberBySpaceId(_spaceId!);
final memberIds = members.map((member) => member.id).toList();
final memberIds = members.map((member) => member.user_id).toList();

await placesService.addPlace(
_spaceId!,
Expand Down
52 changes: 52 additions & 0 deletions app/lib/ui/flow/geofence/edit/components/place_marker.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter_svg/svg.dart';
import 'package:style/extenstions/context_extenstions.dart';

import '../../../../../gen/assets.gen.dart';

class PlaceMarker extends StatefulWidget {
final double radius;

const PlaceMarker({super.key, required this.radius});

@override
State<PlaceMarker> createState() => _PlaceMarkerState();
}

class _PlaceMarkerState extends State<PlaceMarker> {
@override
Widget build(BuildContext context) {
return Stack(
alignment: Alignment.center,
children: [
AnimatedContainer(
duration: const Duration(milliseconds: 300),
width: widget.radius,
height: widget.radius,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(widget.radius),
color: context.colorScheme.primary.withOpacity(0.5),
),
),
Container(
width: 40,
height: 40,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(30),
color: context.colorScheme.onPrimary,
),
child: Padding(
padding: const EdgeInsets.all(4),
child: SvgPicture.asset(
Assets.images.icLocationFeedIcon,
colorFilter: ColorFilter.mode(
context.colorScheme.primary,
BlendMode.srcATop,
),
),
),
),
],
);
}
}
Loading

0 comments on commit f9a0aa0

Please sign in to comment.