Skip to content

Commit

Permalink
Fix lintFix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
kaushik committed Jul 2, 2024
1 parent 09a7c23 commit a71d85b
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 100 deletions.
67 changes: 36 additions & 31 deletions app/lib/ui/flow/geofence/add/addnew/add_new_place_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,42 +29,47 @@ class _AddNewPlaceViewState extends ConsumerState<AddNewPlaceView> {
@override
Widget build(BuildContext context) {
notifier = ref.watch(addNewPlaceStateProvider.notifier);
final state = ref.watch(addNewPlaceStateProvider);

_observeError();

return AppPage(
title: context.l10n.add_new_place_title,
body: Padding(
padding: EdgeInsets.only(
left: 16,
right: 16,
bottom: context.mediaQueryPadding.bottom + 24,
),
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_searchTextField(),
const SizedBox(height: 40),
_locateOnMapView(),
const SizedBox(height: 40),
Text(
context.l10n.add_new_place_suggestion_text,
style: AppTextStyle.caption.copyWith(
color: context.colorScheme.textDisabled,
),
body: _body(),
);
}

Widget _body() {
final state = ref.watch(addNewPlaceStateProvider);

return Padding(
padding: EdgeInsets.only(
left: 16,
right: 16,
bottom: context.mediaQueryPadding.bottom + 24,
),
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_searchTextField(),
const SizedBox(height: 40),
_locateOnMapView(),
const SizedBox(height: 40),
Text(
context.l10n.add_new_place_suggestion_text,
style: AppTextStyle.caption.copyWith(
color: context.colorScheme.textDisabled,
),
const SizedBox(height: 16),
...state.places.map((place) {
final isLast =
state.places.indexOf(place) == state.places.length - 1;
return _placesItemView(place, isLast);
}),
const SizedBox(height: 24),
state.loading ? const AppProgressIndicator() : Container(),
],
),
),
const SizedBox(height: 16),
...state.places.map((place) {
final isLast =
state.places.indexOf(place) == state.places.length - 1;
return _suggestedPlaceItemView(place, isLast);
}),
const SizedBox(height: 24),
state.loading ? const AppProgressIndicator() : Container(),
],
),
),
);
Expand Down Expand Up @@ -143,7 +148,7 @@ class _AddNewPlaceViewState extends ConsumerState<AddNewPlaceView> {
);
}

Widget _placesItemView(ApiNearbyPlace place, bool isLast) {
Widget _suggestedPlaceItemView(ApiNearbyPlace place, bool isLast) {
return Column(
children: [
Padding(
Expand Down
6 changes: 4 additions & 2 deletions app/lib/ui/flow/geofence/add/locate/locate_on_map_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ class _LocateOnMapViewState extends ConsumerState<LocateOnMapView> {
),
Center(child: _locateMarkerView()),
Align(
alignment: Alignment.bottomRight, child: _locateIconButton(context))
alignment: Alignment.bottomRight,
child: _currentLocationIconView(context),
)
]),
);
}
Expand All @@ -110,7 +112,7 @@ class _LocateOnMapViewState extends ConsumerState<LocateOnMapView> {
);
}

Widget _locateIconButton(BuildContext context) {
Widget _currentLocationIconView(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 24),
child: IconPrimaryButton(
Expand Down
56 changes: 30 additions & 26 deletions app/lib/ui/flow/geofence/add/placename/choose_place_name_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,34 +46,38 @@ class _ChoosePlaceNameViewState extends ConsumerState<ChoosePlaceNameView> {

@override
Widget build(BuildContext context) {
final state = ref.watch(choosePlaceViewStateProvider);

_observeError();
_observePopToPlacesListScreen();

return AppPage(
title: context.l10n.choose_place_screen_title,
body: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_searchTextField(),
const SizedBox(height: 40),
Text(
context.l10n.choose_place_suggestion_text,
style: AppTextStyle.caption
.copyWith(color: context.colorScheme.textDisabled),
),
const SizedBox(height: 16),
_suggestionsView(state.suggestions),
const Spacer(),
Align(
alignment: Alignment.center,
child: _addPlaceButtonView(state),
)
],
),
body: _body(),
);
}

Widget _body() {
final state = ref.watch(choosePlaceViewStateProvider);

return Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_searchTextField(),
const SizedBox(height: 40),
Text(
context.l10n.choose_place_suggestion_text,
style: AppTextStyle.caption
.copyWith(color: context.colorScheme.textDisabled),
),
const SizedBox(height: 16),
_suggestionsPlaceView(state.suggestions),
const Spacer(),
Align(
alignment: Alignment.center,
child: _addPlaceButtonView(state),
)
],
),
);
}
Expand Down Expand Up @@ -117,7 +121,7 @@ class _ChoosePlaceNameViewState extends ConsumerState<ChoosePlaceNameView> {
);
}

Widget _suggestionsView(List<String>? suggestions) {
Widget _suggestionsPlaceView(List<String>? suggestions) {
if (suggestions == null) return Container();
return Wrap(
alignment: WrapAlignment.start,
Expand Down Expand Up @@ -179,7 +183,7 @@ class _ChoosePlaceNameViewState extends ConsumerState<ChoosePlaceNameView> {
choosePlaceViewStateProvider.select((state) => state.popToPlaceList),
(_, next) {
AppRoute.popTo(context, AppRoute.pathPlacesList);
_showPlaceAddedPrompt(
_showPlaceAddedDialog(
context,
widget.location.latitude,
widget.location.longitude,
Expand All @@ -188,7 +192,7 @@ class _ChoosePlaceNameViewState extends ConsumerState<ChoosePlaceNameView> {
});
}

void _showPlaceAddedPrompt(
void _showPlaceAddedDialog(
BuildContext context,
double lat,
double lng,
Expand Down
80 changes: 40 additions & 40 deletions app/lib/ui/flow/geofence/places/places_list_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class _PlacesViewState extends ConsumerState<PlacesListView> {
itemCount: placeLength + state.suggestions.length,
itemBuilder: (_, index) {
if (index < state.places.length) {
return _placesListItem(state, state.places[index]);
return _memberPlaceItem(state, state.places[index]);
}

if (index == state.places.length && state.places.isNotEmpty) {
Expand Down Expand Up @@ -90,45 +90,7 @@ class _PlacesViewState extends ConsumerState<PlacesListView> {
);
}

Widget _addPlaceButton() {
return OnTapScale(
onTap: () {
AppRoute.addNewPlace(widget.spaceId).push(context);
},
child: Container(
margin: EdgeInsets.only(
right: 16,
bottom: context.mediaQueryPadding.bottom + 16,
),
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(30),
color: context.colorScheme.primary,
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
SvgPicture.asset(
Assets.images.icPlusIcon,
colorFilter: ColorFilter.mode(
context.colorScheme.onPrimary,
BlendMode.srcATop,
),
),
const SizedBox(width: 8),
Text(
context.l10n.places_list_add_place_btn_text,
style: AppTextStyle.button.copyWith(
color: context.colorScheme.onPrimary,
),
)
],
),
),
);
}

Widget _placesListItem(PlacesListState state, ApiPlace item) {
Widget _memberPlaceItem(PlacesListState state, ApiPlace item) {
final icon = _getPlacesIcon(item.name);
final isDeleting =
state.deletingPlaces && state.placesToDelete?.id == item.id;
Expand Down Expand Up @@ -205,6 +167,44 @@ class _PlacesViewState extends ConsumerState<PlacesListView> {
);
}

Widget _addPlaceButton() {
return OnTapScale(
onTap: () {
AppRoute.addNewPlace(widget.spaceId).push(context);
},
child: Container(
margin: EdgeInsets.only(
right: 16,
bottom: context.mediaQueryPadding.bottom + 16,
),
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(30),
color: context.colorScheme.primary,
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
SvgPicture.asset(
Assets.images.icPlusIcon,
colorFilter: ColorFilter.mode(
context.colorScheme.onPrimary,
BlendMode.srcATop,
),
),
const SizedBox(width: 8),
Text(
context.l10n.places_list_add_place_btn_text,
style: AppTextStyle.button.copyWith(
color: context.colorScheme.onPrimary,
),
)
],
),
),
);
}

String _getPlacesIcon(String name) {
if (name == 'Home') {
return Assets.images.icPlacesHomeIcon;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class PlacesListViewNotifier extends StateNotifier<PlacesListState> {
}

void dismissDeletePlaceDialog() {
state = state.copyWith(deletingPlaces: false, placesToDelete: null);
state = state.copyWith(placesToDelete: null);
}

void deletePlace() async {
Expand Down

0 comments on commit a71d85b

Please sign in to comment.